3.4.0
MaybeOptionalPtr< T > Class Template Reference

The MaybeOptionalPtr class is a wrapper for a boost::variant over a T* or a a boost::optional<T>*. It provides a getter returning a boost::optional<const T&> and a setter. The setter throws an error if the underlying value is invalid (either a nullptr or an empty optional). More...

#include <CTiglRelativelyPositionedComponent.h>

+ Inheritance diagram for MaybeOptionalPtr< T >:

Public Member Functions

boost::optional< const T & > Get () const
 
 MaybeOptionalPtr ()=default
 
 MaybeOptionalPtr (T *t)
 
 MaybeOptionalPtr (boost::optional< T > *t)
 
void Set (const T &value)
 

Detailed Description

template<typename T>
class MaybeOptionalPtr< T >

The MaybeOptionalPtr class is a wrapper for a boost::variant over a T* or a a boost::optional<T>*. It provides a getter returning a boost::optional<const T&> and a setter. The setter throws an error if the underlying value is invalid (either a nullptr or an empty optional).

The main purpose of this class is to avoid a large number of overloaded ctors for CTiglRelativelyPositionedComponent: Some derived classes of CTiglRelativelyPositionedComponent can have either a mandatory parentUID or an optional parentUID as well as either a mandatory transformation or an optional transformation.

Constructor & Destructor Documentation

◆ MaybeOptionalPtr() [1/3]

template<typename T>
MaybeOptionalPtr< T >::MaybeOptionalPtr ( )
explicitdefault

◆ MaybeOptionalPtr() [2/3]

template<typename T>
MaybeOptionalPtr< T >::MaybeOptionalPtr ( T *  t)
inline

◆ MaybeOptionalPtr() [3/3]

template<typename T>
MaybeOptionalPtr< T >::MaybeOptionalPtr ( boost::optional< T > *  t)
inline

Member Function Documentation

◆ Get()

template<typename T>
boost::optional<const T&> MaybeOptionalPtr< T >::Get ( ) const
inline

◆ Set()

template<typename T>
void MaybeOptionalPtr< T >::Set ( const T &  value)
inline

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