Chemical Data Processing Library C++ API - Version 1.1.1
Public Types | Public Member Functions | List of all members
CDPL::Chem::PropertyMatchExpression< ValueType, MatchFunc, ObjType1, ObjType2 > Class Template Reference

PropertyMatchExpression. More...

#include <PropertyMatchExpression.hpp>

+ Inheritance diagram for CDPL::Chem::PropertyMatchExpression< ValueType, MatchFunc, ObjType1, ObjType2 >:

Public Types

typedef std::shared_ptr< PropertyMatchExpressionSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated PropertyMatchExpression instances. More...
 
typedef std::function< ValueType(const ObjType1 &, const ObjType2 &)> PropertyFunction
 Type of the generic functor class used to store user-defined property accessor functions. More...
 
- Public Types inherited from CDPL::Chem::MatchExpression< ObjType1, void >
typedef std::shared_ptr< MatchExpressionSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated MatchExpression instances. More...
 

Public Member Functions

 PropertyMatchExpression (const PropertyFunction &property_func)
 Constructs a PropertyMatchExpression instance that performs query/target object equivalence tests based on the property values returned by property_func. More...
 
 PropertyMatchExpression (const ValueType &value, const PropertyFunction &property_func)
 Constructs a PropertyMatchExpression instance that performs query/target object equivalence tests based on the target object property values returned by property_func and the specified query value. More...
 
bool operator() (const ObjType1 &query_obj1, const ObjType2 &query_obj2, const ObjType1 &target_obj1, const ObjType2 &target_obj2, const Base::Any &aux_data) const
 Checks whether the value of the target object propery matches the query property value. More...
 
- Public Member Functions inherited from CDPL::Chem::MatchExpression< ObjType1, void >
virtual ~MatchExpression ()
 Virtual Destructor. More...
 
virtual bool operator() (const ObjType1 &query_obj1, const void &query_obj2, const ObjType1 &target_obj1, const void &target_obj2, const AtomBondMapping &mapping, const Base::Any &aux_data) const
 Performs an evaluation of the expression for the given query and target objects under consideration of the provided candidate atom/bond mapping. More...
 
virtual bool requiresAtomBondMapping () const
 Tells whether the expression must be reevaluated after a query to target atom/bond mapping candidate has been found. More...
 

Detailed Description

template<typename ValueType, typename MatchFunc, typename ObjType1, typename ObjType2 = void>
class CDPL::Chem::PropertyMatchExpression< ValueType, MatchFunc, ObjType1, ObjType2 >

PropertyMatchExpression.

Template Parameters
ValueTypeThe type of the checked property values.
MatchFuncThe type of a binary functor class that implements the logic of testing the target property values against the query property values. The overloaded function call operator is required to take the target property value as its first argument and the query value as the second argument (both provided as const reference to ValueType). The returned result must be implicitly convertible to type bool (true indicates a match, false a mismatch).
ObjType1The type of the primary query/target objects for which the expression gets evaluated.
ObjType2The type of secondary query/target objects which provide auxiliary information for expression evaluation.

Member Typedef Documentation

◆ SharedPointer

template<typename ValueType , typename MatchFunc , typename ObjType1 , typename ObjType2 = void>
typedef std::shared_ptr<PropertyMatchExpression> CDPL::Chem::PropertyMatchExpression< ValueType, MatchFunc, ObjType1, ObjType2 >::SharedPointer

A reference-counted smart pointer [SHPTR] for dynamically allocated PropertyMatchExpression instances.

◆ PropertyFunction

template<typename ValueType , typename MatchFunc , typename ObjType1 , typename ObjType2 = void>
typedef std::function<ValueType(const ObjType1&, const ObjType2&)> CDPL::Chem::PropertyMatchExpression< ValueType, MatchFunc, ObjType1, ObjType2 >::PropertyFunction

Type of the generic functor class used to store user-defined property accessor functions.

PropertyFunction allows to wrap any function pointer or function object compatible with a return type of ValueType and two arguments of type const ObjType1& and const ObjType2& (see [FUNWRP]).

Constructor & Destructor Documentation

◆ PropertyMatchExpression() [1/2]

template<typename ValueType , typename MatchFunc , typename ObjType1 , typename ObjType2 = void>
CDPL::Chem::PropertyMatchExpression< ValueType, MatchFunc, ObjType1, ObjType2 >::PropertyMatchExpression ( const PropertyFunction property_func)
inline

Constructs a PropertyMatchExpression instance that performs query/target object equivalence tests based on the property values returned by property_func.

Parameters
property_funcA PropertyMatchExpression::PropertyFunction2 instance that wraps the specified property value accessor function.

◆ PropertyMatchExpression() [2/2]

template<typename ValueType , typename MatchFunc , typename ObjType1 , typename ObjType2 = void>
CDPL::Chem::PropertyMatchExpression< ValueType, MatchFunc, ObjType1, ObjType2 >::PropertyMatchExpression ( const ValueType &  value,
const PropertyFunction property_func 
)
inline

Constructs a PropertyMatchExpression instance that performs query/target object equivalence tests based on the target object property values returned by property_func and the specified query value.

Parameters
valueThe query property value.
property_funcA PropertyMatchExpression::PropertyFunction2 instance that wraps the specified target property value accessor function.

Member Function Documentation

◆ operator()()

template<typename ValueType , typename MatchFunc , typename ObjType1 , typename ObjType2 >
bool CDPL::Chem::PropertyMatchExpression< ValueType, MatchFunc, ObjType1, ObjType2 >::operator() ( const ObjType1 &  query_obj1,
const ObjType2 &  query_obj2,
const ObjType1 &  target_obj1,
const ObjType2 &  target_obj2,
const Base::Any aux_data 
) const
virtual

Checks whether the value of the target object propery matches the query property value.

The actual equivalence test between the query and target property values is performed by an instance of the function object type that was provided as template argument for MatchFunc.

Parameters
query_obj1The primary query object.
query_obj2The secondary query object.
target_obj1The primary target object.
target_obj2The secondary target object.
aux_dataProvides auxiliary information for the evaluation of the expression (ignored).
Returns
true if the target property value matches the query property value under the conditions defined by MatchFunc, and false otherwise.

Reimplemented from CDPL::Chem::MatchExpression< ObjType1, void >.


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