Lumiera  0.pre.03
»edit your freedom«
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 implementation 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 (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.
 
 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 (DataHandle src, Pos const &startpos)
 
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::RefTraits< 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 (Pos otherPos)
 
ConRef source ()
 allow derived classes to access backing container
 
const ConRef source () const
 

Constructor & Destructor Documentation

◆ MutationMessage() [1/4]

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 allocated snapshot (vector), which is then managed by shared_ptr

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

◆ MutationMessage() [2/4]

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() [3/4]

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.

◆ MutationMessage() [4/4]

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 MutationMessage::updateDiagnostics().

+ Here is the call graph for this function:

Member Function Documentation

◆ updateDiagnostics()

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 will show the remainder of the sequence left at that point.

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

Referenced by MutationMessage::MutationMessage().

+ Here is the caller graph for this function:
+ Inheritance diagram for MutationMessage:
+ Collaboration diagram for MutationMessage:

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