SST  15.1.0
StructuralSimulationToolkit
component.h
1 // Copyright 2009-2025 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-2025, 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 <map>
20 
21 using namespace SST::Statistics;
22 
23 namespace SST {
24 class SubComponent;
25 
26 /**
27  * Main component object for the simulation.
28  * All models inherit from this.
29  */
30 class Component : public BaseComponent
31 {
32 public:
33  SST_ELI_DECLARE_BASE(Component)
34  // declare extern to limit compile times
35  SST_ELI_DECLARE_CTOR_EXTERN(ComponentId_t,SST::Params&)
36  // These categories will print in sst-info in the order they are
37  // listed here
38  SST_ELI_DECLARE_INFO_EXTERN(
47 
48  /** Constructor. Generally only called by the factory class.
49  @param id Unique component ID
50  */
51  explicit Component(ComponentId_t id);
52  virtual ~Component() override = default;
53 
54 
55  void serialize_order(SST::Core::Serialization::serializer& ser) override;
56  ImplementSerializable(SST::Component)
57 
58 protected:
59  friend class SubComponent;
60  Component() = default; // For Serialization only
61 };
62 
63 } // namespace SST
64 
65 // These macros allow you to register a base class for a set of
66 // components that have the same (or substantially the same) ELI
67 // information. ELI information can be defined in the base class, and
68 // will be inherited by the child classes.
69 #define SST_ELI_REGISTER_COMPONENT_BASE(cls) \
70  SST_ELI_DECLARE_NEW_BASE(SST::Component,::cls) \
71  SST_ELI_NEW_BASE_CTOR(SST::ComponentId_t,SST::Params&)
72 
73 #define SST_ELI_REGISTER_COMPONENT_DERIVED_BASE(cls, base) \
74  SST_ELI_DECLARE_NEW_BASE(::base,::cls) \
75  SST_ELI_NEW_BASE_CTOR(SST::ComponentId_t,SST::Params&)
76 
77 // 'x' is needed because you can't pass ##__VAR_ARGS__ as the first
78 // item to the macro or you end up with a leading comma that won't
79 // compile.
80 #define ELI_GET_COMPONENT_DEFAULT(x, arg1, ...) arg1
81 
82 #define SST_ELI_REGISTER_COMPONENT(cls, lib, name, version, desc, cat, ...) \
83  SST_ELI_REGISTER_DERIVED(ELI_GET_COMPONENT_DEFAULT(,##__VA_ARGS__,SST::Component),cls,lib,name,ELI_FORWARD_AS_ONE(version),desc) \
84  SST_ELI_CATEGORY_INFO(cat)
85 
86 #endif // SST_CORE_COMPONENT_H
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:42
Definition: portsInfo.h:39
Main component object for the simulation.
Definition: component.h:30
Definition: statsInfo.h:39
Definition: action.cc:18
Definition: paramsInfo.h:39
Main component object for the simulation.
Definition: baseComponent.h:64
Definition: subcompSlotInfo.h:39
Parameter store.
Definition: params.h:63
Definition: attributeInfo.h:40
Definition: checkpointableInfo.h:39
Definition: categoryInfo.h:25
Definition: elementinfo.h:44
Definition: profilePointInfo.h:39
SubComponent is a class loadable through the factory which allows dynamic functionality to be added t...
Definition: subcomponent.h:28