![]() |
Lumiera 0.pre.04
»edit your freedom«
|
#include "lib/polymorphic-value.hpp"
Template to build polymorphic value objects.
Inline buffer with value semantics, yet holding and owning an object while concealing the concrete type, exposing only the public interface. Access to the contained object is by implicit conversion to this public interface. The actual implementation object might be placed into the buffer through a builder function; later, this buffer may be copied and passed on without knowing the actual contained type.
For using PolymorphicValue, several assumptions need to be fulfilled
Definition at line 365 of file polymorphic-value.hpp.
Classes | |
| class | Adapter |
| Implementation Helper: add support for copy operations. More... | |
Public Types | |
| using | Interface = IFA |
Static Public Member Functions | |
| template<class IMP , typename... ARGS> | |
| static PolymorphicValue | build (ARGS &&... args) |
Public Member Functions | |
| Interface & | getPayload () |
| operator Interface & () | |
| operator Interface const & () const | |
| Interface * | operator-> () const |
| ~PolymorphicValue () | |
| PolymorphicValue (PolymorphicValue const &o) | |
| PolymorphicValue & | operator= (PolymorphicValue const &o) |
Friends | |
| bool | operator== (PolymorphicValue const &v1, PolymorphicValue const &v2) |
| bool | operator!= (PolymorphicValue const &v1, PolymorphicValue const &v2) |
Protected Member Functions | |
| template<class IMP , typename... ARGS> | |
| PolymorphicValue (IMP *, ARGS &&... args) | |
Private Types | |
| enum | { siz = storage + _Traits::ADMIN_OVERHEAD } |
| typedef polyvalue::Trait< CPY > | _Traits |
| typedef _Traits::CopyAPI | _CopyHandlingAdapter |
| typedef _Traits::Assignment | _AssignmentPolicy |
| template<typename IMP > | |
| using | TypeSelector = Adapter< IMP > * |
Private Member Functions | |
| IFA & | accessEmbedded () const |
| void | destroyEmbedded () |
| _CopyHandlingAdapter & | accessHandlingInterface () const |
| template<class IMP , typename... ARGS> | |
| PolymorphicValue (TypeSelector< IMP >, ARGS &&... args) | |
Private Attributes | |
| std::byte | buf_ [siz] |
| Storage for embedded objects. | |
|
inlineprivate |
this is the actual working ctor, which must care to decorate the desired impl type with an additional adapter to support copy operations.
Definition at line 451 of file polymorphic-value.hpp.
References PolymorphicValue< IFA, storage, CPY >::buf_, and PolymorphicValue< IFA, storage, CPY >::siz.
|
inlineprotected |
ctor for subclasses and builder functions. The constructor requires an additional type-selector argument. On invocation, the desired subclass/implementation object is immediately planted into the embedded buffer, passing through the given ctor arguments.
Definition at line 467 of file polymorphic-value.hpp.
|
inline |
Definition at line 496 of file polymorphic-value.hpp.
References PolymorphicValue< IFA, storage, CPY >::destroyEmbedded().
Here is the call graph for this function:
|
inline |
Definition at line 501 of file polymorphic-value.hpp.
References PolymorphicValue< IFA, storage, CPY >::accessHandlingInterface(), PolymorphicValue< IFA, storage, CPY >::buf_, and CopySupport< IFA, BA >::cloneInto().
Here is the call graph for this function:
|
private |
Definition at line 368 of file polymorphic-value.hpp.
|
private |
Definition at line 369 of file polymorphic-value.hpp.
|
private |
Definition at line 370 of file polymorphic-value.hpp.
|
private |
Definition at line 436 of file polymorphic-value.hpp.
| using Interface = IFA |
Definition at line 474 of file polymorphic-value.hpp.
|
private |
| Enumerator | |
|---|---|
| siz | |
Definition at line 371 of file polymorphic-value.hpp.
|
inlineprivate |
Definition at line 384 of file polymorphic-value.hpp.
References PolymorphicValue< IFA, storage, CPY >::buf_.
Referenced by PolymorphicValue< IFA, storage, CPY >::accessHandlingInterface(), PolymorphicValue< IFA, storage, CPY >::destroyEmbedded(), PolymorphicValue< IFA, storage, CPY >::getPayload(), PolymorphicValue< IFA, storage, CPY >::operator Interface &(), PolymorphicValue< IFA, storage, CPY >::operator Interface const &(), PolymorphicValue< IFA, storage, CPY >::operator->(), and PolymorphicValue< IFA, storage, CPY >::operator=().
Here is the caller graph for this function:
|
inlineprivate |
Definition at line 390 of file polymorphic-value.hpp.
References PolymorphicValue< IFA, storage, CPY >::accessEmbedded().
Referenced by PolymorphicValue< IFA, storage, CPY >::~PolymorphicValue().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineprivate |
Definition at line 440 of file polymorphic-value.hpp.
References Trait< TY, YES >::accessCopyHandlingInterface(), and PolymorphicValue< IFA, storage, CPY >::accessEmbedded().
Referenced by PolymorphicValue< IFA, storage, CPY >::PolymorphicValue(), and PolymorphicValue< IFA, storage, CPY >::operator=().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Definition at line 477 of file polymorphic-value.hpp.
References PolymorphicValue< IFA, storage, CPY >::accessEmbedded().
Here is the call graph for this function:
|
inline |
Definition at line 482 of file polymorphic-value.hpp.
References PolymorphicValue< IFA, storage, CPY >::accessEmbedded().
Here is the call graph for this function:
|
inline |
Definition at line 486 of file polymorphic-value.hpp.
References PolymorphicValue< IFA, storage, CPY >::accessEmbedded().
Here is the call graph for this function:
|
inline |
Definition at line 491 of file polymorphic-value.hpp.
References PolymorphicValue< IFA, storage, CPY >::accessEmbedded().
Here is the call graph for this function:
|
inline |
Definition at line 507 of file polymorphic-value.hpp.
References PolymorphicValue< IFA, storage, CPY >::accessEmbedded(), PolymorphicValue< IFA, storage, CPY >::accessHandlingInterface(), and CopySupport< IFA, BA >::copyInto().
Here is the call graph for this function:
|
inlinestatic |
Definition at line 517 of file polymorphic-value.hpp.
|
mutableprivate |
Storage for embedded objects.
Definition at line 381 of file polymorphic-value.hpp.
Referenced by PolymorphicValue< IFA, storage, CPY >::PolymorphicValue(), PolymorphicValue< IFA, storage, CPY >::PolymorphicValue(), and PolymorphicValue< IFA, storage, CPY >::accessEmbedded().
|
friend |
Definition at line 527 of file polymorphic-value.hpp.
|
friend |
Definition at line 532 of file polymorphic-value.hpp.
Inheritance diagram for PolymorphicValue< IFA, storage, CPY >:
Collaboration diagram for PolymorphicValue< IFA, storage, CPY >: