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

#include "common/advice/binding.hpp"

Description

Conjunction of predicates to be matched against a collaboration partner for establishing an Advice connection.

The binding is defined by a textual spec in prolog-like syntax. The internal representation is immediately normalised. Typically the goal is just to create a #Matcher (Functor) to be stored for later match checks TODO type comment

Definition at line 99 of file common/advice/binding.hpp.

Classes

class  Atom
 single predicate as part of an advice binding pattern More...
 
class  Matcher
 Functor object for matching against another Binding. More...
 

Public Member Functions

 Binding ()
 create the empty binding, equivalent to true
 
 Binding (Literal spec)
 create the binding as defined by the given textual definition.
 
void addPredicate (Literal spec)
 extend the definition of this binding by adding a predicate according to the given textual definition
 
template<typename TY >
Binding const & addTypeGuard ()
 
Matcher buildMatcher () const
 
HashVal calculateHash () const
 
 operator string () const
 
template<typename TY >
Binding const & addTypeGuard ()
 

Friends

bool operator== (Binding const &, Binding const &)
 bindings are considered equivalent if, after normalisation, their respective definitions are identical.
 

Private Types

typedef std::set< AtomNormalisedAtoms
 

Private Member Functions

void parse_and_append (Literal def)
 internal: parse into atoms, and insert them
 

Private Attributes

NormalisedAtoms atoms_
 

Constructor & Destructor Documentation

◆ Binding() [1/2]

Binding ( )

create the empty binding, equivalent to true

Definition at line 101 of file common/advice/binding.cpp.

◆ Binding() [2/2]

Binding ( Literal  spec)

create the binding as defined by the given textual definition.

Note
implicit type conversion deliberately intended

Definition at line 105 of file common/advice/binding.cpp.

References Binding::parse_and_append().

+ Here is the call graph for this function:

Member Typedef Documentation

◆ NormalisedAtoms

typedef std::set<Atom> NormalisedAtoms
private

Definition at line 149 of file common/advice/binding.hpp.

Member Function Documentation

◆ addPredicate()

void addPredicate ( Literal  spec)

extend the definition of this binding by adding a predicate according to the given textual definition

Definition at line 113 of file common/advice/binding.cpp.

References Binding::parse_and_append().

Referenced by AdviceBindingPattern_test::verifyPatternNormalisation(), and AdviceBindingPattern_test::verifyPatternSyntax().

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

◆ addTypeGuard() [1/2]

template<typename TY >
Binding const & addTypeGuard ( )

Referenced by AdviceBindingPattern_test::verifyPatternNormalisation(), and AdviceBindingPattern_test::verifyPatternSyntax().

+ Here is the caller graph for this function:

◆ buildMatcher()

Binding::Matcher buildMatcher ( ) const
inline

Definition at line 250 of file common/advice/binding.hpp.

References Binding::calculateHash().

Referenced by TestPOA::changeBinding(), lumiera::advice::matches(), PointOfAdvice::setBindingPattern(), and AdviceBindingPattern_test::verifyPreparedMatch().

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

◆ calculateHash()

HashVal calculateHash ( ) const

Definition at line 146 of file common/advice/binding.cpp.

References Binding::atoms_, and hash.

Referenced by Binding::buildMatcher(), lumiera::advice::hash_value(), and Binding::Matcher::matches().

+ Here is the caller graph for this function:

◆ operator string()

operator string ( ) const

Definition at line 121 of file common/advice/binding.cpp.

◆ parse_and_append()

void parse_and_append ( Literal  def)
private

internal: parse into atoms, and insert them

Definition at line 77 of file common/advice/binding.cpp.

References Binding::atoms_.

Referenced by Binding::Binding(), and Binding::addPredicate().

+ Here is the caller graph for this function:

◆ addTypeGuard() [2/2]

template<typename TY >
Binding const & addTypeGuard ( )
inline

Definition at line 217 of file common/advice/binding.hpp.

References Binding::atoms_.

Member Data Documentation

◆ atoms_

Friends And Related Symbol Documentation

◆ operator==

bool operator== ( Binding const &  b1,
Binding const &  b2 
)
friend

bindings are considered equivalent if, after normalisation, their respective definitions are identical.

Note
for bindings without variable arguments, equivalence and matching always yield the same results. Contrary to this, two bindings with some variable arguments could match, without being defined identically. For example pred(X) matches pred(u) or any other binding of the form pred(<constant_value>) ////TICKET #615 not yet implemented

Definition at line 173 of file common/advice/binding.cpp.

+ Collaboration diagram for Binding:

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