nfd::SizeCounter< T > Class Template Reference

Provides a counter that observes the size of a table. More...

#include <daemon/common/counter.hpp>

+ Inheritance diagram for nfd::SizeCounter< T >:
+ Collaboration diagram for nfd::SizeCounter< T >:

Public Types

using rep = size_t
 

Public Member Functions

constexpr SizeCounter (const T *table=nullptr) noexcept
 
void observe (const T *table) noexcept
 
 operator rep () const
 Return the counter's value, i.e., the current size of the table being observed. More...
 

Detailed Description

template<typename T>
class nfd::SizeCounter< T >

Provides a counter that observes the size of a table.

Template Parameters
Ta type that provides a size() const member function

If the table is not specified in the constructor, it can be added later by calling observe().

Definition at line 110 of file counter.hpp.

Member Typedef Documentation

◆ rep

template<typename T >
using nfd::SizeCounter< T >::rep = size_t

Definition at line 113 of file counter.hpp.

Constructor & Destructor Documentation

◆ SizeCounter()

template<typename T >
constexpr nfd::SizeCounter< T >::SizeCounter ( const T *  table = nullptr)
inlineexplicitconstexprnoexcept

Definition at line 116 of file counter.hpp.

Member Function Documentation

◆ observe()

template<typename T >
void nfd::SizeCounter< T >::observe ( const T *  table)
inlinenoexcept

Definition at line 122 of file counter.hpp.

◆ operator rep()

template<typename T >
nfd::SizeCounter< T >::operator rep ( ) const
inline

Return the counter's value, i.e., the current size of the table being observed.

Definition at line 130 of file counter.hpp.