![]() |
Lumiera 0.pre.04
»edit your freedom«
|
#include "lib/opaque-holder.hpp"
Inline buffer to hold and own an object while concealing the concrete type.
The object is given either as ctor parameter or by direct assignment; it is copy-constructed into the buffer. It is necessary to specify the required buffer storage space as a template parameter. InPlaceAnyHolder may be created empty or cleared afterwards, and this empty() state may be detected at runtime. In a similar vein, when the stored object has a bool validity check, this can be accessed though isValid(). Moreover not empty() and isValid() may be tested as by bool conversion of the Holder object. The whole compound is copyable if and only if the contained object is copyable.
Definition at line 201 of file opaque-holder.hpp.
Classes | |
| struct | Buff |
| concrete subclass to manage a specific kind of contained object. More... | |
| struct | Buffer |
| Inner capsule managing the contained object (interface) More... | |
| struct | EmptyBuff |
| special case: no stored object More... | |
Public Member Functions | |
| ~InPlaceAnyHolder () | |
| void | clear () |
| InPlaceAnyHolder () | |
| template<class SUB > | |
| InPlaceAnyHolder (SUB const &obj) | |
| InPlaceAnyHolder (InPlaceAnyHolder const &ref) | |
| InPlaceAnyHolder & | operator= (InPlaceAnyHolder const &ref) |
| template<class SUB > | |
| InPlaceAnyHolder & | operator= (SUB const &newContent) |
| template<class SUB > | |
| SUB & | get () const |
| re-accessing the concrete contained object. | |
| bool | empty () const |
| bool | isValid () const |
| operator bool () const | |
Protected Member Functions | |
| Buffer & | buff () |
| const Buffer & | buff () const |
| void | killBuffer () |
| void | make_emptyBuff () |
| template<class SUB > | |
| void | place_inBuff (SUB const &obj) |
| void | clone_inBuff (InPlaceAnyHolder const &ref) |
| BaseP | asBase () const |
| < | |
Private Types | |
| enum | { BUFFSIZE = sizeof(Buffer) } |
| using | BaseP = AccessPolicy::Base * |
Private Attributes | |
| char | storage_ [BUFFSIZE] |
| embedded buffer actually holding the concrete Buff object, which in turn holds and manages the target object. | |
|
inline |
Definition at line 371 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::killBuffer().
Here is the call graph for this function:
|
inline |
Definition at line 384 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::make_emptyBuff().
Here is the call graph for this function:
|
inline |
Definition at line 390 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::place_inBuff().
Here is the call graph for this function:
|
inline |
Definition at line 395 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::clone_inBuff().
Here is the call graph for this function:
|
private |
Definition at line 203 of file opaque-holder.hpp.
|
private |
| Enumerator | |
|---|---|
| BUFFSIZE | |
Definition at line 307 of file opaque-holder.hpp.
|
inlineprotected |
Definition at line 322 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::storage_.
Referenced by InPlaceAnyHolder< siz, AccessPolicy >::asBase(), InPlaceAnyHolder< siz, AccessPolicy >::clone_inBuff(), InPlaceAnyHolder< siz, AccessPolicy >::empty(), InPlaceAnyHolder< siz, AccessPolicy >::get(), InPlaceAnyHolder< siz, AccessPolicy >::isValid(), InPlaceAnyHolder< siz, AccessPolicy >::killBuffer(), and InPlaceAnyHolder< siz, AccessPolicy >::operator=().
Here is the caller graph for this function:
|
inlineprotected |
Definition at line 327 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::storage_.
|
inlineprotected |
Definition at line 334 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::Buffer::~Buffer(), and InPlaceAnyHolder< siz, AccessPolicy >::buff().
Referenced by InPlaceAnyHolder< siz, AccessPolicy >::~InPlaceAnyHolder(), InPlaceAnyHolder< siz, AccessPolicy >::clear(), InPlaceAnyHolder< siz, AccessPolicy >::operator=(), and InPlaceAnyHolder< siz, AccessPolicy >::operator=().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineprotected |
Definition at line 340 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::storage_.
Referenced by InPlaceAnyHolder< siz, AccessPolicy >::InPlaceAnyHolder(), InPlaceAnyHolder< siz, AccessPolicy >::clear(), InPlaceAnyHolder< siz, AccessPolicy >::operator=(), and InPlaceAnyHolder< siz, AccessPolicy >::operator=().
Here is the caller graph for this function:
|
inlineprotected |
Definition at line 347 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::storage_.
Referenced by InPlaceAnyHolder< siz, AccessPolicy >::InPlaceAnyHolder(), and InPlaceAnyHolder< siz, AccessPolicy >::operator=().
Here is the caller graph for this function:
|
inlineprotected |
Definition at line 353 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::buff(), InPlaceAnyHolder< siz, AccessPolicy >::Buffer::clone(), and InPlaceAnyHolder< siz, AccessPolicy >::storage_.
Referenced by InPlaceAnyHolder< siz, AccessPolicy >::InPlaceAnyHolder(), and InPlaceAnyHolder< siz, AccessPolicy >::operator=().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineprotected |
<
backdoor e.g. for comparisons
Definition at line 359 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::asBase(), InPlaceAnyHolder< siz, AccessPolicy >::buff(), and InPlaceAnyHolder< siz, AccessPolicy >::Buffer::getBase().
Referenced by InPlaceAnyHolder< siz, AccessPolicy >::asBase().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Definition at line 377 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::killBuffer(), and InPlaceAnyHolder< siz, AccessPolicy >::make_emptyBuff().
Here is the call graph for this function:
|
inline |
Definition at line 401 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::clone_inBuff(), InPlaceAnyHolder< siz, AccessPolicy >::killBuffer(), and InPlaceAnyHolder< siz, AccessPolicy >::make_emptyBuff().
Here is the call graph for this function:
|
inline |
Definition at line 421 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::buff(), InPlaceAnyHolder< siz, AccessPolicy >::empty(), InPlaceAnyHolder< siz, AccessPolicy >::killBuffer(), InPlaceAnyHolder< siz, AccessPolicy >::make_emptyBuff(), and InPlaceAnyHolder< siz, AccessPolicy >::place_inBuff().
Here is the call graph for this function:
|
inline |
re-accessing the concrete contained object.
This requires exact knowledge of the actual type of the element currently in storage. OpaqueHolder does not provide any "probing" or visitation mechanism.
| lumiera::error::Logic | when conversion/access fails |
| lumiera::error::Invalid | when accessing an empty holder |
Definition at line 452 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::buff(), InPlaceAnyHolder< siz, AccessPolicy >::empty(), and LERR_.
Referenced by WrappedStandardExeBuilder::invokeOriginalBuilder().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Definition at line 474 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::buff(), and InPlaceAnyHolder< siz, AccessPolicy >::Buffer::empty().
Referenced by InPlaceAnyHolder< siz, AccessPolicy >::get(), and InPlaceAnyHolder< siz, AccessPolicy >::operator=().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Definition at line 481 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::buff(), and InPlaceAnyHolder< siz, AccessPolicy >::Buffer::isValid().
Referenced by InPlaceAnyHolder< siz, AccessPolicy >::operator bool().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineexplicit |
Definition at line 487 of file opaque-holder.hpp.
References InPlaceAnyHolder< siz, AccessPolicy >::isValid().
Here is the call graph for this function:
|
private |
embedded buffer actually holding the concrete Buff object, which in turn holds and manages the target object.
Definition at line 312 of file opaque-holder.hpp.
Referenced by InPlaceAnyHolder< siz, AccessPolicy >::buff(), InPlaceAnyHolder< siz, AccessPolicy >::buff(), InPlaceAnyHolder< siz, AccessPolicy >::clone_inBuff(), InPlaceAnyHolder< siz, AccessPolicy >::make_emptyBuff(), and InPlaceAnyHolder< siz, AccessPolicy >::place_inBuff().
Inheritance diagram for InPlaceAnyHolder< siz, AccessPolicy >:
Collaboration diagram for InPlaceAnyHolder< siz, AccessPolicy >: