Lumiera
0.pre.03
»edit your freedom«
|
#include "lib/verb-visitor.hpp"
A self-contained token to embody a specific yet abstracted operation, together with a concrete set of suitable arguments.
The concrete operation is suppled on invocation, when the VerbPack is combined with an actual receiver object, implementing the interface REC
and thus providing the function implementation. VerbPack represents a kind of double-dispatch, flexible both on the actual operation (embodied into the given VerbPack object) and also flexible in the concrete receiver.
REC | the "visitor interface" to invoke operations on |
RET | expected (common) return value of the bound operations (can be void ) |
arg_storage | maximum storage size to reserve as buffer for actual function parameters. |
arg_storage
triggers a static assertionDefinition at line 187 of file verb-visitor.hpp.
Public Member Functions | |
template<typename FUN , typename... ARGS> | |
VerbPack (FUN handler, Literal verbID, ARGS &&... args) | |
setup a VerbPack for a given operation on the interface REC More... | |
template<typename ARG > | |
ARG & | accessArg () |
unsafe downcast and access to an embedded payload argument value | |
RET | applyTo (REC &receiver) |
Core operation: invoke the operation for this "verb" with the pre-bound parameters. More... | |
operator string () const | |
Public Member Functions inherited from PolymorphicValue< VerbInvoker< REC, RET >, storageOverhead(arg_storage)> | |
PolymorphicValue (PolymorphicValue const &o) | |
Interface & | getPayload () |
operator Interface & () | |
operator Interface const & () const | |
Interface * | operator-> () const |
PolymorphicValue & | operator= (PolymorphicValue const &o) |
Classes | |
struct | HandlerTypeDetector |
struct | HandlerTypeDetector< RET(REC::*)(ARGS...)> |
Private Types | |
using | Dispatcher = VerbInvoker< REC, RET > |
template<typename FUN > | |
using | PayloadType = typename HandlerTypeDetector< FUN >::Payload * |
using | PolyHolder = PolymorphicValue< Dispatcher, storageOverhead(arg_storage)> |
Additional Inherited Members | |
Public Types inherited from PolymorphicValue< VerbInvoker< REC, RET >, storageOverhead(arg_storage)> | |
typedef VerbInvoker< REC, RET > | Interface |
Static Public Member Functions inherited from PolymorphicValue< VerbInvoker< REC, RET >, storageOverhead(arg_storage)> | |
static PolymorphicValue | build (ARGS &&... args) |
Protected Member Functions inherited from PolymorphicValue< VerbInvoker< REC, RET >, storageOverhead(arg_storage)> | |
PolymorphicValue (IMP *, ARGS &&... args) | |
struct lib::VerbPack::HandlerTypeDetector |
struct lib::VerbPack::HandlerTypeDetector< RET(REC::*)(ARGS...)> |
setup a VerbPack for a given operation on the interface REC
handler | function member-pointer to define the operation |
verbID | unique ID to designate the token; equality is based on this verbID , all tokens with same ID count as equal |
args | arbitrary (yet suitable) arguments to pre-bind and use later when actually invoking the operation on a concrete receiver |
Definition at line 218 of file verb-visitor.hpp.
|
inline |
Core operation: invoke the operation for this "verb" with the pre-bound parameters.
receiver | a subclass of REC , providing the function to invoke |
Definition at line 228 of file verb-visitor.hpp.