12 #ifndef SST_CORE_COMPONENTINFO_H
13 #define SST_CORE_COMPONENTINFO_H
15 #include "sst/core/sst_types.h"
16 #include "sst/core/params.h"
18 #include <unordered_set>
28 class ConfigComponent;
30 class ConfigStatistic;
32 class ComponentInfoMap;
33 class Simulation_impl;
36 namespace Statistics {
46 static const uint64_t SHARE_PORTS = 0x1;
47 static const uint64_t SHARE_STATS = 0x2;
48 static const uint64_t INSERT_STATS = 0x4;
51 static const uint64_t SHARE_NONE = 0x0;
57 static const uint64_t USER_FLAGS = 0x7;
72 const ComponentId_t id;
79 const std::string name;
84 const std::string type;
103 std::map<ComponentId_t,ComponentInfo> subComponents;
117 std::map<StatisticId_t, ConfigStatistic>* statConfigs;
118 std::map<std::string, StatisticId_t>* enabledStatNames;
119 bool enabledAllStats;
122 uint8_t statLoadLevel;
124 std::vector<double> coordinates;
135 const std::string slot_name;
148 uint64_t share_flags;
152 return (share_flags & SHARE_PORTS) != 0;
155 bool sharesStatistics() {
156 return (share_flags & SHARE_STATS) != 0;
159 bool canInsertStatistics() {
160 return (share_flags & INSERT_STATS) != 0;
163 inline void setComponent(BaseComponent* comp) { component = comp; }
167 ComponentInfo(ComponentId_t
id,
const std::string& name);
168 void finalizeLinkConfiguration()
const;
169 void prepareForComplete()
const;
171 ComponentId_t addAnonymousSubComponent(ComponentInfo* parent_info,
const std::string& type,
172 const std::string& slot_name,
int slot_num,
173 uint64_t share_flags);
178 ComponentInfo(
const std::string& type,
const Params *params,
const ComponentInfo *parent_info);
181 ComponentInfo(ComponentId_t
id, ComponentInfo* parent_info,
const std::string& type,
const std::string& slot_name,
182 int slot_num, uint64_t share_flags);
185 ComponentInfo(ConfigComponent *ccomp,
const std::string& name, ComponentInfo* parent_info, LinkMap* link_map);
186 ComponentInfo(ComponentInfo &&o);
190 return COMPDEFINED_SUBCOMPONENT_ID_MASK(
id);
194 return !COMPDEFINED_SUBCOMPONENT_ID_MASK(
id);
197 inline ComponentId_t getID()
const {
return id; }
199 inline const std::string& getName()
const {
200 if ( name.empty() && parent_info )
return parent_info->getName();
204 inline const std::string& getParentComponentName()
const {
207 const ComponentInfo* real_comp =
this;
208 while ( real_comp->parent_info !=
nullptr) real_comp = real_comp->parent_info;
209 return real_comp->getName();
212 inline const std::string& getSlotName()
const {
return slot_name; }
214 inline int getSlotNum()
const {
return slot_num; }
216 inline const std::string& getType()
const {
return type; }
218 inline BaseComponent* getComponent()
const {
return component; }
220 LinkMap* getLinkMap();
222 inline const Params* getParams()
const {
return params; }
225 inline std::map<ComponentId_t,ComponentInfo>& getSubComponents() {
return subComponents; }
227 ComponentInfo* findSubComponent(
const std::string& slot,
int slot_num);
228 ComponentInfo* findSubComponent(ComponentId_t
id);
229 std::vector<LinkId_t> getAllLinkIds()
const;
231 uint8_t getStatisticLoadLevel() {
return statLoadLevel; }
235 std::hash<std::string> hash;
236 return hash(info->name);
242 return lhs->name == rhs->name;
248 std::hash<ComponentId_t> hash;
249 return hash(info->id);
255 return lhs->id == rhs->id;
264 std::unordered_set<ComponentInfo*, ComponentInfo::HashID, ComponentInfo::EqualsID> dataByID;
267 typedef std::unordered_set<ComponentInfo*, ComponentInfo::HashID, ComponentInfo::EqualsID>::const_iterator const_iterator;
269 const_iterator begin()
const {
270 return dataByID.begin();
273 const_iterator end()
const {
274 return dataByID.end();
280 dataByID.insert(info);
285 auto value = dataByID.find(&infoKey);
286 if ( value == dataByID.end() )
return nullptr;
287 if ( SUBCOMPONENT_ID_MASK(key) != 0 ) {
289 return (*value)->findSubComponent(key);
295 return dataByID.empty();
299 for (
auto i : dataByID ) {
308 #endif // SST_CORE_COMPONENTINFO_H
Maps port names to the Links that are connected to it.
Definition: linkMap.h:28
A class to convert between a component's view of time and the core's view of time.
Definition: timeConverter.h:25
Definition: configGraph.h:127
Definition: componentInfo.h:253
Definition: componentInfo.h:262
Definition: componentInfo.h:233
Main control class for a SST Simulation.
Definition: simulation_impl.h:72
std::vector< ConfigStatistic > statEnableList_t
Definition: componentInfo.h:43
Main component object for the simulation.
Definition: baseComponent.h:53
Definition: componentInfo.h:246
Definition: componentInfo.h:240
Parameter store.
Definition: params.h:44
Definition: componentInfo.h:40