gem5  v22.1.0.0
Public Member Functions | Private Attributes | List of all members
gem5::statistics::ScalarProxy< Stat > Class Template Reference

A proxy class to access the stat at a given index in a VectorBase stat. More...

#include <statistics.hh>

Public Member Functions

Counter value () const
 Return the current value of this stat as its base type. More...
 
Result result () const
 Return the current value of this statas a result type. More...
 
 ScalarProxy (Stat &s, off_type i)
 Create and initialize this proxy, do not register it with the database. More...
 
 ScalarProxy (const ScalarProxy &sp)
 Create a copy of the provided ScalarProxy. More...
 
const ScalarProxyoperator= (const ScalarProxy &sp)
 Set this proxy equal to the provided one. More...
 
void operator++ ()
 Increment the stat by 1. More...
 
void operator-- ()
 Decrement the stat by 1. More...
 
void operator++ (int)
 Increment the stat by 1. More...
 
void operator-- (int)
 Decrement the stat by 1. More...
 
template<typename U >
void operator= (const U &v)
 Set the data value to the given value. More...
 
template<typename U >
void operator+= (const U &v)
 Increment the stat by the given value. More...
 
template<typename U >
void operator-= (const U &v)
 Decrement the stat by the given value. More...
 
size_type size () const
 Return the number of elements, always 1 for a scalar. More...
 
std::string str () const
 

Private Attributes

Stat & stat
 Pointer to the parent Vector. More...
 
off_type index
 The index to access in the parent VectorBase. More...
 

Detailed Description

template<class Stat>
class gem5::statistics::ScalarProxy< Stat >

A proxy class to access the stat at a given index in a VectorBase stat.

Behaves like a ScalarBase.

Definition at line 796 of file statistics.hh.

Constructor & Destructor Documentation

◆ ScalarProxy() [1/2]

template<class Stat >
gem5::statistics::ScalarProxy< Stat >::ScalarProxy ( Stat &  s,
off_type  i 
)
inline

Create and initialize this proxy, do not register it with the database.

Parameters
iThe index to access.

Definition at line 823 of file statistics.hh.

◆ ScalarProxy() [2/2]

template<class Stat >
gem5::statistics::ScalarProxy< Stat >::ScalarProxy ( const ScalarProxy< Stat > &  sp)
inline

Create a copy of the provided ScalarProxy.

Parameters
spThe proxy to copy.

Definition at line 832 of file statistics.hh.

Member Function Documentation

◆ operator++() [1/2]

template<class Stat >
void gem5::statistics::ScalarProxy< Stat >::operator++ ( )
inline

Increment the stat by 1.

This calls the associated storage object inc function.

Definition at line 855 of file statistics.hh.

References gem5::statistics::ScalarProxy< Stat >::index, and gem5::statistics::ScalarProxy< Stat >::stat.

◆ operator++() [2/2]

template<class Stat >
void gem5::statistics::ScalarProxy< Stat >::operator++ ( int  )
inline

Increment the stat by 1.

Definition at line 863 of file statistics.hh.

◆ operator+=()

template<class Stat >
template<typename U >
void gem5::statistics::ScalarProxy< Stat >::operator+= ( const U &  v)
inline

Increment the stat by the given value.

This calls the associated storage object inc function.

Parameters
vThe value to add.

Definition at line 886 of file statistics.hh.

References gem5::statistics::ScalarProxy< Stat >::index, gem5::statistics::ScalarProxy< Stat >::stat, and gem5::VegaISA::v.

◆ operator--() [1/2]

template<class Stat >
void gem5::statistics::ScalarProxy< Stat >::operator-- ( )
inline

Decrement the stat by 1.

This calls the associated storage object dec function.

Definition at line 860 of file statistics.hh.

References gem5::statistics::ScalarProxy< Stat >::index, and gem5::statistics::ScalarProxy< Stat >::stat.

◆ operator--() [2/2]

template<class Stat >
void gem5::statistics::ScalarProxy< Stat >::operator-- ( int  )
inline

Decrement the stat by 1.

Definition at line 865 of file statistics.hh.

◆ operator-=()

template<class Stat >
template<typename U >
void gem5::statistics::ScalarProxy< Stat >::operator-= ( const U &  v)
inline

Decrement the stat by the given value.

This calls the associated storage object dec function.

Parameters
vThe value to substract.

Definition at line 898 of file statistics.hh.

References gem5::statistics::ScalarProxy< Stat >::index, gem5::statistics::ScalarProxy< Stat >::stat, and gem5::VegaISA::v.

◆ operator=() [1/2]

template<class Stat >
const ScalarProxy& gem5::statistics::ScalarProxy< Stat >::operator= ( const ScalarProxy< Stat > &  sp)
inline

Set this proxy equal to the provided one.

Parameters
spThe proxy to copy.
Returns
A reference to this proxy.

Definition at line 842 of file statistics.hh.

References gem5::statistics::ScalarProxy< Stat >::index, gem5::ArmISA::sp, and gem5::statistics::ScalarProxy< Stat >::stat.

◆ operator=() [2/2]

template<class Stat >
template<typename U >
void gem5::statistics::ScalarProxy< Stat >::operator= ( const U &  v)
inline

Set the data value to the given value.

This calls the associated storage object set function.

Parameters
vThe new value.

Definition at line 874 of file statistics.hh.

References gem5::statistics::ScalarProxy< Stat >::index, gem5::statistics::ScalarProxy< Stat >::stat, and gem5::VegaISA::v.

◆ result()

template<class Stat >
Result gem5::statistics::ScalarProxy< Stat >::result ( ) const
inline

Return the current value of this statas a result type.

Returns
The current value.

Definition at line 816 of file statistics.hh.

References gem5::statistics::ScalarProxy< Stat >::index, and gem5::statistics::ScalarProxy< Stat >::stat.

◆ size()

template<class Stat >
size_type gem5::statistics::ScalarProxy< Stat >::size ( ) const
inline

Return the number of elements, always 1 for a scalar.

Returns
1.

Definition at line 907 of file statistics.hh.

◆ str()

template<class Stat >
std::string gem5::statistics::ScalarProxy< Stat >::str ( ) const
inline

◆ value()

template<class Stat >
Counter gem5::statistics::ScalarProxy< Stat >::value ( ) const
inline

Return the current value of this stat as its base type.

Returns
The current value.

Definition at line 810 of file statistics.hh.

References gem5::statistics::ScalarProxy< Stat >::index, and gem5::statistics::ScalarProxy< Stat >::stat.

Member Data Documentation

◆ index

template<class Stat >
off_type gem5::statistics::ScalarProxy< Stat >::index
private

◆ stat

template<class Stat >
Stat& gem5::statistics::ScalarProxy< Stat >::stat
private

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

Generated on Wed Dec 21 2022 10:24:26 for gem5 by doxygen 1.9.1