00001 // $Id: Constraint_Interpreter.cpp 86518 2009-08-18 12:30:56Z olli $ 00002 00003 #include "ace/Monitor_Control/Constraint_Interpreter.h" 00004 00005 #if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1) 00006 00007 #include "ace/Log_Msg.h" 00008 00009 #include "ace/ETCL/ETCL_Constraint.h" 00010 00011 #include "ace/Monitor_Control/Constraint_Visitor.h" 00012 00013 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00014 00015 namespace ACE 00016 { 00017 namespace Monitor_Control 00018 { 00019 Constraint_Interpreter::Constraint_Interpreter (void) 00020 { 00021 } 00022 00023 Constraint_Interpreter::~Constraint_Interpreter (void) 00024 { 00025 } 00026 00027 int 00028 Constraint_Interpreter::build_tree (const char *constraints) 00029 { 00030 if (ETCL_Interpreter::is_empty_string (constraints)) 00031 { 00032 /// Root is deleted in the interpreter's destructor. 00033 ACE_NEW_RETURN (this->root_, 00034 ETCL_Literal_Constraint (true), 00035 -1); 00036 } 00037 else 00038 { 00039 /// root_ is set in this base class call. 00040 if (ETCL_Interpreter::build_tree (constraints) != 0) 00041 { 00042 ACE_ERROR_RETURN ((LM_ERROR, 00043 "Constraint_Interpreter::build_tree() - " 00044 "ETCL_Interpreter::build_tree() failed\n"), 00045 -1); 00046 } 00047 } 00048 00049 return 0; 00050 } 00051 00052 ACE_CDR::Boolean 00053 Constraint_Interpreter::evaluate (Constraint_Visitor &evaluator) 00054 { 00055 return evaluator.evaluate_constraint (this->root_); 00056 } 00057 } 00058 } 00059 00060 ACE_END_VERSIONED_NAMESPACE_DECL 00061 00062 #endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */