gem5  v20.1.0.0
Public Member Functions | Private Attributes | List of all members
Stats::FunctorProxy< T, typename std::enable_if< std::is_constructible< std::function< Result()>, const T & >::value >::type > Class Template Reference

Template specialization for type std::function<Result()> which holds a copy of its target instead of a pointer to it. More...

#include <statistics.hh>

Inheritance diagram for Stats::FunctorProxy< T, typename std::enable_if< std::is_constructible< std::function< Result()>, const T & >::value >::type >:
Stats::ProxyInfo Stats::ScalarInfo Stats::Info

Public Member Functions

 FunctorProxy (const T &func)
 
Counter value () const
 
Result result () const
 
Result total () const
 
- Public Member Functions inherited from Stats::ProxyInfo
std::string str () const
 
size_type size () const
 
bool check () const
 Check that this stat has been set up properly and is ready for use. More...
 
void prepare ()
 Prepare the stat for dumping. More...
 
void reset ()
 Reset the stat to the default state. More...
 
bool zero () const
 
void visit (Output &visitor)
 Visitor entry for outputing statistics data. More...
 
- Public Member Functions inherited from Stats::Info
 Info ()
 
virtual ~Info ()
 
void setName (const std::string &name)
 Set the name of this statistic. More...
 
void setName (const Group *parent, const std::string &name)
 
void setSeparator (std::string _sep)
 
bool baseCheck () const
 
virtual void enable ()
 Enable the stat for use. More...
 

Private Attributes

std::function< Result()> functor
 

Additional Inherited Members

- Static Public Member Functions inherited from Stats::Info
static bool less (Info *stat1, Info *stat2)
 Checks if the first stat's name is alphabetically less than the second. More...
 
- Public Attributes inherited from Stats::Info
std::string name
 The name of the stat. More...
 
std::string desc
 The description of the stat. More...
 
Flags flags
 The formatting flags. More...
 
int precision
 The display precision. More...
 
const Infoprereq
 A pointer to a prerequisite Stat. More...
 
int id
 
const StorageParamsstorageParams
 
- Static Public Attributes inherited from Stats::Info
static std::string separatorString = "::"
 The separator string used for vectors, dist, etc. More...
 
static int id_count = 0
 A unique stat ID for each stat in the simulator. More...
 

Detailed Description

template<class T>
class Stats::FunctorProxy< T, typename std::enable_if< std::is_constructible< std::function< Result()>, const T & >::value >::type >

Template specialization for type std::function<Result()> which holds a copy of its target instead of a pointer to it.

This makes it possible to use a lambda or other type inline without having to keep track of an instance somewhere else.

Definition at line 814 of file statistics.hh.

Constructor & Destructor Documentation

◆ FunctorProxy()

template<class T >
Stats::FunctorProxy< T, typename std::enable_if< std::is_constructible< std::function< Result()>, const T & >::value >::type >::FunctorProxy ( const T &  func)
inline

Definition at line 822 of file statistics.hh.

Member Function Documentation

◆ result()

template<class T >
Result Stats::FunctorProxy< T, typename std::enable_if< std::is_constructible< std::function< Result()>, const T & >::value >::type >::result ( ) const
inlinevirtual

Implements Stats::ScalarInfo.

Definition at line 824 of file statistics.hh.

References Stats::FunctorProxy< T, Enabled >::functor.

◆ total()

template<class T >
Result Stats::FunctorProxy< T, typename std::enable_if< std::is_constructible< std::function< Result()>, const T & >::value >::type >::total ( ) const
inlinevirtual

Implements Stats::ScalarInfo.

Definition at line 825 of file statistics.hh.

References Stats::FunctorProxy< T, Enabled >::functor.

◆ value()

template<class T >
Counter Stats::FunctorProxy< T, typename std::enable_if< std::is_constructible< std::function< Result()>, const T & >::value >::type >::value ( ) const
inlinevirtual

Implements Stats::ScalarInfo.

Definition at line 823 of file statistics.hh.

References Stats::FunctorProxy< T, Enabled >::functor.

Member Data Documentation

◆ functor

template<class T >
std::function<Result()> Stats::FunctorProxy< T, typename std::enable_if< std::is_constructible< std::function< Result()>, const T & >::value >::type >::functor
private

Definition at line 819 of file statistics.hh.


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

Generated on Wed Sep 30 2020 14:03:12 for gem5 by doxygen 1.8.17