INET Framework for OMNeT++/OMNEST
inet::DelayedInitializer< T > Class Template Reference

#include <DelayedInitializer.h>

Public Member Functions

 DelayedInitializer (const std::function< T *()> initializer)
 
 ~DelayedInitializer ()
 
const Toperator& () const
 

Private Attributes

Tt = nullptr
 
bool constructed
 
const std::function< T *()> initializer
 

Constructor & Destructor Documentation

template<typename T>
inet::DelayedInitializer< T >::DelayedInitializer ( const std::function< T *()>  initializer)
inline
const std::function< T *()> initializer
Definition: DelayedInitializer.h:31
bool constructed
Definition: DelayedInitializer.h:30
template<typename T>
inet::DelayedInitializer< T >::~DelayedInitializer ( )
inline
35 { delete t; }
T * t
Definition: DelayedInitializer.h:29

Member Function Documentation

template<typename T>
const T* inet::DelayedInitializer< T >::operator& ( ) const
inline
37  {
38  if (!constructed) {
39  fprintf(stderr, "Cannot dereference DelayedInitializer<%s> before it is completely constructed\n", typeid(t).name());
40  abort();
41  }
42  if (t == nullptr)
43  t = initializer();
44  return t;
45  }
const std::function< T *()> initializer
Definition: DelayedInitializer.h:31
bool constructed
Definition: DelayedInitializer.h:30
T * t
Definition: DelayedInitializer.h:29

Member Data Documentation

template<typename T>
bool inet::DelayedInitializer< T >::constructed
private
template<typename T>
const std::function<T *()> inet::DelayedInitializer< T >::initializer
private
template<typename T>
T* inet::DelayedInitializer< T >::t = nullptr
mutableprivate

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