12 #ifndef SST_CORE_COMPONENTINFO_H 13 #define SST_CORE_COMPONENTINFO_H 15 #include "sst/core/params.h" 16 #include "sst/core/serialization/serializer_fwd.h" 17 #include "sst/core/sst_types.h" 18 #include "sst/core/timeConverter.h" 25 #include <unordered_set> 31 class ComponentInfoMap;
34 class ConfigPortModule;
35 class ConfigComponent;
36 class ConfigStatistic;
38 class Simulation_impl;
40 namespace Core::Serialization::pvt {
41 class SerializeBaseComponentHelper;
51 static const uint64_t SHARE_PORTS = 0x1;
52 static const uint64_t SHARE_STATS = 0x2;
53 static const uint64_t INSERT_STATS = 0x4;
54 static const uint64_t SHARE_NONE = 0x0;
59 static const uint64_t USER_FLAGS = 0x7;
74 const ComponentId_t id_;
80 const std::string name;
85 const std::string type;
104 std::map<ComponentId_t, ComponentInfo> subComponents;
118 std::map<std::string, std::vector<ConfigPortModule>>* port_modules_ =
nullptr;
119 std::map<StatisticId_t, ConfigStatistic>* stat_configs_ =
nullptr;
120 std::map<std::string, StatisticId_t>* enabled_stat_names_ =
nullptr;
121 bool enabled_all_stats_ =
false;
124 uint8_t statLoadLevel;
126 std::vector<double> coordinates;
136 const std::string slot_name;
149 uint64_t share_flags;
151 bool sharesPorts() {
return (share_flags & SHARE_PORTS) != 0; }
153 bool sharesStatistics() {
return (share_flags & SHARE_STATS) != 0; }
155 bool canInsertStatistics() {
return (share_flags & INSERT_STATS) != 0; }
157 inline void setComponent(BaseComponent* comp) { component = comp; }
162 void finalizeLinkConfiguration()
const;
163 void prepareForComplete()
const;
165 ComponentId_t addAnonymousSubComponent(
ComponentInfo* parent_info,
const std::string& type,
166 const std::string& slot_name,
int slot_num, uint64_t share_flags);
185 int slot_num, uint64_t share_flags );
192 bool isAnonymous() {
return COMPDEFINED_SUBCOMPONENT_ID_MASK(id_); }
194 bool isUser() {
return !COMPDEFINED_SUBCOMPONENT_ID_MASK(id_); }
196 inline ComponentId_t getID()
const {
return id_; }
198 inline const std::string& getName()
const 200 if ( name.empty() && parent_info )
return parent_info->getName();
204 inline const std::string& getParentComponentName()
const 209 while ( real_comp->parent_info !=
nullptr )
210 real_comp = real_comp->parent_info;
211 return real_comp->getName();
218 inline std::string
getShortName()
const {
return name.substr(name.find_last_of(
':') + 1); }
220 inline const std::string& getSlotName()
const {
return slot_name; }
222 inline int getSlotNum()
const {
return slot_num; }
224 inline const std::string& getType()
const {
return type; }
226 inline BaseComponent* getComponent()
const {
return component; }
228 LinkMap* getLinkMap();
230 inline const Params* getParams()
const {
return params; }
233 inline std::map<ComponentId_t, ComponentInfo>& getSubComponents() {
return subComponents; }
235 ComponentInfo* findSubComponent(
const std::string& slot,
int slot_num);
237 bool hasLinks()
const;
239 uint8_t getStatisticLoadLevel() {
return statLoadLevel; }
245 std::hash<std::string> hash;
246 return hash(info->name);
259 std::hash<ComponentId_t> hash;
260 return hash(info->id_);
281 void test_printComponentInfoHierarchy(
int index = 0);
287 std::unordered_set<ComponentInfo*, ComponentInfo::HashID, ComponentInfo::EqualsID> dataByID;
290 using const_iterator =
291 std::unordered_set<ComponentInfo*, ComponentInfo::HashID, ComponentInfo::EqualsID>::const_iterator;
293 const_iterator begin()
const {
return dataByID.begin(); }
295 const_iterator end()
const {
return dataByID.end(); }
304 auto value = dataByID.find(&infoKey);
305 if ( value == dataByID.end() )
return nullptr;
306 if ( SUBCOMPONENT_ID_MASK(key) != 0 ) {
308 return (*value)->findSubComponent(key);
313 bool empty() {
return dataByID.empty(); }
317 for (
auto i : dataByID ) {
323 size_t size() {
return dataByID.size(); }
328 #endif // SST_CORE_COMPONENTINFO_H This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:42
Maps port names to the Links that are connected to it.
Definition: linkMap.h:29
Definition: baseComponent.h:1360
std::string getShortName() const
Get the short name for this SubComponent (name not including any parents, so just slot_name[index]) ...
Definition: componentInfo.h:218
A class to convert between a component's view of time and the core's view of time.
Definition: timeConverter.h:27
void serialize_order(SST::Core::Serialization::serializer &ser)
Function used to serialize the class.
Definition: componentInfo.cc:206
Definition: configGraph.h:241
std::vector< ConfigStatistic > statEnableList_t
Definition: componentInfo.h:48
Definition: componentInfo.h:264
Definition: componentInfo.h:284
Definition: componentInfo.h:241
Main control class for a SST Simulation.
Definition: simulation_impl.h:122
Main component object for the simulation.
Definition: baseComponent.h:64
Definition: componentInfo.h:255
Definition: componentInfo.h:250
Parameter store.
Definition: params.h:63
ComponentInfo()
Constructor used only for serialization.
Definition: componentInfo.cc:46
Definition: componentInfo.h:44