mqtt_cpp
Classes | Public Member Functions | List of all members
MQTT_NS::value_allocator< T > Class Template Reference

#include <value_allocator.hpp>

Public Member Functions

 value_allocator (value_type lowest, value_type highest)
 Create value_allocator The allocator has [lowest, highest] values. More...
 
optional< value_type > allocate ()
 Allocate one value. More...
 
optional< value_type > first_vacant () const
 Get the first vacant value. More...
 
void deallocate (value_type value)
 Dellocate one value. More...
 
bool use (value_type value)
 Declare the value as used. More...
 
void clear ()
 Clear all allocated or used values. More...
 
std::size_t interval_count () const
 
std::ostream & dump (std::ostream &o)
 

Constructor & Destructor Documentation

◆ value_allocator()

template<typename T >
MQTT_NS::value_allocator< T >::value_allocator ( value_type  lowest,
value_type  highest 
)
inline

Create value_allocator The allocator has [lowest, highest] values.

Parameters
lowestThe lowest value
highestThe highest value.

Member Function Documentation

◆ allocate()

template<typename T >
optional<value_type> MQTT_NS::value_allocator< T >::allocate ( )
inline

Allocate one value.

Returns
If allocator has at least one value, then returns lowest value, otherwise return nullopt.

◆ clear()

template<typename T >
void MQTT_NS::value_allocator< T >::clear ( )
inline

Clear all allocated or used values.

◆ deallocate()

template<typename T >
void MQTT_NS::value_allocator< T >::deallocate ( value_type  value)
inline

Dellocate one value.

Parameters
valuevalue to deallocate. The value must be gotten by allocate() or declared by use().

◆ dump()

template<typename T >
std::ostream& MQTT_NS::value_allocator< T >::dump ( std::ostream &  o)
inline

◆ first_vacant()

template<typename T >
optional<value_type> MQTT_NS::value_allocator< T >::first_vacant ( ) const
inline

Get the first vacant value.

Returns
If allocator has at least one vacant value, then returns lowest value, otherwise return nullopt.

◆ interval_count()

template<typename T >
std::size_t MQTT_NS::value_allocator< T >::interval_count ( ) const
inline

◆ use()

template<typename T >
bool MQTT_NS::value_allocator< T >::use ( value_type  value)
inline

Declare the value as used.

Parameters
valueThe value to declare using
Returns
If value is not used or allocated then true, otherwise false

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