Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MutationMessage Struct Reference

#include "lib/diff/mutation-message.hpp"

Description

Opaque message to effect a structural change on a target, which is likewise only known in an abstract way, as being specifically structured.

Sending such messages typically allows some implemention defined part within the Session to communicate structure and content to some other implementation defined part within the UI-Layer, without the necessity of both partners to be tightly coupled on implementation level or even know much about the other's implementation details. As motivation, contrast this to a naive UI implementation, which directly accesses some backend data structure; any change to the backend implementation typically affects the UI implementation on a detail level.

Warning
be sure to understand the fundamental problem of diff generation and application: the production context of diff messages need to be conserved beyond the producer's thread context, because it will be pulled asynchronous from within the UI event thread!

Definition at line 133 of file mutation-message.hpp.

Public Types

using _FrontEnd = DiffSource::iterator
 
- Public Types inherited from IterSource< TY >::iterator
using _I = IterAdapter< Pos, DataHandle >
 
- Public Types inherited from IterAdapter< Pos, DataHandle >
using pointer = typename _ValTrait::pointer
 
using reference = typename _ValTrait::reference
 
using value_type = typename _ValTrait::value_type
 

Public Member Functions

 MutationMessage ()=default
 
 MutationMessage (MutationMessage &&)=default
 
 MutationMessage (MutationMessage const &)=default
 
 MutationMessage (MutationMessage &o)
 
 MutationMessage (DiffSource *diffGenerationContext)
 MutationMessage builder: take ownership of an opaque heap allocated context from which the concrete diff can be pulled on demand. More...
 
 MutationMessage (std::initializer_list< DiffStep > const &&ili)
 Convenience builder for consuming an brace enclosed initializer_list. More...
 
template<typename... ARGS>
 MutationMessage (ARGS &&...args)
 Convenience builder to take an arbitrary number of DiffStep arguments. More...
 
template<class IT >
 MutationMessage (IT &&ii, enable_if< can_IterForEach< IT >, void * >=nullptr)
 Convenience builder to piggyback any Lumiera Forward Iterator. More...
 
template<class CON >
 MutationMessage (CON &container, enable_if< __and_< can_STL_ForEach< CON >, __not_< can_IterForEach< CON >>>, void * >=nullptr)
 Convenience builder to use elements form any STL-like container. More...
 
MutationMessageoperator= (MutationMessage const &)=default
 
MutationMessageoperator= (MutationMessage &&)=default
 
MutationMessageupdateDiagnostics ()
 enable support to show content of the message. More...
 
- Public Member Functions inherited from IterSource< TY >::iterator
 operator string () const
 
- Public Member Functions inherited from IterAdapter< Pos, DataHandle >
 IterAdapter (DataHandlesrc, Posconst &startpos)
 
 IterAdapter ()
 
bool empty () const
 
 ENABLE_USE_IN_STD_RANGE_FOR_LOOPS (IterAdapter)
 
bool isValid () const
 
 operator bool () const
 
reference operator* () const
 
IterAdapteroperator++ ()
 
pointer operator-> () const
 

Additional Inherited Members

- Protected Types inherited from IterAdapter< Pos, DataHandle >
using ConRef = typename meta::TypeBinding< DataHandle >::reference
 
- Protected Member Functions inherited from IterAdapter< Pos, DataHandle >
bool check () const
 ask the controlling container if this position is valid. More...
 
void iterate ()
 ask the controlling container to yield the next position. More...
 
void resetPos (PosotherPos)
 
ConRef source ()
 allow derived classes to access backing container More...
 
const ConRef source () const
 

Member Typedef Documentation

Definition at line 136 of file mutation-message.hpp.

Constructor & Destructor Documentation

MutationMessage ( )
default
MutationMessage ( MutationMessage &&  )
default
MutationMessage ( MutationMessage const &  )
default

Definition at line 141 of file mutation-message.hpp.

MutationMessage ( DiffSource diffGenerationContext)
inlineexplicit

MutationMessage builder: take ownership of an opaque heap allocated context from which the concrete diff can be pulled on demand.

Definition at line 152 of file mutation-message.hpp.

References IterSource< TY >::build().

+ Here is the call graph for this function:

MutationMessage ( std::initializer_list< DiffStep > const &&  ili)
inline

Convenience builder for consuming an brace enclosed initializer_list.

Note
initialiser elements will be copied into a heap alloacated snapshot (vector), which is then managed by shared_ptr

Definition at line 161 of file mutation-message.hpp.

References lib::iter_stl::snapshot().

+ Here is the call graph for this function:

MutationMessage ( ARGS &&...  args)
inline

Convenience builder to take an arbitrary number of DiffStep arguments.

Note
like for the initializer_list, arguments will be copied into a heap allocated snapshot

Definition at line 171 of file mutation-message.hpp.

MutationMessage ( IT &&  ii,
enable_if< can_IterForEach< IT >, void * >  = nullptr 
)
inline

Convenience builder to piggyback any Lumiera Forward Iterator.

Note
source iterator is copied into a heap allocated IterSource

Definition at line 180 of file mutation-message.hpp.

References lib::iter_source::wrapIter().

+ Here is the call graph for this function:

MutationMessage ( CON &  container,
enable_if< __and_< can_STL_ForEach< CON >, __not_< can_IterForEach< CON >>>, void * >  = nullptr 
)
inline

Convenience builder to use elements form any STL-like container.

Note
creating heap allocated IterSource, which refers to the original container
Warning
like with any classical iterators, the container must stay alive and accessible

Definition at line 190 of file mutation-message.hpp.

References lib::iter_source::eachEntry().

+ Here is the call graph for this function:

Member Function Documentation

MutationMessage& operator= ( MutationMessage const &  )
default
MutationMessage& operator= ( MutationMessage &&  )
default
MutationMessage & updateDiagnostics ( )
inline

enable support to show content of the message.

After calling this function, operator string() renders all DiffSteps

Warning
since by design a MutationMessage can only be ``pulled'' once, this operation needs to impose a side effect: it materialises the complete diff sequence at once into a heap allocated buffer.
operational semantics
Since the underlying generator of the DiffStep sequence is an iterator, the "materialised view" can only capture what's left at the point when updateDiagnostics() is invoked. The captured rest sequence seamlessly becomes the new generator and the old generator object is released, since the assignment of the new backend typically removes the last reference in the smart-ptr managing the generation backend. This process can be repeated and then the [diagnostics](operator string()) will show the remainder of the sequence left at that point.

Definition at line 263 of file mutation-message.hpp.

+ Inheritance diagram for MutationMessage:
+ Collaboration diagram for MutationMessage:

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