"ETCL" Interpreter for the Notify queries. More...
#include <Notify_Constraint_Interpreter.h>
Public Member Functions | |
TAO_Notify_Constraint_Interpreter (void) | |
virtual | ~TAO_Notify_Constraint_Interpreter (void) |
Destructor. | |
void | build_tree (const CosNotifyFilter::ConstraintExp &exp) |
CORBA::Boolean | evaluate (TAO_Notify_Constraint_Visitor &evaluator) |
Private Member Functions | |
void | build_tree (const char *constraints) |
"ETCL" Interpreter for the Notify queries.
Definition at line 38 of file Notify_Constraint_Interpreter.h.
TAO_Notify_Constraint_Interpreter::TAO_Notify_Constraint_Interpreter | ( | void | ) |
Definition at line 14 of file Notify_Constraint_Interpreter.cpp.
{ }
TAO_Notify_Constraint_Interpreter::~TAO_Notify_Constraint_Interpreter | ( | void | ) | [virtual] |
void TAO_Notify_Constraint_Interpreter::build_tree | ( | const CosNotifyFilter::ConstraintExp & | exp | ) |
This method builds an expression tree representing the constraint specified in constraints, and throws an Illegal Constraint exception if the constraint given has syntax errors or semantic errors, such as mismatched types.
Definition at line 44 of file Notify_Constraint_Interpreter.cpp.
{ ACE_CString exp_str; ACE_CString et_exp; CORBA::ULong const len = exp.event_types.length (); bool has_et_exp = false; for (CORBA::ULong ii = 0; ii < len; ++ii) { TAO_Notify_EventType et; bool const d = et.domain_is_wildcard (exp.event_types [ii].domain_name.in ()); bool const t = et.type_is_wildcard (exp.event_types [ii].type_name.in ()); if (d && t) { exp_str = ""; break; } if (has_et_exp) et_exp += " or "; et_exp += "("; has_et_exp = has_et_exp || 1; if (! d) { et_exp += "$domain_name=='"; et_exp += exp.event_types [ii].domain_name.in (); et_exp += "'"; } if (! t) { if (!d) et_exp += " and "; et_exp += "$type_name=='"; et_exp += exp.event_types [ii].type_name.in (); et_exp += "'"; } et_exp += ")"; } bool const valid_constraint = !ETCL_Interpreter::is_empty_string (exp.constraint_expr.in ()); if (has_et_exp && valid_constraint) { exp_str = "(("; exp_str += et_exp; exp_str += ") and ("; exp_str += exp.constraint_expr.in (); exp_str += "))"; } else if (has_et_exp) exp_str = et_exp; else if (valid_constraint) exp_str = exp.constraint_expr.in (); if (TAO_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Constraint: %C\n"), exp_str.c_str ())); } this->build_tree (exp_str.c_str ()); }
void TAO_Notify_Constraint_Interpreter::build_tree | ( | const char * | constraints | ) | [private] |
Reimplemented from ETCL_Interpreter.
Definition at line 23 of file Notify_Constraint_Interpreter.cpp.
{ if (ETCL_Interpreter::is_empty_string (constraints)) { // Root is deleted in the TAO_Interpreter's destructor. ACE_NEW_THROW_EX (this->root_, ETCL_Literal_Constraint (true), CORBA::NO_MEMORY ()); } else { // root_ is set in this base class call. if (ETCL_Interpreter::build_tree (constraints) != 0) { throw CosNotifyFilter::InvalidConstraint (); } } }
CORBA::Boolean TAO_Notify_Constraint_Interpreter::evaluate | ( | TAO_Notify_Constraint_Visitor & | evaluator | ) |
Returns true if the constraint is evaluated successfully by the evaluator.
Definition at line 116 of file Notify_Constraint_Interpreter.cpp.
{ return evaluator.evaluate_constraint (this->root_); }