Lumiera  0.pre.03
»edit your freedom«
Provision< AD > Class Template Reference

#include "common/advice.hpp"

Description

template<class AD>
class lumiera::advice::Provision< AD >

Access point for the advising entity (server).

This is the interface intended for client code to set and provide concrete advice information of a specific type AD. Instantiating automatically creates a type-guard binding pattern, but client code can (and typically should) provide additional predicates to define the "topic" this advice belongs to. This allows advice::Request entries to attach to the suitable advice "channels" and get the specific piece of advice they're looking for.

Any advice::Provision remains inactive and thus invisible, until setting the concrete advice data. After that, the provided data is copied into the AdviceSystem and remains available even after the original Provision goes out of scope. Consequently, it is not possible to modify advice data once set. But client code may retract the provision or change the binding pattern.

See also
AdviceBasics_test usage example

Definition at line 244 of file advice.hpp.

Public Member Functions

 Provision (Literal bindingSpec=0)
 
 Provision (Provision const &o)
 
void defineBinding (Literal topic)
 
bool isGiven () const
 
Provisionoperator= (Provision const &o)
 
void retractAdvice ()
 
void setAdvice (AD const &pieceOfAdvice)
 

Private Member Functions

void deregister ()
 
void maybe_rePublish ()
 
PointOfAdvicestoreCopy (AD const &advice_given)
 

Static Private Member Functions

static void releaseAdviceData (void *)
 

Additional Inherited Members

- Protected Member Functions inherited from PointOfAdvice
void setBindingPattern (Binding const &binding)
 define or re-define the binding, which specifically labels this attachment to the advice system. More...
 
 PointOfAdvice (Binding const &binding)
 
Binding::Matcher getMatcher () const
 
const PointOfAdvicegetSolution () const
 
void setSolution (PointOfAdvice *solution=0)
 

Member Function Documentation

◆ storeCopy()

PointOfAdvice * storeCopy ( AD const &  advice_given)
inlineprivate

function to copy advice into an internal buffer.

Returns
type erased pointer to the data holder created
Exceptions
error::Fatalon allocation problems, plus anything the advice data may throw during copy construction.

Definition at line 359 of file advice.hpp.

◆ releaseAdviceData()

void releaseAdviceData ( void *  entry)
inlinestaticprivate

assist the AdviceSystem with deallocating buffer storage. Problem is we need to know the exact size of the advice value holder, which information is available only here, in the fully typed context.

Definition at line 384 of file advice.hpp.

◆ maybe_rePublish()

void maybe_rePublish ( )
inlineprivate

in case we've already published this provision, we temporarily need a new provision entry, to allow the AdviceSystem implementation to rewrite the internal index

Definition at line 402 of file advice.hpp.

+ Inheritance diagram for Provision< AD >:
+ Collaboration diagram for Provision< AD >:

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