12 #ifndef SST_CORE_STATAPI_STATFIELDINFO_H
13 #define SST_CORE_STATAPI_STATFIELDINFO_H
15 #include "sst/core/sst_types.h"
21 namespace Statistics {
23 using fieldType_t = uint32_t;
34 virtual const char* fieldName()
const = 0;
35 virtual const char* shortName()
const = 0;
41 static void checkRegisterConflict(
const char* oldName,
const char* newName);
43 static fieldType_t allocateFieldEnum();
49 static std::map<fieldType_t, StatisticFieldTypeBase*>* fields_;
50 static fieldType_t enumCounter_;
60 checkRegisterConflict(fieldName_, name);
61 checkRegisterConflict(shortName_, shortName);
63 shortName_ = shortName;
64 if ( fieldEnum_ == 0 ) { fieldEnum_ = allocateFieldEnum(); }
67 shortName_ = shortName;
68 addField(fieldEnum_,
this);
71 static const char* getFieldName() {
return fieldName_; }
73 static const char* getShortName() {
return shortName_; }
75 static fieldType_t id() {
return fieldEnum_; }
77 const char* fieldName()
const override {
return getFieldName(); }
79 const char* shortName()
const override {
return getShortName(); }
82 static Statistics::fieldType_t fieldEnum_;
83 static const char* fieldName_;
84 static const char* shortName_;
96 using fieldType_t = ::SST::Statistics::fieldType_t;
97 using fieldHandle_t = int32_t;
105 StatisticFieldInfo(
const char* statName,
const char* fieldName, fieldType_t fieldType);
109 inline const std::string&
getStatName()
const {
return m_statName; }
133 static const char* getFieldTypeShortName(fieldType_t type)
135 return StatisticFieldTypeBase::getField(type)->shortName();
138 static const char* getFieldTypeFullName(fieldType_t type)
140 return StatisticFieldTypeBase::getField(type)->fieldName();
143 template <
typename T>
144 static fieldType_t getFieldTypeFromTemplate()
146 return StatisticFieldType<T>::id();
153 std::string m_statName;
154 std::string m_fieldName;
155 fieldType_t m_fieldType;
156 fieldHandle_t m_fieldHandle;
The class for representing Statistic Output Fields.
Definition: statfieldinfo.h:94
fieldHandle_t getFieldHandle()
Get the field handle.
Definition: statfieldinfo.h:131
bool operator==(StatisticFieldInfo &FieldInfo1)
Compare two field info structures.
Definition: statfieldinfo.cc:35
const std::string & getFieldName() const
Return the field name related to this field info.
Definition: statfieldinfo.h:111
fieldType_t getFieldType() const
Return the field type related to this field info.
Definition: statfieldinfo.h:113
StatisticFieldInfo(const char *statName, const char *fieldName, fieldType_t fieldType)
Construct a StatisticFieldInfo.
Definition: statfieldinfo.cc:26
std::string getFieldUniqueName() const
Return the field type related to this field info.
Definition: statfieldinfo.cc:41
const std::string & getStatName() const
Return the statistic name related to this field info.
Definition: statfieldinfo.h:109
void setFieldHandle(fieldHandle_t handle)
Set the field handle.
Definition: statfieldinfo.h:126
Definition: statfieldinfo.h:32
Definition: statfieldinfo.h:55