#include <Interpreter.h>
Inheritance diagram for TAO_Interpreter:
Protected Member Functions | |
TAO_Interpreter (void) | |
Constructor. | |
~TAO_Interpreter (void) | |
Destructor. | |
int | build_tree (const char *preferences) |
Static Protected Member Functions | |
static int | is_empty_string (const char *str) |
Protected Attributes | |
TAO_Constraint * | root_ |
Static Private Attributes | |
static TAO_SYNCH_MUTEX | parserMutex__ |
This mutex protects the <build_tree> method from reentrance. |
Definition at line 33 of file Interpreter.h.
TAO_Interpreter::TAO_Interpreter | ( | void | ) | [protected] |
TAO_Interpreter::~TAO_Interpreter | ( | void | ) | [protected] |
Destructor.
Definition at line 15 of file Interpreter.cpp.
References root_.
00016 { 00017 delete root_; 00018 }
int TAO_Interpreter::build_tree | ( | const char * | preferences | ) | [protected] |
Using the Yacc generated parser, construct an expression tree representing <constraints> from the tokens returned by it.
Definition at line 21 of file Interpreter.cpp.
References ACE_GUARD_RETURN, YYSTYPE::constraint_, parserMutex__, TAO_Lex_String_Input::reset(), root_, TAO_SYNCH_MUTEX, yylex(), yyparse(), and yyval.
00022 { 00023 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, 00024 guard, 00025 TAO_Interpreter::parserMutex__, 00026 -1); 00027 00028 TAO_Lex_String_Input::reset ((char*)constraints); 00029 int return_value = 0; 00030 00031 yyval.constraint_ = 0; 00032 return_value = ::yyparse (); 00033 00034 if (return_value == 0 && yyval.constraint_ != 0) 00035 this->root_ = yyval.constraint_; 00036 else 00037 { 00038 while (yylex () > 0) 00039 continue; 00040 this->root_ = 0; 00041 } 00042 00043 return return_value; 00044 }
int TAO_Interpreter::is_empty_string | ( | const char * | str | ) | [static, protected] |
Definition at line 47 of file Interpreter.cpp.
Referenced by TAO_Constraint_Interpreter::TAO_Constraint_Interpreter(), and TAO_Preference_Interpreter::TAO_Preference_Interpreter().
00048 { 00049 int return_value = 0; 00050 00051 if (str != 0) 00052 { 00053 int i = 0; 00054 while (str[i] != '\0') 00055 { 00056 if (str[i] != ' ') 00057 break; 00058 00059 i++; 00060 } 00061 00062 if (str[i] == '\0') 00063 return_value = 1; 00064 } 00065 00066 return return_value; 00067 }
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_SYNCH_MUTEX TAO_Interpreter::parserMutex__ [static, private] |
This mutex protects the <build_tree> method from reentrance.
Definition at line 54 of file Interpreter.h.
Referenced by build_tree().
TAO_Constraint* TAO_Interpreter::root_ [protected] |
The root of the expression tree, not equal to null if build_tree successfully builds a tree from the constraints.
Definition at line 51 of file Interpreter.h.
Referenced by build_tree(), and ~TAO_Interpreter().