rulesmanager::IRuleMatcher< RuleType > Class Template Reference

#include <rulesmanager.h>

Inheritance diagram for rulesmanager::IRuleMatcher< RuleType >:
configuration::ModeMatcher

List of all members.

Public Types

typedef int priority_t

Public Member Functions

virtual ~IRuleMatcher ()
virtual bool betterMatch (const priority_t &prio1, const priority_t &prio2) const
virtual bool operator() (const RuleType &original, const RuleType &rule, priority_t *priority) const =0

Detailed Description

template<typename RuleType>
class rulesmanager::IRuleMatcher< RuleType >

Class for rule matching.

Provides interface for generic rules comparing. Rule is specified as template parameter RuleType. Implementation specific match algorithm should be implemented in functional operator defined by implementator.
When multiple matches can occure (multiple rules matche one original), priority should be compared and one with the highest (according betterMatch method) should be used.


Member Typedef Documentation

template<typename RuleType>
typedef int rulesmanager::IRuleMatcher< RuleType >::priority_t

Type for matching priority. Use betterMatch method for priority comparing.

Reimplemented in configuration::ModeMatcher, and configuration::StringMatcher.


Constructor & Destructor Documentation

template<typename RuleType>
virtual rulesmanager::IRuleMatcher< RuleType >::~IRuleMatcher (  )  [inline, virtual]

Virtual destructor.


Member Function Documentation

template<typename RuleType>
virtual bool rulesmanager::IRuleMatcher< RuleType >::betterMatch ( const priority_t prio1,
const priority_t prio2 
) const [inline, virtual]

Checks whether prio2 is higher than prio1.

Parameters:
prio1 Priority.
prio2 Priority.
Returns:
true if prio2 is at least prio1.

Referenced by rulesmanager::RulesManager< std::string, std::string >::findMatching().

template<typename RuleType>
virtual bool rulesmanager::IRuleMatcher< RuleType >::operator() ( const RuleType &  original,
const RuleType &  rule,
priority_t priority 
) const [pure virtual]

Functor to compare given rules.

Parameters:
original Rule from configuration.
rule Rule to check.
priority Place where to set priority if given rule matches (if NULL, nothing is set).

Implementator should define when given rules matches and formulate priorities if multiple rules can match original. Match with higher priority should have higher precedence (use betterMatch method for priority comparing).
If given rule matches and priority parameter is non NULL, sets priority to place where it points.

Returns:
true if given rule matches given original, false otherwise.

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