pion::platform::Comparison Class Reference

#include <Comparison.hpp>

List of all members.


Detailed Description

Comparison: used to perform a comparison on the value of a Term

Definition at line 44 of file Comparison.hpp.

Public Types

 TYPE_FALSE = 0
 TYPE_TRUE
 TYPE_IS_DEFINED
 TYPE_IS_NOT_DEFINED
 TYPE_EQUALS
 TYPE_NOT_EQUALS
 TYPE_GREATER_THAN
 TYPE_LESS_THAN
 TYPE_GREATER_OR_EQUAL
 TYPE_LESS_OR_EQUAL
 TYPE_EXACT_MATCH
 TYPE_NOT_EXACT_MATCH
 TYPE_CONTAINS
 TYPE_NOT_CONTAINS
 TYPE_STARTS_WITH
 TYPE_NOT_STARTS_WITH
 TYPE_ENDS_WITH
 TYPE_NOT_ENDS_WITH
 TYPE_ORDERED_BEFORE
 TYPE_NOT_ORDERED_BEFORE
 TYPE_ORDERED_AFTER
 TYPE_NOT_ORDERED_AFTER
 TYPE_REGEX
 TYPE_NOT_REGEX
 TYPE_EXACT_MATCH_PRIMARY
 TYPE_NOT_EXACT_MATCH_PRIMARY
 TYPE_CONTAINS_PRIMARY
 TYPE_NOT_CONTAINS_PRIMARY
 TYPE_STARTS_WITH_PRIMARY
 TYPE_NOT_STARTS_WITH_PRIMARY
 TYPE_ENDS_WITH_PRIMARY
 TYPE_NOT_ENDS_WITH_PRIMARY
 TYPE_ORDERED_BEFORE_PRIMARY
 TYPE_NOT_ORDERED_BEFORE_PRIMARY
 TYPE_ORDERED_AFTER_PRIMARY
 TYPE_NOT_ORDERED_AFTER_PRIMARY
 TYPE_SAME_DATE_TIME
 TYPE_NOT_SAME_DATE_TIME
 TYPE_EARLIER_DATE_TIME
 TYPE_LATER_DATE_TIME
 TYPE_SAME_OR_EARLIER_DATE_TIME
 TYPE_SAME_OR_LATER_DATE_TIME
 TYPE_SAME_DATE
 TYPE_NOT_SAME_DATE
 TYPE_EARLIER_DATE
 TYPE_LATER_DATE
 TYPE_SAME_OR_EARLIER_DATE
 TYPE_SAME_OR_LATER_DATE
 TYPE_SAME_TIME
 TYPE_NOT_SAME_TIME
 TYPE_EARLIER_TIME
 TYPE_LATER_TIME
 TYPE_SAME_OR_EARLIER_TIME
 TYPE_SAME_OR_LATER_TIME
 LAST_COMPARISON_TYPE = TYPE_SAME_OR_LATER_TIME
enum  ComparisonType {
  TYPE_FALSE = 0, TYPE_TRUE, TYPE_IS_DEFINED, TYPE_IS_NOT_DEFINED,
  TYPE_EQUALS, TYPE_NOT_EQUALS, TYPE_GREATER_THAN, TYPE_LESS_THAN,
  TYPE_GREATER_OR_EQUAL, TYPE_LESS_OR_EQUAL, TYPE_EXACT_MATCH, TYPE_NOT_EXACT_MATCH,
  TYPE_CONTAINS, TYPE_NOT_CONTAINS, TYPE_STARTS_WITH, TYPE_NOT_STARTS_WITH,
  TYPE_ENDS_WITH, TYPE_NOT_ENDS_WITH, TYPE_ORDERED_BEFORE, TYPE_NOT_ORDERED_BEFORE,
  TYPE_ORDERED_AFTER, TYPE_NOT_ORDERED_AFTER, TYPE_REGEX, TYPE_NOT_REGEX,
  TYPE_EXACT_MATCH_PRIMARY, TYPE_NOT_EXACT_MATCH_PRIMARY, TYPE_CONTAINS_PRIMARY, TYPE_NOT_CONTAINS_PRIMARY,
  TYPE_STARTS_WITH_PRIMARY, TYPE_NOT_STARTS_WITH_PRIMARY, TYPE_ENDS_WITH_PRIMARY, TYPE_NOT_ENDS_WITH_PRIMARY,
  TYPE_ORDERED_BEFORE_PRIMARY, TYPE_NOT_ORDERED_BEFORE_PRIMARY, TYPE_ORDERED_AFTER_PRIMARY, TYPE_NOT_ORDERED_AFTER_PRIMARY,
  TYPE_SAME_DATE_TIME, TYPE_NOT_SAME_DATE_TIME, TYPE_EARLIER_DATE_TIME, TYPE_LATER_DATE_TIME,
  TYPE_SAME_OR_EARLIER_DATE_TIME, TYPE_SAME_OR_LATER_DATE_TIME, TYPE_SAME_DATE, TYPE_NOT_SAME_DATE,
  TYPE_EARLIER_DATE, TYPE_LATER_DATE, TYPE_SAME_OR_EARLIER_DATE, TYPE_SAME_OR_LATER_DATE,
  TYPE_SAME_TIME, TYPE_NOT_SAME_TIME, TYPE_EARLIER_TIME, TYPE_LATER_TIME,
  TYPE_SAME_OR_EARLIER_TIME, TYPE_SAME_OR_LATER_TIME, LAST_COMPARISON_TYPE = TYPE_SAME_OR_LATER_TIME
}
 data type representing the type of comparison operation to perform

Public Member Functions

virtual ~Comparison ()
 virtual destructor: you may extend this class
 Comparison (const Vocabulary::Term &term)
 Comparison (const Comparison &c)
 standard copy constructor
bool evaluate (const Event &e) const
bool evaluateRange (const Event::ValuesRange &values_range) const
template<typename T>
void configure (const ComparisonType type, const T &value, const bool match_all_values=false)
void configure (const ComparisonType type, const char *value, const bool match_all_values=false)
void configure (const ComparisonType type, const std::string &value, const bool match_all_values=false)
void configure (const ComparisonType type)
void updateVocabulary (const Vocabulary &v)
const Vocabulary::TermgetTerm (void) const
 returns the Vocabulary Term to examine
ComparisonType getType (void) const
 returns the type of Comparison that this is
const Event::ParameterValuegetValue (void) const
 returns the value that the Vocabulary Term is compared to
bool getMatchAllValues (void) const
 returns true if all Vocabulary Term values must match
const boost::u32regex & getRegex (void) const
 returns the compiled (or empty) regular expression
const std::string & getRegexStr (void) const
 returns the original string that the regular expression was constructed from

Static Public Member Functions

static ComparisonType parseComparisonType (std::string str)
static std::string getComparisonTypeAsString (const ComparisonType comparison_type)
static bool requiresValue (ComparisonType t)
 returns true for comparison types which require a value, i.e. which have arity > 1
static void writeComparisonsXML (std::ostream &out)

Classes

class  CompareEarlierDate
 helper class used to determine if one date is earlier than another
class  CompareEarlierDateTime
 helper class used to determine if one date_time value is earlier than another
class  CompareEarlierTime
 helper class used to determine if one time of day is earlier than another
class  CompareEquals
 helper class used to determine if two numbers are equal
class  CompareGreaterOrEqual
 helper class used to determine if one number is greater than or equal to another
class  CompareGreaterThan
 helper class used to determine if one number is greater than another
class  CompareLaterDate
 helper class used to determine if one date is later than another
class  CompareLaterDateTime
 helper class used to determine if one date_time value is later than another
class  CompareLaterTime
 helper class used to determine if one time of day is later than another
class  CompareLessOrEqual
 helper class used to determine if one number is less than or equal to another
class  CompareLessThan
 helper class used to determine if one number is less than another
class  CompareSameDate
 helper class used to determine if two dates are equivalent
class  CompareSameDateTime
 helper class used to determine if two date_time values are equivalent
class  CompareSameOrEarlierDate
 helper class used to determine if one date is the same as or earlier than another
class  CompareSameOrEarlierDateTime
 helper class used to determine if one date_time value is the same as or earlier than another
class  CompareSameOrEarlierTime
 helper class used to determine if one time of day is the same as or earlier than another
class  CompareSameOrLaterDate
 helper class used to determine if one date is the same as or later than another
class  CompareSameOrLaterDateTime
 helper class used to determine if one date_time value is the same as or later than another
class  CompareSameOrLaterTime
 helper class used to determine if one time of day is the same as or later than another
class  CompareSameTime
 helper class used to determine if two times of day are equivalent
class  CompareStringContains
 helper class used to determine if one string contains another
class  CompareStringEndsWith
 helper class used to determine if one string ends with another
class  CompareStringExactMatch
 helper class used to determine if one string matches another
class  CompareStringOrderedAfter
 helper class used to determine if one string is ordered after another
class  CompareStringOrderedBefore
 helper class used to determine if one string is ordered before another
class  CompareStringRegex
 helper class used to determine if a string matches a regular expression
class  CompareStringStartsWith
 helper class used to determine if one string starts with another
class  ComparisonFunctor
class  InvalidComparisonException
 exception thrown if an invalid comparison was evaluated More...
class  InvalidTypeForTermException
 exception thrown if an invalid comparison type is given for a Vocabulary Term More...
class  InvalidValueForTypeException
 exception thrown if an invalid value is given for the type of comparison More...
class  UnknownComparisonTypeException
 exception thrown if the Comparison type is not recognized More...


Constructor & Destructor Documentation

pion::platform::Comparison::Comparison ( const Vocabulary::Term term  )  [inline, explicit]

constructs a new Comparison

Parameters:
term the term that will be examined

Definition at line 154 of file Comparison.hpp.


Member Function Documentation

void pion::platform::Comparison::configure ( const ComparisonType  type  ) 

configures the Comparison information (alternate form comparisons that have not value)

Parameters:
the type of Comparison to perform

Definition at line 327 of file Comparison.cpp.

References requiresValue().

void pion::platform::Comparison::configure ( const ComparisonType  type,
const std::string &  value,
const bool  match_all_values = false 
)

configures the Comparison information (alternate form for string comparisons)

Parameters:
the type of Comparison to perform
value the value that the Vocabulary Term is compared to
match_all_values if true, all values of the Vocabulary Term must match

Definition at line 161 of file Comparison.cpp.

References pion::PionTimeFacet::fromString(), requiresValue(), pion::platform::Vocabulary::Term::term_format, pion::platform::Vocabulary::Term::term_type, pion::platform::Vocabulary::TYPE_BLOB, pion::platform::Vocabulary::TYPE_CHAR, pion::platform::Vocabulary::TYPE_DATE, pion::platform::Vocabulary::TYPE_DATE_TIME, pion::platform::Vocabulary::TYPE_DOUBLE, pion::platform::Vocabulary::TYPE_FLOAT, pion::platform::Vocabulary::TYPE_INT16, pion::platform::Vocabulary::TYPE_INT32, pion::platform::Vocabulary::TYPE_INT64, pion::platform::Vocabulary::TYPE_INT8, pion::platform::Vocabulary::TYPE_LONG_DOUBLE, pion::platform::Vocabulary::TYPE_LONG_STRING, pion::platform::Vocabulary::TYPE_NULL, pion::platform::Vocabulary::TYPE_OBJECT, pion::platform::Vocabulary::TYPE_SHORT_STRING, pion::platform::Vocabulary::TYPE_STRING, pion::platform::Vocabulary::TYPE_TIME, pion::platform::Vocabulary::TYPE_UINT16, pion::platform::Vocabulary::TYPE_UINT32, pion::platform::Vocabulary::TYPE_UINT64, pion::platform::Vocabulary::TYPE_UINT8, and pion::platform::Vocabulary::TYPE_ZBLOB.

void pion::platform::Comparison::configure ( const ComparisonType  type,
const char *  value,
const bool  match_all_values = false 
) [inline]

configures the Comparison information (alternate form for string comparisons)

Parameters:
the type of Comparison to perform
value the value that the Vocabulary Term is compared to
match_all_values if true, all values of the Vocabulary Term must match

Definition at line 202 of file Comparison.hpp.

template<typename T>
void pion::platform::Comparison::configure ( const ComparisonType  type,
const T &  value,
const bool  match_all_values = false 
) [inline]

configures the Comparison information

Parameters:
the type of Comparison to perform
value the value that the Vocabulary Term is compared to
match_all_values if true, all values of the Vocabulary Term must match

Definition at line 723 of file Comparison.hpp.

References pion::platform::Vocabulary::Term::term_type, pion::platform::Vocabulary::TYPE_BLOB, pion::platform::Vocabulary::TYPE_CHAR, pion::platform::Vocabulary::TYPE_DATE, pion::platform::Vocabulary::TYPE_DATE_TIME, pion::platform::Vocabulary::TYPE_DOUBLE, pion::platform::Vocabulary::TYPE_FLOAT, pion::platform::Vocabulary::TYPE_INT16, pion::platform::Vocabulary::TYPE_INT32, pion::platform::Vocabulary::TYPE_INT64, pion::platform::Vocabulary::TYPE_INT8, pion::platform::Vocabulary::TYPE_LONG_DOUBLE, pion::platform::Vocabulary::TYPE_LONG_STRING, pion::platform::Vocabulary::TYPE_NULL, pion::platform::Vocabulary::TYPE_OBJECT, pion::platform::Vocabulary::TYPE_SHORT_STRING, pion::platform::Vocabulary::TYPE_STRING, pion::platform::Vocabulary::TYPE_TIME, pion::platform::Vocabulary::TYPE_UINT16, pion::platform::Vocabulary::TYPE_UINT32, pion::platform::Vocabulary::TYPE_UINT64, pion::platform::Vocabulary::TYPE_UINT8, and pion::platform::Vocabulary::TYPE_ZBLOB.

Referenced by pion::platform::RuleChain::setConfig(), and pion::platform::TransformRules::TransformRules().

bool pion::platform::Comparison::evaluate ( const Event e  )  const [inline]

evaluates the result of the Comparison

Parameters:
e the Event to evaluate
Returns:
true if the Comparison succeeded; false if it did not

get a range of iterators representing all the values for the Term

Definition at line 1311 of file Comparison.hpp.

References pion::platform::BasicEvent< CharType, AllocType >::equal_range(), evaluateRange(), pion::platform::BasicEvent< CharType, AllocType >::getType(), and pion::platform::Vocabulary::Term::term_ref.

bool pion::platform::Comparison::evaluateRange ( const Event::ValuesRange values_range  )  const [inline]

evaluates the result of the Comparison

Parameters:
values_range range of values (within an event) to evaluate
Returns:
true if the Comparison succeeded; false if it did not

Definition at line 826 of file Comparison.hpp.

References pion::platform::Vocabulary::Term::term_type, pion::platform::Vocabulary::TYPE_BLOB, pion::platform::Vocabulary::TYPE_CHAR, pion::platform::Vocabulary::TYPE_DATE, pion::platform::Vocabulary::TYPE_DATE_TIME, pion::platform::Vocabulary::TYPE_DOUBLE, pion::platform::Vocabulary::TYPE_FLOAT, pion::platform::Vocabulary::TYPE_INT16, pion::platform::Vocabulary::TYPE_INT32, pion::platform::Vocabulary::TYPE_INT64, pion::platform::Vocabulary::TYPE_INT8, pion::platform::Vocabulary::TYPE_LONG_DOUBLE, pion::platform::Vocabulary::TYPE_LONG_STRING, pion::platform::Vocabulary::TYPE_SHORT_STRING, pion::platform::Vocabulary::TYPE_STRING, pion::platform::Vocabulary::TYPE_TIME, pion::platform::Vocabulary::TYPE_UINT16, pion::platform::Vocabulary::TYPE_UINT32, pion::platform::Vocabulary::TYPE_UINT64, pion::platform::Vocabulary::TYPE_UINT8, and pion::platform::Vocabulary::TYPE_ZBLOB.

Referenced by evaluate().

std::string pion::platform::Comparison::getComparisonTypeAsString ( const ComparisonType  comparison_type  )  [static]

returns a string that represents a particular Comparison type

Parameters:
comparison_type the Comparison type to get a string for
Returns:
std::string a temporary string object that represents the Comparison type

Definition at line 358 of file Comparison.cpp.

Comparison::ComparisonType pion::platform::Comparison::parseComparisonType ( std::string  str  )  [static]

parses Comparison type from a string

Parameters:
str the string to parse
Returns:
ComparisonType the type matching the parsed string

Definition at line 344 of file Comparison.cpp.

Referenced by pion::platform::RuleChain::setConfig(), and pion::platform::TransformRules::TransformRules().

void pion::platform::Comparison::updateVocabulary ( const Vocabulary v  ) 

this updates the Vocabulary information used by this Comparison; it should be called whenever the global Vocabulary is updated

Parameters:
v the Vocabulary that this Comparison will use to describe Terms

Definition at line 339 of file Comparison.cpp.

References pion::platform::Vocabulary::refreshTerm().


The documentation for this class was generated from the following files:
Generated on Wed Apr 13 16:38:35 2011 for pion-platform by  doxygen 1.4.7