48 static const uint64_t SHARE_PORTS = 0x1;
49 static const uint64_t SHARE_STATS = 0x2;
50 static const uint64_t INSERT_STATS = 0x4;
51 static const uint64_t SHARE_NONE = 0x0;
56 static const uint64_t USER_FLAGS = 0x7;
59 friend class Simulation_impl;
60 friend class BaseComponent;
61 friend class ComponentInfoMap;
71 const ComponentId_t id_;
73 ComponentInfo* parent_info;
77 const std::string name;
82 const std::string type;
96 BaseComponent* component;
101 std::map<ComponentId_t, ComponentInfo> subComponents;
115 std::map<std::string, std::vector<ConfigPortModule>>* portModules =
nullptr;
116 std::map<StatisticId_t, ConfigStatistic>* stat_configs_ =
nullptr;
117 std::map<std::string, StatisticId_t>* enabled_stat_names_ =
nullptr;
118 bool enabled_all_stats_ =
false;
121 uint8_t statLoadLevel;
123 std::vector<double> coordinates;
133 const std::string slot_name;
146 uint64_t share_flags;
148 bool sharesPorts() {
return (share_flags & SHARE_PORTS) != 0; }
150 bool sharesStatistics() {
return (share_flags & SHARE_STATS) != 0; }
152 bool canInsertStatistics() {
return (share_flags & INSERT_STATS) != 0; }
154 inline void setComponent(BaseComponent* comp) { component = comp; }
159 void finalizeLinkConfiguration()
const;
160 void prepareForComplete()
const;
162 ComponentId_t addAnonymousSubComponent(ComponentInfo* parent_info,
const std::string& type,
163 const std::string& slot_name,
int slot_num, uint64_t share_flags);
175 void serialize_comp(SST::Core::Serialization::serializer& ser);
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);
189 bool isAnonymous() {
return COMPDEFINED_SUBCOMPONENT_ID_MASK(id_); }
191 bool isUser() {
return !COMPDEFINED_SUBCOMPONENT_ID_MASK(id_); }
193 inline ComponentId_t getID()
const {
return id_; }
195 inline const std::string& getName()
const
197 if ( name.empty() && parent_info )
return parent_info->getName();
201 inline const std::string& getParentComponentName()
const
205 const ComponentInfo* real_comp =
this;
206 while ( real_comp->parent_info !=
nullptr )
207 real_comp = real_comp->parent_info;
208 return real_comp->getName();
215 inline std::string
getShortName()
const {
return name.substr(name.find_last_of(
':') + 1); }
217 inline const std::string& getSlotName()
const {
return slot_name; }
219 inline int getSlotNum()
const {
return slot_num; }
221 inline const std::string& getType()
const {
return type; }
223 inline BaseComponent* getComponent()
const {
return component; }
225 LinkMap* getLinkMap();
227 inline const Params* getParams()
const {
return params; }
230 inline std::map<ComponentId_t, ComponentInfo>& getSubComponents() {
return subComponents; }
232 ComponentInfo* findSubComponent(
const std::string& slot,
int slot_num);
233 ComponentInfo* findSubComponent(ComponentId_t
id);
234 bool hasLinks()
const;
236 uint8_t getStatisticLoadLevel() {
return statLoadLevel; }
240 size_t operator()(
const ComponentInfo* info)
const
242 std::hash<std::string> hash;
243 return hash(info->name);
249 bool operator()(
const ComponentInfo* lhs,
const ComponentInfo* rhs)
const {
return lhs->name == rhs->name; }
254 size_t operator()(
const ComponentInfo* info)
const
256 std::hash<ComponentId_t> hash;
257 return hash(info->id_);
263 bool operator()(
const ComponentInfo* lhs,
const ComponentInfo* rhs)
const {
return lhs->id_ == rhs->id_; }
275 ComponentInfo* test_addSubComponentInfo(
278 void test_printComponentInfoHierarchy(
int index = 0);
281class ComponentInfoMap
284 std::unordered_set<ComponentInfo*, ComponentInfo::HashID, ComponentInfo::EqualsID> dataByID;
287 using const_iterator =
288 std::unordered_set<ComponentInfo*, ComponentInfo::HashID, ComponentInfo::EqualsID>::const_iterator;
290 const_iterator begin()
const {
return dataByID.begin(); }
292 const_iterator end()
const {
return dataByID.end(); }
294 ComponentInfoMap() {}
301 auto value = dataByID.find(&infoKey);
302 if ( value == dataByID.end() )
return nullptr;
303 if ( SUBCOMPONENT_ID_MASK(key) != 0 ) {
305 return (*value)->findSubComponent(key);
310 bool empty() {
return dataByID.empty(); }
314 for (
auto i : dataByID ) {
320 size_t size() {
return dataByID.size(); }