SST 16.0.0
Structural Simulation Toolkit
component.h
1// Copyright 2009-2026 NTESS. Under the terms
2// of Contract DE-NA0003525 with NTESS, the U.S.
3// Government retains certain rights in this software.
4//
5// Copyright (c) 2009-2026, NTESS
6// All rights reserved.
7//
8// This file is part of the SST software package. For license
9// information, see the LICENSE file in the top level directory of the
10// distribution.
11
12#ifndef SST_CORE_COMPONENT_H
13#define SST_CORE_COMPONENT_H
14
15#include "sst/core/baseComponent.h"
16#include "sst/core/eli/elementinfo.h"
17#include "sst/core/sst_types.h"
18
19#include <cstdint>
20#include <map>
21
22using namespace SST::Statistics;
23
24namespace SST {
25class SubComponent;
26
27/**
28 * Main component object for the simulation.
29 * All models inherit from this.
30 */
31class Component : public BaseComponent
32{
33public:
34 SST_ELI_DECLARE_BASE(Component)
35 // declare extern to limit compile times
36 SST_ELI_DECLARE_CTOR_EXTERN(ComponentId_t,SST::Params&)
37 // These categories will print in sst-info in the order they are
38 // listed here
40 ELI::ProvidesCategory,
41 ELI::ProvidesParams,
42 ELI::ProvidesPorts,
43 ELI::ProvidesSubComponentSlots,
44 ELI::ProvidesStats,
45 ELI::ProvidesCheckpointable,
46 ELI::ProvidesProfilePoints,
47 ELI::ProvidesAttributes)
48
49 /** Constructor. Generally only called by the factory class.
50 @param id Unique component ID
51 */
52 explicit Component(ComponentId_t id);
53 virtual ~Component() override = default;
54
55
56 void serialize_order(SST::Core::Serialization::serializer& ser) override;
57 ImplementSerializable(SST::Component)
58
59protected:
60 friend class SubComponent;
61 Component() = default; // For Serialization only
62};
63
64} // namespace SST
65
66// These macros allow you to register a base class for a set of
67// components that have the same (or substantially the same) ELI
68// information. ELI information can be defined in the base class, and
69// will be inherited by the child classes.
70#define SST_ELI_REGISTER_COMPONENT_BASE(cls) \
71 SST_ELI_DECLARE_NEW_BASE(SST::Component,::cls) \
72 SST_ELI_NEW_BASE_CTOR(SST::ComponentId_t,SST::Params&)
73
74#define SST_ELI_REGISTER_COMPONENT_DERIVED_BASE(cls, base) \
75 SST_ELI_DECLARE_NEW_BASE(::base,::cls) \
76 SST_ELI_NEW_BASE_CTOR(SST::ComponentId_t,SST::Params&)
77
78// 'x' is needed because you can't pass ##__VAR_ARGS__ as the first
79// item to the macro or you end up with a leading comma that won't
80// compile.
81#define ELI_GET_COMPONENT_DEFAULT(x, arg1, ...) arg1
82
83#define SST_ELI_REGISTER_COMPONENT(cls, lib, name, version, desc, cat, ...) \
84 SST_ELI_REGISTER_DERIVED(ELI_GET_COMPONENT_DEFAULT(,##__VA_ARGS__,SST::Component),cls,lib,name,ELI_FORWARD_AS_ONE(version),desc) \
85 SST_ELI_CATEGORY_INFO(cat)
86
87#endif // SST_CORE_COMPONENT_H
SST_ELI_DECLARE_INFO_EXTERN(ELI::ProvidesCategory, ELI::ProvidesParams, ELI::ProvidesPorts, ELI::ProvidesSubComponentSlots, ELI::ProvidesStats, ELI::ProvidesCheckpointable, ELI::ProvidesProfilePoints, ELI::ProvidesAttributes) explicit Component(ComponentId_t id)
Constructor.
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition serializer.h:43
Parameter store.
Definition params.h:65
SubComponent is a class loadable through the factory which allows dynamic functionality to be added t...
Definition subcomponent.h:29