The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::statistics::expression::ReferenceVariable Struct Reference

Expression node for a reference to a double. Anything that cannot actually vary can be handled as a constant through Expression. If it can vary, however, it should be handled through this or SimVariable (for functions) More...

#include <ExpressionNodeVariables.hpp>

Inheritance diagram for sparta::statistics::expression::ReferenceVariable:
Collaboration diagram for sparta::statistics::expression::ReferenceVariable:

Public Member Functions

 ReferenceVariable (const ReferenceVariable &rhp)
 
template<typename T >
 ReferenceVariable (const std::string &which, const T &ref)
 Construct with a value reference.
 
ReferenceVariable operator= (const ReferenceVariable &)=delete
 Copy-assignment Disallowed.
 
virtual ReferenceVariableclone_ () const override
 Deep copy of the content of this item.
 
virtual double evaluate_ () const override
 Compute value of this item in simulation.
 
virtual bool supportsCompression () const override
 
virtual void start () override
 
virtual void end () override
 
virtual void dump (std::ostream &o, bool show_range=true, bool resolve_subexprs=true) const override
 Dump the content of this expression item.
 
virtual void getClocks (std::vector< const Clock * > &clocks) const override
 Populates a vector with the clocks found in this subexpression node.
 
- Public Member Functions inherited from sparta::statistics::expression::ExpressionNode
 ExpressionNode (const ExpressionNode &)=delete
 No copy-constructable.
 
ExpressionNodeclone () const
 
uint32_t getStats (std::vector< const StatisticInstance * > &results) const
 Gets the statistics present in this expression.
 
double evaluate ()
 Compute value of this item in simulation. Must be implemented by subclass.
 

Public Attributes

std::string which_
 Name of this variable.
 
const double & ref_
 Reference to actual variable.
 

Detailed Description

Expression node for a reference to a double. Anything that cannot actually vary can be handled as a constant through Expression. If it can vary, however, it should be handled through this or SimVariable (for functions)

Note
ReferenceVariables are treated as invariant for the lifetime of an expression

Definition at line 215 of file ExpressionNodeVariables.hpp.

Constructor & Destructor Documentation

◆ ReferenceVariable() [1/2]

sparta::statistics::expression::ReferenceVariable::ReferenceVariable ( const ReferenceVariable rhp)
inline

Definition at line 229 of file ExpressionNodeVariables.hpp.

◆ ReferenceVariable() [2/2]

template<typename T >
sparta::statistics::expression::ReferenceVariable::ReferenceVariable ( const std::string &  which,
const T &  ref 
)
inline

Construct with a value reference.

Parameters
whichName of the variable
refReference to value

Definition at line 241 of file ExpressionNodeVariables.hpp.

Member Function Documentation

◆ clone_()

virtual ReferenceVariable * sparta::statistics::expression::ReferenceVariable::clone_ ( ) const
inlineoverridevirtual

Deep copy of the content of this item.

To be overridden by subclasses

Implements sparta::statistics::expression::ExpressionNode.

Definition at line 259 of file ExpressionNodeVariables.hpp.

◆ dump()

virtual void sparta::statistics::expression::ReferenceVariable::dump ( std::ostream &  o,
bool  show_range = true,
bool  resolve_subexprs = true 
) const
inlineoverridevirtual

Dump the content of this expression item.

Note
Must not evaluate the expression
Parameters
oOstream to write to
show_rangeShould the range be shown in any subexpression nodes.
resolve_subexprsShould any referenced statistic defs be expanded to their full expressions so that this becomes an expression containing only counters.

Implements sparta::statistics::expression::ExpressionNode.

Definition at line 283 of file ExpressionNodeVariables.hpp.

◆ end()

virtual void sparta::statistics::expression::ReferenceVariable::end ( )
inlineoverridevirtual

◆ evaluate_()

virtual double sparta::statistics::expression::ReferenceVariable::evaluate_ ( ) const
inlineoverridevirtual

Compute value of this item in simulation.

Implements sparta::statistics::expression::ExpressionNode.

Definition at line 263 of file ExpressionNodeVariables.hpp.

◆ getClocks()

virtual void sparta::statistics::expression::ReferenceVariable::getClocks ( std::vector< const Clock * > &  clocks) const
inlineoverridevirtual

Populates a vector with the clocks found in this subexpression node.

Parameters
clocksVector of clocks to which any found clocks will be appended. This vector is not cleared.

Implements sparta::statistics::expression::ExpressionNode.

Definition at line 291 of file ExpressionNodeVariables.hpp.

◆ start()

virtual void sparta::statistics::expression::ReferenceVariable::start ( )
inlineoverridevirtual

◆ supportsCompression()

virtual bool sparta::statistics::expression::ReferenceVariable::supportsCompression ( ) const
inlineoverridevirtual

We currently are not attempting compression for ReferenceVariable's. These are not used with nearly as much frequency as counters, constants, and parameters.

Implements sparta::statistics::expression::ExpressionNode.

Definition at line 271 of file ExpressionNodeVariables.hpp.

Member Data Documentation

◆ ref_

const double& sparta::statistics::expression::ReferenceVariable::ref_

Reference to actual variable.

Definition at line 225 of file ExpressionNodeVariables.hpp.

◆ which_

std::string sparta::statistics::expression::ReferenceVariable::which_

Name of this variable.

Definition at line 220 of file ExpressionNodeVariables.hpp.


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