Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
VariantO< TYPES, Access > Class Template Reference

#include "lib/variant-o.hpp"

Description

template<typename TYPES, template< typename > class Access>
class lib::VariantO< TYPES, Access >

A variant wrapper (typesafe union) capable of holding a value of any of a bounded collection of types.

The value is stored in a local buffer directly within the object and may be accessed by a typesafe visitation.

This utility class is similar to boost::variant and indeed was implemented (5/08) in an effort to replace the latter in a draft solution for the problem of typesafe access to the correct wrapper class from within some builder tool. Well – after finishing this "exercise" I must admit that it is not really much more simple than what boost::variant does internally. At least we are pulling in fewer headers and the actual code path is shorter compared with boost::variant, at the price of being not so generic, no care for alignment issues within the buffer or for thread safety.
Deprecated:
immature first design attempt. obsolete. Please use lib::Variant ////////////////TICKET #738
Parameters
TYPEScollection of possible types to be stored in this variant object
Accesspolicy how to access the stored value

Definition at line 244 of file variant-o.hpp.

Public Member Functions

void reset ()
 
template<typename SRC >
VariantOoperator= (SRC src)
 store a copy of the given argument within the variant holder buffer, thereby typically casting or converting the given source type to the best suited (base) type (out of the collection of possible types for this VariantO instance)
 
template<typename TAR >
TAR get ()
 retrieve current content of the variant, trying to cast or convert it to the given type.
 

Private Types

typedef variant::Holder< TYPES > Holder
 
typedef Holder::Deleter Deleter
 

Private Attributes

Holder::Storage holder_
 storage: buffer holding either an "empty" marker, or an instance of one of the configured payload types
 

Additional Inherited Members

- Private Member Functions inherited from NonCopyable
 ~NonCopyable ()=default
 
 NonCopyable ()=default
 
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Member Typedef Documentation

◆ Holder

template<typename TYPES , template< typename > class Access>
typedef variant::Holder<TYPES> Holder
private

Definition at line 248 of file variant-o.hpp.

◆ Deleter

template<typename TYPES , template< typename > class Access>
typedef Holder::Deleter Deleter
private

Definition at line 249 of file variant-o.hpp.

Member Function Documentation

◆ reset()

template<typename TYPES , template< typename > class Access>
void reset ( )
inline

Definition at line 258 of file variant-o.hpp.

Referenced by BuilderTool::forgetWrapper().

+ Here is the caller graph for this function:

◆ operator=()

template<typename TYPES , template< typename > class Access>
template<typename SRC >
VariantO & operator= ( SRC  src)
inline

store a copy of the given argument within the variant holder buffer, thereby typically casting or converting the given source type to the best suited (base) type (out of the collection of possible types for this VariantO instance)

Definition at line 268 of file variant-o.hpp.

◆ get()

template<typename TYPES , template< typename > class Access>
template<typename TAR >
TAR get ( )
inline

retrieve current content of the variant, trying to cast or convert it to the given type.

Actually, the function access(T&) on the Access-policy (template param) is invoked with the type currently stored in the holder buffer. May return NULL if conversion fails.

Definition at line 284 of file variant-o.hpp.

Referenced by BuilderTool::getPlacement(), BuilderTool::getPtr(), and WrappedStandardExeBuilder::invokeOriginalBuilder().

+ Here is the caller graph for this function:

Member Data Documentation

◆ holder_

template<typename TYPES , template< typename > class Access>
Holder::Storage holder_
private

storage: buffer holding either an "empty" marker, or an instance of one of the configured payload types

Definition at line 254 of file variant-o.hpp.

+ Inheritance diagram for VariantO< TYPES, Access >:
+ Collaboration diagram for VariantO< TYPES, Access >:

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