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;
29 class ComponentInfoMap;
32 namespace Statistics {
43 static const uint64_t SHARE_PORTS = 0x1;
44 static const uint64_t SHARE_STATS = 0x2;
45 static const uint64_t INSERT_STATS = 0x4;
48 static const uint64_t IS_LEGACY_SUBCOMPONENT = 0x32;
50 static const uint64_t SHARE_NONE = 0x0;
56 static const uint64_t USER_FLAGS = 0x7;
71 const ComponentId_t id;
78 const std::string name;
83 const std::string type;
102 std::map<ComponentId_t,ComponentInfo> subComponents;
117 std::vector<double> coordinates;
128 const std::string slot_name;
141 uint64_t share_flags;
145 return (share_flags & SHARE_PORTS) != 0;
148 bool sharesStatistics() {
149 return (share_flags & SHARE_STATS) != 0;
152 bool canInsertStatistics() {
153 return (share_flags & INSERT_STATS) != 0;
156 bool isLegacySubComponent() {
157 return (share_flags & IS_LEGACY_SUBCOMPONENT) != 0;
161 inline void setComponent(BaseComponent* comp) { component = comp; }
165 ComponentInfo(ComponentId_t
id,
const std::string &name);
166 void finalizeLinkConfiguration()
const;
167 void prepareForComplete()
const;
169 ComponentId_t addAnonymousSubComponent(ComponentInfo* parent_info,
const std::string& type,
170 const std::string& slot_name,
int slot_num,
171 uint64_t share_flags);
176 ComponentInfo(
const std::string &type,
const Params *params,
const ComponentInfo *parent_info);
179 ComponentInfo(ComponentId_t
id, ComponentInfo* parent_info,
const std::string& type,
const std::string& slot_name,
180 int slot_num, uint64_t share_flags);
183 ComponentInfo(ConfigComponent *ccomp,
const std::string& name, ComponentInfo* parent_info, LinkMap* link_map);
184 ComponentInfo(ComponentInfo &&o);
188 return COMPDEFINED_SUBCOMPONENT_ID_MASK(
id);
192 return !COMPDEFINED_SUBCOMPONENT_ID_MASK(
id);
195 inline ComponentId_t getID()
const {
return id; }
197 inline const std::string& getName()
const {
198 if ( name.empty() )
return parent_info->getName();
202 inline const std::string& getSlotName()
const {
return slot_name; }
204 inline int getSlotNum()
const {
return slot_num; }
206 inline const std::string& getType()
const {
return type; }
208 inline BaseComponent* getComponent()
const {
return component; }
210 LinkMap* getLinkMap();
212 inline const Params* getParams()
const {
return params; }
215 inline std::map<ComponentId_t,ComponentInfo>& getSubComponents() {
return subComponents; }
217 ComponentInfo* findSubComponent(std::string slot,
int slot_num);
218 ComponentInfo* findSubComponent(ComponentId_t
id);
219 std::vector<LinkId_t> getAllLinkIds()
const;
225 std::hash<std::string> hash;
226 return hash(info->name);
232 return lhs->name == rhs->name;
238 std::hash<ComponentId_t> hash;
239 return hash(info->id);
245 return lhs->id == rhs->id;
254 std::unordered_set<ComponentInfo*, ComponentInfo::HashID, ComponentInfo::EqualsID> dataByID;
257 typedef std::unordered_set<ComponentInfo*, ComponentInfo::HashID, ComponentInfo::EqualsID>::const_iterator const_iterator;
259 const_iterator begin()
const {
260 return dataByID.begin();
263 const_iterator end()
const {
264 return dataByID.end();
270 dataByID.insert(info);
275 auto value = dataByID.find(&infoKey);
276 if ( value == dataByID.end() )
return NULL;
277 if ( SUBCOMPONENT_ID_MASK(key) != 0 ) {
279 return (*value)->findSubComponent(key);
285 return dataByID.empty();
289 for (
auto i : dataByID ) {
298 #endif // SST_CORE_COMPONENTINFO_H
Main control class for a SST Simulation.
Definition: simulation.h:72
std::vector< Statistics::StatisticInfo > statEnableList_t
Definition: componentInfo.h:39
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: componentInfo.h:243
Definition: componentInfo.h:252
Definition: componentInfo.h:223
Main component object for the simulation.
Definition: baseComponent.h:52
Definition: componentInfo.h:236
Definition: componentInfo.h:230
Parameter store.
Definition: params.h:45
Definition: componentInfo.h:36