Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
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 235 of file advice.hpp.

Public Member Functions

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

Private Member Functions

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

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.
 
 PointOfAdvice (Binding const &binding)
 
void setSolution (PointOfAdvice *solution=0)
 
const PointOfAdvicegetSolution () const
 
Binding::Matcher getMatcher () const
 

Constructor & Destructor Documentation

◆ Provision() [1/2]

template<class AD >
Provision ( Literal  bindingSpec = 0)
inlineexplicit

Definition at line 247 of file advice.hpp.

◆ ~Provision()

template<class AD >
~Provision ( )
inline

Definition at line 251 of file advice.hpp.

References Provision< AD >::deregister().

+ Here is the call graph for this function:

◆ Provision() [2/2]

template<class AD >
Provision ( Provision< AD > const &  o)
inline

Definition at line 256 of file advice.hpp.

References NULL, and PointOfAdvice::setSolution().

+ Here is the call graph for this function:

Member Function Documentation

◆ deregister()

template<class AD >
void deregister ( )
inlineprivate

Definition at line 242 of file advice.hpp.

Referenced by Provision< AD >::~Provision().

+ Here is the caller graph for this function:

◆ operator=()

template<class AD >
Provision & operator= ( Provision< AD > const &  o)
inline

Definition at line 263 of file advice.hpp.

References PointOfAdvice::setSolution().

+ Here is the call graph for this function:

◆ setAdvice()

template<class AD >
void setAdvice ( AD const &  pieceOfAdvice)
inline

Definition at line 274 of file advice.hpp.

References AdviceLink::publishProvision(), and Provision< AD >::storeCopy().

Referenced by AdviceSituations_test::pattern01_justPickAndBeHappy(), AdviceSituations_test::pattern02_pickIfPresent(), UiStyle::prepareStyleContext(), TheAdvisor::publish(), and steam::asset::meta::anonymous_namespace{time-grid.cpp}::publishWrapped().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ retractAdvice()

template<class AD >
void retractAdvice ( )
inline

Definition at line 280 of file advice.hpp.

References AdviceLink::discardSolutions().

Referenced by TheAdvisor::clear().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isGiven()

template<class AD >
bool isGiven ( ) const
inline

Definition at line 286 of file advice.hpp.

References PointOfAdvice::getSolution().

Referenced by UiStyle::prepareStyleContext().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ defineBinding()

template<class AD >
void defineBinding ( Literal  topic)
inline

Definition at line 292 of file advice.hpp.

References Provision< AD >::maybe_rePublish(), and PointOfAdvice::setBindingPattern().

Referenced by TheAdvisor::rebind().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ storeCopy()

template<class AD >
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 350 of file advice.hpp.

References lumiera_error().

Referenced by Provision< AD >::setAdvice().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ releaseAdviceData()

template<class AD >
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 375 of file advice.hpp.

◆ maybe_rePublish()

template<class AD >
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 393 of file advice.hpp.

Referenced by Provision< AD >::defineBinding().

+ Here is the caller graph for this function:
+ Inheritance diagram for Provision< AD >:
+ Collaboration diagram for Provision< AD >:

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