7#include "sparta/statistics/CounterBase.hpp"
50 const std::string& name,
51 const std::string& group,
53 const std::string& desc,
71 const std::string& name,
72 const std::string& group,
74 const std::string& desc,
91 const std::string& name,
92 const std::string& desc,
109 ReadOnlyCounter(TreeNode* parent,
110 const std::string& name,
111 const std::string& desc,
114 ReadOnlyCounter(parent,
128 const std::string& name,
129 const std::string& group,
131 const std::string& desc,
148 const std::string& name,
149 const std::string& group,
151 const std::string& desc,
167 const std::string& name,
168 const std::string& desc,
184 ReadOnlyCounter(TreeNode* parent,
185 const std::string& name,
186 const std::string& desc,
188 ReadOnlyCounter(parent,
209 if(parent !=
nullptr){
236 "Canot 'get()' on ReadOnlyCounter "
238 "pointer. If constructed without a variale "
239 "reference, the get() method must be overridden.");
254 return get() == rhp.
get();
271 virtual std::string
stringize(
bool pretty=
false)
const override {
273 std::stringstream ss;
Byte order types and byte-swapping routines.
Set of macros for Sparta assertions. Caught by the framework.
#define sparta_assert(...)
Simple variadic assertion that will throw a sparta_exception if the condition fails.
Exception class for all of Sparta.
The base class for all Counters.
virtual counter_type get() const =0
Gets the value of this counter.
static std::string getBehaviorName(CounterBehavior behave)
Returns a string containing the name of the given behavior.
uint64_t counter_type
Counter value type.
CounterBehavior
Behavior of this counter.
CounterBehavior getBehavior() const
Gets the behavior for this counter specified at construction.
uint32_t visibility_t
Continuous visibility level. Several key points along continum are indicated within Visibility.
static constexpr visibility_t DEFAULT_VISIBILITY
Default node visibility.
visibility_t getVisibility() const
Gets the visibility hint of this node. This is invariant after construction.
Represents a non-writable and non-observable counter with a very similar interface to sparta::Counter...
ReadOnlyCounter(TreeNode *parent, const std::string &name, const std::string &group, TreeNode::group_idx_type group_idx, const std::string &desc, CounterBehavior behave)
ReadOnlyCounter(TreeNode *parent, const std::string &name, const std::string &group, TreeNode::group_idx_type group_idx, const std::string &desc, CounterBehavior behave, const counter_type *ref, visibility_t visibility)
ReadOnlyCounter constructor.
virtual void onAddingChild_(TreeNode *child) override
React to child registration.
virtual std::string stringize(bool pretty=false) const override
Create a string representation of this node.
virtual counter_type get() const override
Gets the value of this counter.
~ReadOnlyCounter()
Destructor.
ReadOnlyCounter(ReadOnlyCounter &&rhp)
Move constructor.
ReadOnlyCounter(TreeNode *parent, const std::string &name, const std::string &group, TreeNode::group_idx_type group_idx, const std::string &desc, CounterBehavior behave, visibility_t visibility)
bool operator==(const CounterBase &rhp) const
Comparison against another counter.
virtual bool supportsCompression() const override
Used to construct and throw a standard C++ exception. Inherits from std::exception.
Node in a composite tree representing a sparta Tree item.
static const group_idx_type GROUP_IDX_NONE
GroupIndex indicating that a node has no group index because it belongs to no group.
std::string getLocation() const override final
static constexpr char GROUP_NAME_NONE[]
Group name indicating that a node belongs to no group.
void addChild(TreeNode *child, bool inherit_phase=true)
Adds a TreeNode to this node as a child.
virtual TreeNode * getParent()
Gets immediate parent of this node if one exists.
uint32_t group_idx_type
Index within a group.
Macros for handling exponential backoff.