From ad05eb23af5909f0e7ece3ec99290bb3f2a90931 Mon Sep 17 00:00:00 2001 From: Scott Hemmert Date: Tue, 29 Oct 2024 09:28:49 -0600 Subject: [PATCH] Header file cleanup for ELI and serialization headers. (#1168) * Header file cleanup for ELI and serialization headers. --- src/sst/core/baseComponent.cc | 15 +- src/sst/core/eli/defaultInfo.h | 2 + src/sst/core/eli/elementinfo.cc | 6 +- src/sst/core/eli/elementinfo.h | 1 - src/sst/core/eli/interfaceInfo.h | 3 + src/sst/core/eli/paramsInfo.h | 5 +- src/sst/core/factory.cc | 4 +- src/sst/core/factory.h | 5 +- .../impl/timevortex/timeVortexBinnedMap.h | 2 + src/sst/core/impl/timevortex/timeVortexPQ.h | 1 + src/sst/core/interactiveConsole.h | 1 + src/sst/core/model/sstmodel.h | 1 + src/sst/core/module.h | 3 + src/sst/core/params.cc | 9 +- src/sst/core/params.h | 4 +- .../core/profile/clockHandlerProfileTool.cc | 1 + src/sst/core/profile/componentProfileTool.cc | 1 + .../core/profile/eventHandlerProfileTool.cc | 1 + src/sst/core/serialization/objectMap.h | 245 ++++++++++++++---- src/sst/core/sstinfo.cc | 5 +- src/sst/core/sstpart.cc | 2 + src/sst/core/statapi/stathistogram.h | 12 +- 22 files changed, 251 insertions(+), 78 deletions(-) diff --git a/src/sst/core/baseComponent.cc b/src/sst/core/baseComponent.cc index acbec8196..9461128cc 100644 --- a/src/sst/core/baseComponent.cc +++ b/src/sst/core/baseComponent.cc @@ -106,8 +106,7 @@ BaseComponent::setDefaultTimeBaseForLinks(TimeConverter* tc) void BaseComponent::pushValidParams(Params& params, const std::string& type) { - const Params::KeySet_t& keyset = Factory::getFactory()->getParamNames(type); - params.pushAllowedKeys(keyset); + params.pushAllowedKeys(Factory::getFactory()->getParamNames(type)); } void @@ -790,12 +789,12 @@ void BaseComponent::configureAllowedStatParams(SST::Params& params) { // Identify what keys are Allowed in the parameters - Params::KeySet_t allowedKeySet; - allowedKeySet.insert("type"); - allowedKeySet.insert("rate"); - allowedKeySet.insert("startat"); - allowedKeySet.insert("stopat"); - allowedKeySet.insert("resetOnRead"); + std::vector allowedKeySet; + allowedKeySet.push_back("type"); + allowedKeySet.push_back("rate"); + allowedKeySet.push_back("startat"); + allowedKeySet.push_back("stopat"); + allowedKeySet.push_back("resetOnRead"); params.pushAllowedKeys(allowedKeySet); } diff --git a/src/sst/core/eli/defaultInfo.h b/src/sst/core/eli/defaultInfo.h index 969d40390..c666f793a 100644 --- a/src/sst/core/eli/defaultInfo.h +++ b/src/sst/core/eli/defaultInfo.h @@ -12,6 +12,8 @@ #ifndef SST_CORE_ELI_DEFAULTINFO_H #define SST_CORE_ELI_DEFAULTINFO_H +#include "sst/core/eli/elibase.h" + #include #include diff --git a/src/sst/core/eli/elementinfo.cc b/src/sst/core/eli/elementinfo.cc index 66ddcf906..adfc4fea9 100644 --- a/src/sst/core/eli/elementinfo.cc +++ b/src/sst/core/eli/elementinfo.cc @@ -15,6 +15,10 @@ #include "sst/core/eli/elibase.h" +#include +#include +#include + namespace SST { /************************************************************************** @@ -128,7 +132,7 @@ void ProvidesParams::init() { for ( auto& item : params_ ) { - allowedKeys.insert(item.name); + allowedKeys.push_back(item.name); } } diff --git a/src/sst/core/eli/elementinfo.h b/src/sst/core/eli/elementinfo.h index 8c9449adb..def259f67 100644 --- a/src/sst/core/eli/elementinfo.h +++ b/src/sst/core/eli/elementinfo.h @@ -24,7 +24,6 @@ #include "sst/core/eli/simpleInfo.h" #include "sst/core/eli/statsInfo.h" #include "sst/core/eli/subcompSlotInfo.h" -#include "sst/core/params.h" #include "sst/core/sst_types.h" #include "sst/core/warnmacros.h" diff --git a/src/sst/core/eli/interfaceInfo.h b/src/sst/core/eli/interfaceInfo.h index 69a34dd73..75d80ceaa 100644 --- a/src/sst/core/eli/interfaceInfo.h +++ b/src/sst/core/eli/interfaceInfo.h @@ -12,6 +12,9 @@ #ifndef SST_CORE_ELI_INTERFACE_INFO_H #define SST_CORE_ELI_INTERFACE_INFO_H +#include +#include + namespace SST { namespace ELI { diff --git a/src/sst/core/eli/paramsInfo.h b/src/sst/core/eli/paramsInfo.h index 2293b86dd..b77e2eb2d 100644 --- a/src/sst/core/eli/paramsInfo.h +++ b/src/sst/core/eli/paramsInfo.h @@ -13,7 +13,6 @@ #define SST_CORE_ELI_PARAMS_INFO_H #include "sst/core/eli/elibase.h" -#include "sst/core/params.h" #include #include @@ -62,7 +61,7 @@ class ProvidesParams } } - const Params::KeySet_t& getParamNames() const { return allowedKeys; } + const std::vector& getParamNames() const { return allowedKeys; } protected: template @@ -74,7 +73,7 @@ class ProvidesParams private: void init(); - Params::KeySet_t allowedKeys; + std::vector allowedKeys; std::vector params_; }; diff --git a/src/sst/core/factory.cc b/src/sst/core/factory.cc index 9591671ce..a3473a7c2 100644 --- a/src/sst/core/factory.cc +++ b/src/sst/core/factory.cc @@ -145,12 +145,12 @@ Factory::isPortNameValid(const std::string& type, const std::string& port_name) return false; } -const Params::KeySet_t& +const std::vector& Factory::getParamNames(const std::string& type) { // This is only needed so we can return something in the error // case. It is never used. - static Params::KeySet_t empty_keyset; + static std::vector empty_keyset; std::string elemlib, elem; std::tie(elemlib, elem) = parseLoadName(type); diff --git a/src/sst/core/factory.h b/src/sst/core/factory.h index 2eec769e4..d617cb409 100644 --- a/src/sst/core/factory.h +++ b/src/sst/core/factory.h @@ -13,6 +13,7 @@ #define SST_CORE_FACTORY_H #include "sst/core/eli/elementinfo.h" +#include "sst/core/output.h" #include "sst/core/params.h" #include "sst/core/sst_types.h" #include "sst/core/sstpart.h" @@ -53,9 +54,9 @@ class Factory /** Get a list of allowed param keys for a given component type. * @param type - Name of component in lib.name format - * @return True if this is a valid portname + * @return Allowed parameter names */ - const Params::KeySet_t& getParamNames(const std::string& type); + const std::vector& getParamNames(const std::string& type); /** Attempt to create a new Component instantiation * @param id - The unique ID of the component instantiation diff --git a/src/sst/core/impl/timevortex/timeVortexBinnedMap.h b/src/sst/core/impl/timevortex/timeVortexBinnedMap.h index e2d134fed..9edf71f3e 100644 --- a/src/sst/core/impl/timevortex/timeVortexBinnedMap.h +++ b/src/sst/core/impl/timevortex/timeVortexBinnedMap.h @@ -12,6 +12,8 @@ #ifndef SST_CORE_IMPL_TIMEVORTEX_TIMEVORTEXBINNEDMAP_H #define SST_CORE_IMPL_TIMEVORTEX_TIMEVORTEXBINNEDMAP_H +#include "sst/core/threadsafe.h" + #include #include #include diff --git a/src/sst/core/impl/timevortex/timeVortexPQ.h b/src/sst/core/impl/timevortex/timeVortexPQ.h index 3518875b3..5f9c30091 100644 --- a/src/sst/core/impl/timevortex/timeVortexPQ.h +++ b/src/sst/core/impl/timevortex/timeVortexPQ.h @@ -13,6 +13,7 @@ #define SST_CORE_IMPL_TIMEVORTEX_TIMEVORTEXPQ_H #include "sst/core/eli/elementinfo.h" +#include "sst/core/threadsafe.h" #include "sst/core/timeVortex.h" #include diff --git a/src/sst/core/interactiveConsole.h b/src/sst/core/interactiveConsole.h index b2b7f9748..1dfee285c 100644 --- a/src/sst/core/interactiveConsole.h +++ b/src/sst/core/interactiveConsole.h @@ -26,6 +26,7 @@ namespace SST { +class Params; class Simulation_impl; class TimeConverter; diff --git a/src/sst/core/model/sstmodel.h b/src/sst/core/model/sstmodel.h index c4175897f..6437e051b 100644 --- a/src/sst/core/model/sstmodel.h +++ b/src/sst/core/model/sstmodel.h @@ -13,6 +13,7 @@ #define SST_CORE_MODEL_SSTMODEL_H #include "sst/core/eli/elementinfo.h" +#include "sst/core/params.h" #include "sst/core/warnmacros.h" namespace SST { diff --git a/src/sst/core/module.h b/src/sst/core/module.h index e4fc439c5..c2ee43c0f 100644 --- a/src/sst/core/module.h +++ b/src/sst/core/module.h @@ -16,6 +16,9 @@ #include "sst/core/serialization/serializable.h" namespace SST { + +class Params; + /** Module is a tag class used with the loadModule function. */ diff --git a/src/sst/core/params.cc b/src/sst/core/params.cc index 7d3cd1671..539ffe022 100644 --- a/src/sst/core/params.cc +++ b/src/sst/core/params.cc @@ -14,6 +14,7 @@ #include "sst/core/params.h" +#include "sst/core/output.h" #include "sst/core/unitAlgebra.h" #include @@ -223,9 +224,13 @@ Params::contains(const key_type& k) const } void -Params::pushAllowedKeys(const KeySet_t& keys) +Params::pushAllowedKeys(const std::vector& keys) { - allowedKeys.push_back(keys); + KeySet_t key_set; + for ( auto x : keys ) { + key_set.insert(x); + } + allowedKeys.push_back(key_set); } void diff --git a/src/sst/core/params.h b/src/sst/core/params.h index 11f46e40b..2073e399f 100644 --- a/src/sst/core/params.h +++ b/src/sst/core/params.h @@ -13,7 +13,6 @@ #define SST_CORE_PARAM_H #include "sst/core/from_string.h" -#include "sst/core/output.h" #include "sst/core/serialization/serializable.h" #include "sst/core/serialization/serializer.h" #include "sst/core/threadsafe.h" @@ -34,6 +33,7 @@ namespace SST { class ConfigGraph; class ConfigComponent; +class Output; class SSTModelDescription; namespace Core { @@ -834,7 +834,7 @@ class Params : public SST::Core::Serialization::serializable * @param keys Set of keys to consider valid to add to the stack * of legal keys */ - void pushAllowedKeys(const KeySet_t& keys); + void pushAllowedKeys(const std::vector& keys); /** * Removes the most recent set of keys considered allowed diff --git a/src/sst/core/profile/clockHandlerProfileTool.cc b/src/sst/core/profile/clockHandlerProfileTool.cc index 8de0547c9..a760478c5 100644 --- a/src/sst/core/profile/clockHandlerProfileTool.cc +++ b/src/sst/core/profile/clockHandlerProfileTool.cc @@ -14,6 +14,7 @@ #include "sst/core/profile/clockHandlerProfileTool.h" #include "sst/core/output.h" +#include "sst/core/params.h" #include "sst/core/sst_types.h" #include diff --git a/src/sst/core/profile/componentProfileTool.cc b/src/sst/core/profile/componentProfileTool.cc index be1c75f9d..755f5e3da 100644 --- a/src/sst/core/profile/componentProfileTool.cc +++ b/src/sst/core/profile/componentProfileTool.cc @@ -14,6 +14,7 @@ #include "sst/core/profile/componentProfileTool.h" #include "sst/core/output.h" +#include "sst/core/params.h" #include "sst/core/sst_types.h" #include diff --git a/src/sst/core/profile/eventHandlerProfileTool.cc b/src/sst/core/profile/eventHandlerProfileTool.cc index 3601585ba..b25a710a3 100644 --- a/src/sst/core/profile/eventHandlerProfileTool.cc +++ b/src/sst/core/profile/eventHandlerProfileTool.cc @@ -14,6 +14,7 @@ #include "sst/core/profile/eventHandlerProfileTool.h" #include "sst/core/output.h" +#include "sst/core/params.h" #include "sst/core/sst_types.h" #include diff --git a/src/sst/core/serialization/objectMap.h b/src/sst/core/serialization/objectMap.h index a5c1ff51a..ba4123da1 100644 --- a/src/sst/core/serialization/objectMap.h +++ b/src/sst/core/serialization/objectMap.h @@ -24,12 +24,14 @@ namespace Serialization { class ObjectMap; -// Metadata object that each ObjectMap has a pointer to in order to -// track the hierarchy information while traversing the data -// structures. This is used because a given object can be pointed to -// by multiple other objects, so we need to track the "path" through -// which we got to the object so we can traverse back up the object -// hierarchy. +/** + Metadata object that each ObjectMap has a pointer to in order to + track the hierarchy information while traversing the data + structures. This is used because a given object can be pointed to + by multiple other objects, so we need to track the "path" through + which we got to the object so we can traverse back up the object + hierarchy. +*/ struct ObjectMapMetaData { /** @@ -50,13 +52,11 @@ struct ObjectMapMetaData }; /** - Class created by the serializer mapping mode used to map the - variables for objects. This allows access to read and write the - mapped variables. The base class is used for non-fundamental and - non-container types, but there is a templated child class used for - fundameentals and containers. The templating is needed so that the - type information can be embedded in the code for reading and - writing. + Base class for objects created by the serializer mapping mode used + to map the variables for objects. This allows access to read and + write the mapped variables. ObjectMaps for fundamental types are + templated because they need the type information embedded in the + code so they can read and print the values. */ class ObjectMap { @@ -70,12 +70,13 @@ class ObjectMap static std::vector> emptyVars; /** - Metedata object for walking the object hierarchy. When this + Metadata object for walking the object hierarchy. When this object is selected by a parent object, a metadata object will be added. The metadata contains a pointer to the parent and - the name of this object in the context of the parent. If this - object is selected and the metadata is non a nullptr, then we - have hit a loop in the data structure. + the name of this object in the context of the parent. When the + object selects its parent, then this field is set to nullptr. + If this object is selected and the metadata is not a nullptr, + then we have hit a loop in the data structure. Under normal circumstances, the metadata allows you to get the full path of the object according to how you walked the @@ -88,14 +89,16 @@ class ObjectMap /** - Indicates wheter or not the variable is read-only + Indicates whether or not the variable is read-only */ bool read_only_ = false; /** Function implemented by derived classes to implement set(). No - need to check for read_only, that is done in set(). + need to check for read-only, that is done in set(). + + @param value Value to set the object to expressed as a string */ virtual void set_impl(const std::string& UNUSED(value)) {} @@ -103,9 +106,21 @@ class ObjectMap Function that will get called when this object is selected */ virtual void activate_callback() {} + + /** + Function that will get called when this object is deactivated + (i.e selectParent() is called) + */ virtual void deactivate_callback() {} private: + /** + Reference counter so the object knows when to delete itself. + ObjectMaps should not be deleted directly, rather the + decRefCount() function should be called when the object is no + longer needed and the object will delete itself if refCount_ + reaches 0. + */ int32_t refCount_ = 1; public: @@ -115,12 +130,29 @@ class ObjectMap ObjectMap() {} + /** + Check to see if this object is read-only + + @return true if ObjectMap is read-only, false otherwise + */ inline bool isReadOnly() { return read_only_; } - inline void setReadOnly() { read_only_ = true; } + + /** + Set the read-only state of the object. NOTE: If the ObjectMap + is created as read-only, setting the state back to false could + lead to unexpected results. Setting the state to false should + only be done by the same object that set it to true. + + @param state Read-only state to set this ObjectMap to. Defaults to true. + */ + inline void setReadOnly(bool state = true) { read_only_ = state; } /** - Get the name of the variable represented by this ObjectMap + Get the name of the variable represented by this ObjectMap. If + this ObjectMap has no metadata registered (i.e. it was not + selected by another ObjectMap), then an empty string will be + returned, since it has no name. @return Name of variable */ @@ -129,7 +161,10 @@ class ObjectMap /** Get the full hierarchical name of the variable represented by - this ObjectMap, based on the path taken to get to this object. + this ObjectMap, based on the path taken to get to this + object. If this ObjectMap has no metadata registered (i.e. it + was not selected by another ObjectMap), then an empty string + will be returned, since it has no name. @return Full hierarchical name of variable */ @@ -146,7 +181,7 @@ class ObjectMap /** Get the address of the variable represented by the ObjectMap - @return Address of varaible + @return Address of variable */ virtual void* getAddr() = 0; @@ -162,12 +197,15 @@ class ObjectMap /** - Increament the reference counter for this object map + Increment the reference counter for this ObjectMap. When + keeping a pointer to the ObjectMap, incRefCount() should be + called to indicate usage. When done, call decRefCount() to + indicate it is no longer needed. */ void incRefCount() { refCount_++; } /** - Decreament the reference counter for this object map. If this + Decrement the reference counter for this ObjectMap. If this reference count reaches zero, the object will delete itself. NOTE: delete should not be called directly on this object and should only be done automatically using decRefCount(). @@ -209,7 +247,7 @@ class ObjectMap /** - Adds a varaible to this ObjectMap. NOTE: calls to this + Adds a variable to this ObjectMap. NOTE: calls to this function will be ignore if isFundamental() returns true. @param name Name of the object in the context of the parent class @@ -225,7 +263,8 @@ class ObjectMap /** Get the value of the variable as a string. NOTE: this function is only valid for ObjectMaps that represent fundamental types - or classes treated as fundamental types. + or classes treated as fundamental types (i.e. isFundamental() + returns true). @return Value of the represented variable as a string */ @@ -236,10 +275,11 @@ class ObjectMap the specified value, which is represented as a string. The templated child classes for fundamentals will know how to convert the string to a value of the approproprite type. NOTE: - this fucntion is only value for ObjectMaps that represent - fundamental types or classes treated as fundamentatl types. + this function is only valid for ObjectMaps that represent + fundamental types or classes treated as fundamentatl types + (i.e. isFundamental() returns true). - @param value Value to set the object to represented as a string + @param value Value to set the object to, represented as a string */ void set(const std::string& value) @@ -258,7 +298,8 @@ class ObjectMap @param var Name of variable - @return Value of the specified variable as a string + @return Value of the specified variable, represented as a + string */ virtual std::string get(const std::string& var); @@ -266,16 +307,16 @@ class ObjectMap Sets the value of the specified variable to the specified value, which is represented as a string. The templated child classes for fundamentals will know how to convert the string to - a value of the approproprite type. NOTE: this fucntion is only - valuid for ObjectMaps that represent non-fundamental types or + a value of the approproprite type. NOTE: this function is only + valid for ObjectMaps that represent non-fundamental types or classes not treated as fundamentatl types (i.e. they must have - childrent). + children). @param var Name of variable @param value Value to set var to represented as a string - @param[out] found Set to true if var is found, set to false otherwise + @param[out] found Set to true if var is found, set to false otherwise @param[out] read_only Set to true if var is read-only, set to false otherwise @@ -301,14 +342,16 @@ class ObjectMap /** - Destructor + Destructor. NOTE: delete should not be called directly on + ObjectMaps, rather decRefCount() should be called when the + object is no longer needed. */ virtual ~ObjectMap() {} /** - Static function to demangle type names returned from typeid.name() + Static function to demangle type names returned from typeid(T).name() - @param name typename returned from typid.name() + @param name typename returned from typeid(T).name() @return demangled name */ @@ -317,13 +360,14 @@ class ObjectMap /** Create a string that lists information for the specified variable. This will list all child variables, including the - values for any children that are fundamentals. + values for any children that are fundamentals, up to the + specified recursion depth. - @param name name of variable to list + @param name Name of variable to list @param[out] found Set to true if variable is found, set to false otherwise - @param recurse number of levels to recurse (default is 0) + @param recurse Number of levels to recurse (default is 0) @return String representing this object and any children included based on the value of recurse @@ -333,9 +377,10 @@ class ObjectMap /** Create a string that lists information for the current object. This will list all child variables, including the values for - any children that are fundamentals. + any children that are fundamentals, up to the specified + recursion depth. - @param recurse number of levels to recurse (default is 0) + @param recurse Number of levels to recurse (default is 0) @return String representing this object and any children included based on the value of recurse @@ -344,12 +389,24 @@ class ObjectMap private: + /** + Called to activate this ObjectMap. This will create the + metadata object and call activate_callback(). + + @param parent ObjectMap parent of this ObjectMap + + @param name Name of this ObjectMap in the context of the parent + */ inline void activate(ObjectMap* parent, const std::string& name) { mdata_ = new ObjectMapMetaData(parent, name); activate_callback(); } + /** + Deactivate this object. This will remove and delete the + metadata and call deactivate_callback(). + */ inline void deactivate() { delete mdata_; @@ -357,6 +414,15 @@ class ObjectMap deactivate_callback(); } + + /** + Find a variable in this object map + + @param name Name of variable to find + + @return ObjectMap representing the requested variable if it is + found, nullptr otherwise + */ inline ObjectMap* findVariable(const std::string& name) { const std::vector>& variables = getVariables(); @@ -366,6 +432,15 @@ class ObjectMap return nullptr; } + /** + Function called by list to recurse the object hierarchy + + @param name Name of current ObjectMap + + @param level Current level of recursion + + @param recurse Number of levels deep to recurse + */ std::string listRecursive(const std::string& name, int level, int recurse); }; @@ -382,9 +457,18 @@ class ObjectMapWithChildren : public ObjectMap */ std::vector> variables_; + /** + Default constructor + */ ObjectMapWithChildren() : ObjectMap() {} public: + /** + Destructor. Should not be called directly (i.e. do not call + delete on the object). Call decRefCount() when object is no + longer needed. This will also call decRefCount() on all its + children. + */ ~ObjectMapWithChildren() { for ( auto obj : variables_ ) { @@ -396,6 +480,8 @@ class ObjectMapWithChildren : public ObjectMap /** Adds a variable to this ObjectMap + @param name Name of the object in the context of this ObjectMap + @param obj ObjectMap to add as a variable */ void addVariable(const std::string& name, ObjectMap* obj) override @@ -407,9 +493,10 @@ class ObjectMapWithChildren : public ObjectMap /** Get the list of child variables contained in this ObjectMap - @return Refernce to vector containing ObjectMaps for this + @return Reference to vector containing ObjectMaps for this ObjectMap's child variables. pair.first is the name of the - variable in the context of this object. + variable in the context of this object. pair.second is a + pointer to the ObjectMap. */ const std::vector>& getVariables() override { return variables_; } }; @@ -424,8 +511,18 @@ class ObjectMapWithChildren : public ObjectMap class ObjectMapHierarchyOnly : public ObjectMapWithChildren { public: + /** + Default constructor + */ ObjectMapHierarchyOnly() : ObjectMapWithChildren() {} + + /** + Destructor. Should not be called directly (i.e. do not call + delete on the object). Call decRefCount() when object is no + longer needed. This will also call decRefCount() on all its + children. + */ ~ObjectMapHierarchyOnly() {} /** @@ -455,7 +552,7 @@ class ObjectMapClass : public ObjectMapWithChildren protected: /** Type of the variable as given by the demangled version of - typeif.name() for the type. + typeid(T).name() for the type. */ std::string type_; @@ -465,14 +562,30 @@ class ObjectMapClass : public ObjectMapWithChildren void* addr_ = nullptr; public: + /** + Default constructor + */ ObjectMapClass() : ObjectMapWithChildren() {} + /** + Constructor + + @param addr Address of the object represented by this ObjectMap + + @param type Type of this object as return by typeid(T).name() + */ ObjectMapClass(void* addr, const std::string& type) : ObjectMapWithChildren(), type_(demangle_name(type.c_str())), addr_(addr) {} + /** + Destructor. Should not be called directly (i.e. do not call + delete on the object). Call decRefCount() when object is no + longer needed. This will also call decRefCount() on all its + children. + */ ~ObjectMapClass() {} /** @@ -492,10 +605,14 @@ class ObjectMapClass : public ObjectMapWithChildren /** - ObjectMap object fundamental types, and classes treated as + ObjectMap representing fundamental types, and classes treated as fundamental types. In order for an object to be treated as a fundamental, it must be printable using std::to_string() and - assignable using SST::Core::from_string(). + assignable using SST::Core::from_string(). If this is not true, it + is possible to create a template specialization for the type + desired to be treated as a fundamental. The specialization will + need to provide the functions for getting and setting the values as + a string. */ template class ObjectMapFundamental : public ObjectMap @@ -507,15 +624,31 @@ class ObjectMapFundamental : public ObjectMap T* addr_ = nullptr; public: + /** + Get the value of the object as a string + */ virtual std::string get() override { return std::to_string(*addr_); } - virtual void set_impl(const std::string& value) override { *addr_ = SST::Core::from_string(value); } + /** + Set the value of the object represented as a string + + @param value Value to set the underlying object to, represented + as a string + */ + virtual void set_impl(const std::string& value) override { *addr_ = SST::Core::from_string(value); } + + + /** + Returns true as object is a fundamental + + @return true + */ bool isFundamental() override { return true; } /** Get the address of the variable represented by the ObjectMap - @return Address of varaible + @return Address of variable */ void* getAddr() override { return addr_; } @@ -532,8 +665,20 @@ class ObjectMapFundamental : public ObjectMap ObjectMapFundamental(T* addr) : ObjectMap(), addr_(addr) {} + /** + Destructor. Should not be called directly (i.e. do not call + delete on the object). Call decRefCount() when object is no + longer needed. This will also call decRefCount() on all its + children. + */ ~ObjectMapFundamental() {} + /** + Return the type represented by this ObjectMap as given by the + demangled version of typeid(T).name() + + @return type of underlying object + */ std::string getType() override { return demangle_name(typeid(T).name()); } }; diff --git a/src/sst/core/sstinfo.cc b/src/sst/core/sstinfo.cc index 38c27983a..90a8835eb 100644 --- a/src/sst/core/sstinfo.cc +++ b/src/sst/core/sstinfo.cc @@ -32,6 +32,7 @@ #include #include #include +#include #include using namespace std; @@ -88,6 +89,7 @@ xmlComment(TiXmlNode* owner, const char* fmt...) owner->LinkEndChild(comment); } +namespace impl { /** Trim whitespace from strings */ inline std::string trim(std::string s) @@ -96,6 +98,7 @@ trim(std::string s) s.erase(s.find_last_not_of(" \t\n\r\f\v") + 1); return s; } +} // namespace impl class OverallOutputter { @@ -900,7 +903,7 @@ SSTLibraryInfo::filterSearch(std::stringstream& outputStream, std::string tag, s std::string temp; std::istringstream stream(mapTag); std::getline(stream, temp, '('); - std::string infoTag = trim(temp); + std::string infoTag = impl::trim(temp); // Search for correct tag if ( infoTag == tag ) { diff --git a/src/sst/core/sstpart.cc b/src/sst/core/sstpart.cc index 76ad53c42..2d9a412f8 100644 --- a/src/sst/core/sstpart.cc +++ b/src/sst/core/sstpart.cc @@ -13,6 +13,8 @@ #include "sst/core/sstpart.h" +#include "sst/core/output.h" + namespace SST { namespace Partition { diff --git a/src/sst/core/statapi/stathistogram.h b/src/sst/core/statapi/stathistogram.h index 41bd6fabf..d0d2e2dd9 100644 --- a/src/sst/core/statapi/stathistogram.h +++ b/src/sst/core/statapi/stathistogram.h @@ -54,12 +54,12 @@ class HistogramStatistic : public Statistic Statistic(comp, statName, statSubId, statParams) { // Identify what keys are Allowed in the parameters - Params::KeySet_t allowedKeySet; - allowedKeySet.insert("minvalue"); - allowedKeySet.insert("binwidth"); - allowedKeySet.insert("numbins"); - allowedKeySet.insert("dumpbinsonoutput"); - allowedKeySet.insert("includeoutofbounds"); + std::vector allowedKeySet; + allowedKeySet.push_back("minvalue"); + allowedKeySet.push_back("binwidth"); + allowedKeySet.push_back("numbins"); + allowedKeySet.push_back("dumpbinsonoutput"); + allowedKeySet.push_back("includeoutofbounds"); statParams.pushAllowedKeys(allowedKeySet); // Process the Parameters