Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
AdviceLink Class Reference

#include "common/advice.hpp"

Description

Advice Collaboration partner, internally connected to the AdviceSystem.

Both advice::Request and advice::Provision are linked in this way to an internal index datastructure, which allows to carry out the actual advice exchange and collaboration.

Definition at line 185 of file advice.hpp.

Public Member Functions

 AdviceLink (Binding const &binding)
 
- Public Member Functions inherited from PointOfAdvice
 PointOfAdvice (Binding const &binding)
 
void setSolution (PointOfAdvice *solution=0)
 
const PointOfAdvicegetSolution () const
 
Binding::Matcher getMatcher () const
 

Protected Types

typedef void() DeleterFunc(void *)
 

Protected Member Functions

void publishProvision (PointOfAdvice *)
 when the Provision actually sets advice data, this is copied into an internal buffer within the AdviceSystem.
 
void discardSolutions ()
 when advice is retracted explicitly, after removing the provision index entry we also need to re-process any requests which happen to match our binding...
 
void publishRequestBindingChange (HashVal)
 
void registerRequest ()
 
void deregisterRequest ()
 
- 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.
 

Static Protected Member Functions

static void * getBuffer (size_t)
 allocate raw storage for a buffer holding the actual piece of advice.
 
static void releaseBuffer (void *, size_t)
 
static void manageAdviceData (PointOfAdvice *, DeleterFunc *)
 Store a descriptor record to take ownership of the given allocation.
 

Constructor & Destructor Documentation

◆ AdviceLink()

AdviceLink ( Binding const &  binding)
inlineexplicit

Definition at line 204 of file advice.hpp.

Member Typedef Documentation

◆ DeleterFunc

typedef void() DeleterFunc(void *)
protected

Definition at line 199 of file advice.hpp.

Member Function Documentation

◆ publishProvision()

void publishProvision ( PointOfAdvice newProvision)
protected

when the Provision actually sets advice data, this is copied into an internal buffer within the AdviceSystem.

We then use the Index to remember the presence of this advice data and to detect possible matches with existing advice::Request entries.

Parameters
newProvisionpointer to the copied data, actually pointing to an ActiveProvision<AD>

Definition at line 308 of file advice.cpp.

References PointOfAdvice::getSolution(), and PointOfAdvice::setSolution().

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

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

◆ discardSolutions()

void discardSolutions ( )
protected

when advice is retracted explicitly, after removing the provision index entry we also need to re-process any requests which happen to match our binding...

Definition at line 323 of file advice.cpp.

References PointOfAdvice::getSolution(), NULL, and PointOfAdvice::setSolution().

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

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

◆ publishRequestBindingChange()

void publishRequestBindingChange ( HashVal  previous_bindingKey)
protected

Definition at line 332 of file advice.cpp.

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

+ Here is the caller graph for this function:

◆ registerRequest()

void registerRequest ( )
protected

Definition at line 339 of file advice.cpp.

Referenced by Request< AD >::Request().

+ Here is the caller graph for this function:

◆ deregisterRequest()

void deregisterRequest ( )
protected

Definition at line 346 of file advice.cpp.

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

+ Here is the caller graph for this function:

◆ getBuffer()

void * getBuffer ( size_t  siz)
staticprotected

allocate raw storage for a buffer holding the actual piece of advice.

We need to manage this internally, as the original advice::Provision may go out of scope, while the advice information as such remains valid.

Note
the special twist is the size of the buffer depending on the actual advice type, which type information we need to erase for tracking all advice provisions and requests through an generic index datastructure.
Exceptions
error::Fatalon allocation failure

Definition at line 271 of file advice.cpp.

◆ releaseBuffer()

void releaseBuffer ( void *  buff,
size_t  siz 
)
staticprotected

Definition at line 278 of file advice.cpp.

◆ manageAdviceData()

void manageAdviceData ( PointOfAdvice entry,
DeleterFunc how_to_delete 
)
staticprotected

Store a descriptor record to take ownership of the given allocation.

Problem is we need to know the exact size of the advice value holder, which information is available initially, when the advice data is copied into the system. The knowledge about the size of the allocation is embodied into the deleter function. This allows later to discard entries without needing to know their exact type.

Definition at line 292 of file advice.cpp.

+ Inheritance diagram for AdviceLink:
+ Collaboration diagram for AdviceLink:

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