The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::statistics::expression::TernaryFunction< RetT, ArgT > Struct Template Reference

Represents a Ternary function node. More...

#include <ExpressionNodeTypes.hpp>

Inheritance diagram for sparta::statistics::expression::TernaryFunction< RetT, ArgT >:
Collaboration diagram for sparta::statistics::expression::TernaryFunction< RetT, ArgT >:

Public Types

typedef RetT(*const fxn_t) (ArgT, ArgT, ArgT)
 Function evaluation handler type.
 

Public Member Functions

 TernaryFunction ()=delete
 No default construction.
 
 TernaryFunction (const TernaryFunction &rhp)
 
 TernaryFunction (const std::string &name, fxn_t fxn, ExpressionNode *op1, ExpressionNode *op2, ExpressionNode *op3)
 
TernaryFunctionoperator= (const TernaryFunction &)=delete
 Non-assignable.
 
virtual TernaryFunctionclone_ () 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

const std::string name_
 Name of this ternary function.
 
const fxn_t fxn_
 Ternary function to invoke.
 
std::unique_ptr< ExpressionNodeoperand_1_
 Operand 1 of the unary function fxn_.
 
std::unique_ptr< ExpressionNodeoperand_2_
 Operand 2 of the unary function fxn_.
 
std::unique_ptr< ExpressionNodeoperand_3_
 Operand 2 of the unary function fxn_.
 

Detailed Description

template<typename RetT = double, typename ArgT = double>
struct sparta::statistics::expression::TernaryFunction< RetT, ArgT >

Represents a Ternary function node.

Template Parameters
RetTReturn type of function pointer. Must be convertable to double
ArgTArgument type of function pointer. Must be convertable from a lvalue double

Definition at line 523 of file ExpressionNodeTypes.hpp.

Member Typedef Documentation

◆ fxn_t

template<typename RetT = double, typename ArgT = double>
typedef RetT(*const sparta::statistics::expression::TernaryFunction< RetT, ArgT >::fxn_t) (ArgT, ArgT, ArgT)

Function evaluation handler type.

Definition at line 528 of file ExpressionNodeTypes.hpp.

Constructor & Destructor Documentation

◆ TernaryFunction() [1/2]

template<typename RetT = double, typename ArgT = double>
sparta::statistics::expression::TernaryFunction< RetT, ArgT >::TernaryFunction ( const TernaryFunction< RetT, ArgT > &  rhp)
inline

Definition at line 561 of file ExpressionNodeTypes.hpp.

◆ TernaryFunction() [2/2]

template<typename RetT = double, typename ArgT = double>
sparta::statistics::expression::TernaryFunction< RetT, ArgT >::TernaryFunction ( const std::string &  name,
fxn_t  fxn,
ExpressionNode op1,
ExpressionNode op2,
ExpressionNode op3 
)
inline

brief Construct a new ternary function

Parameters
Nameof function
unarydouble function pointer
op1Operand 1. Must not be nullptr. Takes ownership
op2Operand 1. Must not be nullptr. Takes ownership

Definition at line 581 of file ExpressionNodeTypes.hpp.

Member Function Documentation

◆ clone_()

template<typename RetT = double, typename ArgT = double>
virtual TernaryFunction * sparta::statistics::expression::TernaryFunction< RetT, ArgT >::clone_ ( ) const
inlineoverridevirtual

Deep copy of the content of this item.

To be overridden by subclasses

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

Definition at line 605 of file ExpressionNodeTypes.hpp.

Here is the call graph for this function:

◆ dump()

template<typename RetT = double, typename ArgT = double>
virtual void sparta::statistics::expression::TernaryFunction< RetT, ArgT >::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 633 of file ExpressionNodeTypes.hpp.

◆ end()

template<typename RetT = double, typename ArgT = double>
virtual void sparta::statistics::expression::TernaryFunction< RetT, ArgT >::end ( )
inlineoverridevirtual

◆ evaluate_()

template<typename RetT = double, typename ArgT = double>
virtual double sparta::statistics::expression::TernaryFunction< RetT, ArgT >::evaluate_ ( ) const
inlineoverridevirtual

Compute value of this item in simulation.

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

Definition at line 609 of file ExpressionNodeTypes.hpp.

◆ getClocks()

template<typename RetT = double, typename ArgT = double>
virtual void sparta::statistics::expression::TernaryFunction< RetT, ArgT >::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 645 of file ExpressionNodeTypes.hpp.

◆ start()

template<typename RetT = double, typename ArgT = double>
virtual void sparta::statistics::expression::TernaryFunction< RetT, ArgT >::start ( )
inlineoverridevirtual

◆ supportsCompression()

template<typename RetT = double, typename ArgT = double>
virtual bool sparta::statistics::expression::TernaryFunction< RetT, ArgT >::supportsCompression ( ) const
inlineoverridevirtual

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

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

Definition at line 617 of file ExpressionNodeTypes.hpp.

Member Data Documentation

◆ fxn_

template<typename RetT = double, typename ArgT = double>
const fxn_t sparta::statistics::expression::TernaryFunction< RetT, ArgT >::fxn_

Ternary function to invoke.

Definition at line 538 of file ExpressionNodeTypes.hpp.

◆ name_

template<typename RetT = double, typename ArgT = double>
const std::string sparta::statistics::expression::TernaryFunction< RetT, ArgT >::name_

Name of this ternary function.

Definition at line 533 of file ExpressionNodeTypes.hpp.

◆ operand_1_

template<typename RetT = double, typename ArgT = double>
std::unique_ptr<ExpressionNode> sparta::statistics::expression::TernaryFunction< RetT, ArgT >::operand_1_

Operand 1 of the unary function fxn_.

Definition at line 543 of file ExpressionNodeTypes.hpp.

◆ operand_2_

template<typename RetT = double, typename ArgT = double>
std::unique_ptr<ExpressionNode> sparta::statistics::expression::TernaryFunction< RetT, ArgT >::operand_2_

Operand 2 of the unary function fxn_.

Definition at line 548 of file ExpressionNodeTypes.hpp.

◆ operand_3_

template<typename RetT = double, typename ArgT = double>
std::unique_ptr<ExpressionNode> sparta::statistics::expression::TernaryFunction< RetT, ArgT >::operand_3_

Operand 2 of the unary function fxn_.

Definition at line 553 of file ExpressionNodeTypes.hpp.


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