Lumiera  0.pre.03
»edit your freedom«
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 437 of file advice.hpp.

Public Member Functions

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

Private Types

typedef const ActiveProvision< AD > AdviceProvision
 

Private Member Functions

AD const & handleMissingSolution () const
 < More...
 

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

◆ handleMissingSolution()

AD const& handleMissingSolution ( ) const
inlineprivate

<

Warning
might segfault when used during shutdown

Definition at line 446 of file advice.hpp.

◆ isMatched()

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 484 of file advice.hpp.

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

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