STXXL  1.4-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stxxl::custom_stats_counter< ValueType > Class Template Reference

Detailed Description

template<typename ValueType>
class stxxl::custom_stats_counter< ValueType >

This class provides a statistical counter that can easily be deactivated using a typedef to dummy_custom_stats_counter.

It's basically a wrapper for a unsigned long long value.

See Also
dummy_custom_stats_counter

Definition at line 32 of file custom_stats.h.

Public Types

typedef ValueType value_type
 The counter's value type. More...
 

Public Member Functions

 custom_stats_counter ()
 The constructor. Initializes the counter to 0. More...
 
std::string as_memory_amount (const value_type &byte_per_element) const
 Return the counter value interpreted as a memory amount in IEC units as a string. More...
 
 operator value_type () const
 Cast to counter_type: Returns the counter's value as a regular integer value. More...
 
custom_stats_counteroperator++ ()
 Increases the counter by 1 (prefix). More...
 
custom_stats_counter operator++ (int)
 Increases the counter by 1 (postfix). More...
 
custom_stats_counteroperator+= (const value_type &right)
 Increases the counter by right. More...
 
custom_stats_counteroperator= (const value_type &other)
 Assignment operator. More...
 
void set_max (const value_type &other)
 Set the counter to other if other is larger than the current counter value. More...
 

Protected Attributes

value_type m_value
 The counter's value. More...
 

Member Typedef Documentation

template<typename ValueType >
typedef ValueType stxxl::custom_stats_counter< ValueType >::value_type

The counter's value type.

Definition at line 36 of file custom_stats.h.

Constructor & Destructor Documentation

template<typename ValueType >
stxxl::custom_stats_counter< ValueType >::custom_stats_counter ( )
inline

The constructor. Initializes the counter to 0.

Definition at line 44 of file custom_stats.h.

Member Function Documentation

template<typename ValueType >
std::string stxxl::custom_stats_counter< ValueType >::as_memory_amount ( const value_type byte_per_element) const
inline

Return the counter value interpreted as a memory amount in IEC units as a string.

For that purpose the counter value is multiplied with the byte_per_element argument.

Parameters
byte_per_elementThe memory amount per "counter element".

Definition at line 92 of file custom_stats.h.

References stxxl::format_IEC_size().

template<typename ValueType >
stxxl::custom_stats_counter< ValueType >::operator value_type ( ) const
inline

Cast to counter_type: Returns the counter's value as a regular integer value.

This can be used as a getter as well as for printing with std::out.

Definition at line 101 of file custom_stats.h.

template<typename ValueType >
custom_stats_counter& stxxl::custom_stats_counter< ValueType >::operator++ ( )
inline

Increases the counter by 1 (prefix).

Definition at line 56 of file custom_stats.h.

template<typename ValueType >
custom_stats_counter stxxl::custom_stats_counter< ValueType >::operator++ ( int  )
inline

Increases the counter by 1 (postfix).

Definition at line 62 of file custom_stats.h.

template<typename ValueType >
custom_stats_counter& stxxl::custom_stats_counter< ValueType >::operator+= ( const value_type right)
inline

Increases the counter by right.

Parameters
rightThe corresponding integer value

Definition at line 50 of file custom_stats.h.

template<typename ValueType >
custom_stats_counter& stxxl::custom_stats_counter< ValueType >::operator= ( const value_type other)
inline

Assignment operator.

Parameters
otherThe corresponding integer value

Definition at line 70 of file custom_stats.h.

template<typename ValueType >
void stxxl::custom_stats_counter< ValueType >::set_max ( const value_type other)
inline

Set the counter to other if other is larger than the current counter value.

Parameters
otherThe corresponding integer value

Definition at line 81 of file custom_stats.h.

References max().

Member Data Documentation

template<typename ValueType >
value_type stxxl::custom_stats_counter< ValueType >::m_value
protected

The counter's value.

Definition at line 40 of file custom_stats.h.


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