Public Member Functions | Private Member Functions | Private Attributes | List of all members
uavcan::LazyConstructor< T > Class Template Reference

#include <lazy_constructor.hpp>

Public Member Functions

void construct ()
 
template<typename P1 >
void construct (typename ParameterType< P1 >::Type p1)
 
template<typename P1 , typename P2 >
void construct (typename ParameterType< P1 >::Type p1, typename ParameterType< P2 >::Type p2)
 
template<typename P1 , typename P2 , typename P3 >
void construct (typename ParameterType< P1 >::Type p1, typename ParameterType< P2 >::Type p2, typename ParameterType< P3 >::Type p3)
 
template<typename P1 , typename P2 , typename P3 , typename P4 >
void construct (typename ParameterType< P1 >::Type p1, typename ParameterType< P2 >::Type p2, typename ParameterType< P3 >::Type p3, typename ParameterType< P4 >::Type p4)
 
template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
void construct (typename ParameterType< P1 >::Type p1, typename ParameterType< P2 >::Type p2, typename ParameterType< P3 >::Type p3, typename ParameterType< P4 >::Type p4, typename ParameterType< P5 >::Type p5)
 
template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 >
void construct (typename ParameterType< P1 >::Type p1, typename ParameterType< P2 >::Type p2, typename ParameterType< P3 >::Type p3, typename ParameterType< P4 >::Type p4, typename ParameterType< P5 >::Type p5, typename ParameterType< P6 >::Type p6)
 
void destroy ()
 
bool isConstructed () const
 
 LazyConstructor ()
 
 LazyConstructor (const LazyConstructor< T > &rhs)
 
 operator T* () const
 
T & operator* ()
 
const T & operator* () const
 
T * operator-> ()
 
const T * operator-> () const
 
LazyConstructor< T > & operator= (const LazyConstructor< T > &rhs)
 
 ~LazyConstructor ()
 

Private Member Functions

void ensureConstructed () const
 
void ensureNotConstructed () const
 

Private Attributes

struct {
   unsigned char   pool [sizeof(T)]
 
data_
 
T * ptr_
 

Detailed Description

template<typename T>
class uavcan::LazyConstructor< T >

This class allows to postpone the object contruction. It statically allocates a pool of memory of just enough size to fit the object being constructed. Later call to construct<>() calls the constructor of the object. The object will be destroyed automatically when the container class destructor is called. The memory pool is aligned at the size of the largest primitive type (long double or long long int).

Definition at line 27 of file lazy_constructor.hpp.

Constructor & Destructor Documentation

◆ LazyConstructor() [1/2]

template<typename T >
uavcan::LazyConstructor< T >::LazyConstructor ( )
inline

Definition at line 62 of file lazy_constructor.hpp.

◆ LazyConstructor() [2/2]

template<typename T >
uavcan::LazyConstructor< T >::LazyConstructor ( const LazyConstructor< T > &  rhs)
inline

Definition at line 68 of file lazy_constructor.hpp.

◆ ~LazyConstructor()

template<typename T >
uavcan::LazyConstructor< T >::~LazyConstructor ( )
inline

Definition at line 78 of file lazy_constructor.hpp.

Member Function Documentation

◆ construct() [1/7]

template<typename T >
void uavcan::LazyConstructor< T >::construct ( )
inline

Definition at line 110 of file lazy_constructor.hpp.

◆ construct() [2/7]

template<typename T >
template<typename P1 >
void uavcan::LazyConstructor< T >::construct ( typename ParameterType< P1 >::Type  p1)
inline

Definition at line 132 of file lazy_constructor.hpp.

◆ construct() [3/7]

template<typename T >
template<typename P1 , typename P2 >
void uavcan::LazyConstructor< T >::construct ( typename ParameterType< P1 >::Type  p1,
typename ParameterType< P2 >::Type  p2 
)
inline

Definition at line 139 of file lazy_constructor.hpp.

◆ construct() [4/7]

template<typename T >
template<typename P1 , typename P2 , typename P3 >
void uavcan::LazyConstructor< T >::construct ( typename ParameterType< P1 >::Type  p1,
typename ParameterType< P2 >::Type  p2,
typename ParameterType< P3 >::Type  p3 
)
inline

Definition at line 146 of file lazy_constructor.hpp.

◆ construct() [5/7]

template<typename T >
template<typename P1 , typename P2 , typename P3 , typename P4 >
void uavcan::LazyConstructor< T >::construct ( typename ParameterType< P1 >::Type  p1,
typename ParameterType< P2 >::Type  p2,
typename ParameterType< P3 >::Type  p3,
typename ParameterType< P4 >::Type  p4 
)
inline

Definition at line 154 of file lazy_constructor.hpp.

◆ construct() [6/7]

template<typename T >
template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
void uavcan::LazyConstructor< T >::construct ( typename ParameterType< P1 >::Type  p1,
typename ParameterType< P2 >::Type  p2,
typename ParameterType< P3 >::Type  p3,
typename ParameterType< P4 >::Type  p4,
typename ParameterType< P5 >::Type  p5 
)
inline

Definition at line 162 of file lazy_constructor.hpp.

◆ construct() [7/7]

template<typename T >
template<typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 >
void uavcan::LazyConstructor< T >::construct ( typename ParameterType< P1 >::Type  p1,
typename ParameterType< P2 >::Type  p2,
typename ParameterType< P3 >::Type  p3,
typename ParameterType< P4 >::Type  p4,
typename ParameterType< P5 >::Type  p5,
typename ParameterType< P6 >::Type  p6 
)
inline

Definition at line 171 of file lazy_constructor.hpp.

◆ destroy()

template<typename T >
void uavcan::LazyConstructor< T >::destroy ( )
inline

Definition at line 100 of file lazy_constructor.hpp.

◆ ensureConstructed()

template<typename T >
void uavcan::LazyConstructor< T >::ensureConstructed ( ) const
inlineprivate

Definition at line 45 of file lazy_constructor.hpp.

◆ ensureNotConstructed()

template<typename T >
void uavcan::LazyConstructor< T >::ensureNotConstructed ( ) const
inlineprivate

Definition at line 53 of file lazy_constructor.hpp.

◆ isConstructed()

template<typename T >
bool uavcan::LazyConstructor< T >::isConstructed ( ) const
inline

Definition at line 90 of file lazy_constructor.hpp.

◆ operator T*()

template<typename T >
uavcan::LazyConstructor< T >::operator T* ( ) const
inline

Definition at line 92 of file lazy_constructor.hpp.

◆ operator*() [1/2]

template<typename T >
T& uavcan::LazyConstructor< T >::operator* ( )
inline

Definition at line 98 of file lazy_constructor.hpp.

◆ operator*() [2/2]

template<typename T >
const T& uavcan::LazyConstructor< T >::operator* ( ) const
inline

Definition at line 97 of file lazy_constructor.hpp.

◆ operator->() [1/2]

template<typename T >
T* uavcan::LazyConstructor< T >::operator-> ( )
inline

Definition at line 95 of file lazy_constructor.hpp.

◆ operator->() [2/2]

template<typename T >
const T* uavcan::LazyConstructor< T >::operator-> ( ) const
inline

Definition at line 94 of file lazy_constructor.hpp.

◆ operator=()

template<typename T >
LazyConstructor<T>& uavcan::LazyConstructor< T >::operator= ( const LazyConstructor< T > &  rhs)
inline

Definition at line 80 of file lazy_constructor.hpp.

Member Data Documentation

◆ data_

struct { ... } uavcan::LazyConstructor< T >::data_

◆ pool

template<typename T >
unsigned char uavcan::LazyConstructor< T >::pool[sizeof(T)]

Definition at line 32 of file lazy_constructor.hpp.

◆ ptr_

template<typename T >
T* uavcan::LazyConstructor< T >::ptr_
private

Definition at line 43 of file lazy_constructor.hpp.


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


uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:04