Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
Request< AD > Class Template Reference

#include "common/advice.hpp"

Description

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

Access point for the advised entity (client).

This is the interface intended for client code to request advice of a specific type and optionally limited to a special topic (binding). Instantiating an Request<AD> object automatically entails a registration with the AdviceSystem behind the scenes, and deleting it causes deregistration. Request objects may be instantiated and copied freely, and the binding pattern may be changed. The actual advice is accessed through the member function getAdvice, which might return a default-constructed piece of advice data in case no specific advice has been provided yet. Accessing advice can be considered a lightweight operation, while creating/destroying advice causes an index operation and thus requires a lock.

Creating an Request and changing the binding might fail, while the dtor is protected against failure (as you'd expect). Accessing advice can also be considered safe, given the concrete advice type can be default constructed without failure in case there isn't any advice data provided yet.

Definition at line 428 of file advice.hpp.

Public Member Functions

 Request (Literal bindingSpec=0)
 
 ~Request ()
 
AD const & getAdvice () const
 
bool isMatched () const
 
void defineBinding (Literal topic)
 set and possibly change the binding term used to retrieve Advice
 

Private Types

typedef const ActiveProvision< AD > AdviceProvision
 

Private Member Functions

AD const & handleMissingSolution () const
 <
 

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

◆ Request()

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

Definition at line 445 of file advice.hpp.

References AdviceLink::registerRequest().

+ Here is the call graph for this function:

◆ ~Request()

template<class AD >
~Request ( )
inline

Definition at line 451 of file advice.hpp.

References AdviceLink::deregisterRequest().

+ Here is the call graph for this function:

Member Typedef Documentation

◆ AdviceProvision

template<class AD >
typedef const ActiveProvision<AD> AdviceProvision
private

Definition at line 431 of file advice.hpp.

Member Function Documentation

◆ handleMissingSolution()

template<class AD >
AD const & handleMissingSolution ( ) const
inlineprivate

<

Warning
might segfault when used during shutdown

Definition at line 437 of file advice.hpp.

References NullValue< TY >::get().

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

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

◆ getAdvice()

template<class AD >
AD const & getAdvice ( ) const
inline

Definition at line 460 of file advice.hpp.

References PointOfAdvice::getSolution(), and Request< AD >::handleMissingSolution().

Referenced by steam::play::anonymous_namespace{diagnostic-output-slot.hpp}::getTestTimeGrid(), and lib::time::anonymous_namespace{common-services.cpp}::retrieveQuantiser().

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

◆ isMatched()

template<class AD >
bool isMatched ( ) const
inline
Returns
true if this request retrieves a piece of information specifically set by an Advisor, as opposed to just delivering a default fallback result.

Definition at line 475 of file advice.hpp.

References PointOfAdvice::getSolution().

+ Here is the call graph for this function:

◆ defineBinding()

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

set and possibly change the binding term used to retrieve Advice

Definition at line 483 of file advice.hpp.

References PointOfAdvice::hash_value, AdviceLink::publishRequestBindingChange(), and PointOfAdvice::setBindingPattern().

+ Here is the call graph for this function:
+ Inheritance diagram for Request< AD >:
+ Collaboration diagram for Request< AD >:

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