The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::CounterBase::CounterBehaviorDetailed Class Reference

Wrapper class to add meta information to a counter definition. More...

#include <CounterBase.hpp>

Public Member Functions

 CounterBehaviorDetailed (CounterBehavior behavior)
 Construct a CounterBehaviorDetailed without meta data.
 
 CounterBehaviorDetailed (CounterBehavior behavior, const InstrumentationNode::MetadataPairs &meta_data)
 Construct a CounterBehaviorDetailed without meta data.
 
 operator CounterBehavior () const
 Casting operator to obtain the original behavior.
 
const InstrumentationNode::MetadataPairs & getMetadata () const
 Get the meta data provided by the user.
 

Detailed Description

Wrapper class to add meta information to a counter definition.

When defining the counter's behavior, this class enables the modeler to extend that behavior with meta information. During report generation to data serialization formats (like json, yaml, or SimDB) this information is included with the counter.

Usage:

new sparta::Counter(getContainer(),
"my_counter_name",
"my_counter_group_name,
0, // group idx
"This is my fancy counter definition", // desc
// CounterBehaviorDetailed
{
sparta::CounterBase::CounterBehavior::COUNT_NORMAL,
{
{"lowest_value" : "0" },
{"highest_value" : "100" },
{"polarity" : "positive" } // Positive polarity, higher is better
}
});
Represents a counter of type counter_type (uint64_t). 2 and greater than 0 with a ceiling specified....
Definition Counter.hpp:27

The modeler is not required to provide any meta data information. As an example, the following works as well:

new sparta::Counter(getContainer(),
"my_counter_name",
"my_counter_group_name,
0, // group idx
"This is my simple counter definition", // desc
sparta::CounterBase::CounterBehavior::COUNT_NORMAL);

Definition at line 145 of file CounterBase.hpp.

Constructor & Destructor Documentation

◆ CounterBehaviorDetailed() [1/2]

sparta::CounterBase::CounterBehaviorDetailed::CounterBehaviorDetailed ( CounterBehavior behavior)
inline

Construct a CounterBehaviorDetailed without meta data.

Parameters
behaviorThe CounterBehavior
Note
Do not make this explicit

Definition at line 153 of file CounterBase.hpp.

◆ CounterBehaviorDetailed() [2/2]

sparta::CounterBase::CounterBehaviorDetailed::CounterBehaviorDetailed ( CounterBehavior behavior,
const InstrumentationNode::MetadataPairs & meta_data )
inline

Construct a CounterBehaviorDetailed without meta data.

Parameters
behaviorThe CounterBehavior
meta_dataMetadataPairs to assign {("name", "value"}}

Definition at line 162 of file CounterBase.hpp.

Member Function Documentation

◆ getMetadata()

const InstrumentationNode::MetadataPairs & sparta::CounterBase::CounterBehaviorDetailed::getMetadata ( ) const
inline

Get the meta data provided by the user.

Definition at line 172 of file CounterBase.hpp.

◆ operator CounterBehavior()

sparta::CounterBase::CounterBehaviorDetailed::operator CounterBehavior ( ) const
inline

Casting operator to obtain the original behavior.

Definition at line 169 of file CounterBase.hpp.


The documentation for this class was generated from the following file: