Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Private Attributes

ETCL_Interpreter Class Reference

ETCL_Interpreter is the superclass for all ETCL interpreters. Its build tree method invokes the yacc parser to parse a constraint or preference string. More...

#include <ETCL_Interpreter.h>

Collaboration diagram for ETCL_Interpreter:
Collaboration graph
[legend]

List of all members.

Protected Member Functions

 ETCL_Interpreter (void)
 Constructor.
virtual ~ETCL_Interpreter (void)
 Destructor.
int build_tree (const char *constraints)

Static Protected Member Functions

static int is_empty_string (const char *str)

Protected Attributes

ETCL_Constraintroot_

Static Private Attributes

static ACE_SYNCH_MUTEX parserMutex__
 This mutex protects the <build_tree> method from reentrance.

Detailed Description

ETCL_Interpreter is the superclass for all ETCL interpreters. Its build tree method invokes the yacc parser to parse a constraint or preference string.

Definition at line 45 of file ETCL_Interpreter.h.


Constructor & Destructor Documentation

ETCL_Interpreter::ETCL_Interpreter ( void   )  [protected]

Constructor.

Definition at line 14 of file ETCL_Interpreter.cpp.

  : root_ (0)
{
}

ETCL_Interpreter::~ETCL_Interpreter ( void   )  [protected, virtual]

Destructor.

Definition at line 19 of file ETCL_Interpreter.cpp.

{
  delete this->root_;
}


Member Function Documentation

int ETCL_Interpreter::build_tree ( const char *  constraints  )  [protected]

Using the Yacc generated parser, construct an expression tree representing constraints from the tokens returned by it.

Definition at line 25 of file ETCL_Interpreter.cpp.

{
  ACE_GUARD_RETURN (ACE_SYNCH_MUTEX,
                    guard,
                    ETCL_Interpreter::parserMutex__,
                    -1);

  Lex_String_Input::reset ((char*)constraints);

  yyval.constraint = 0;
  int return_value = ::yyparse ();

  if (return_value == 0 && yyval.constraint != 0)
    {
      this->root_ = yyval.constraint;
    }
  else
    {
      this->root_ = 0;
    }

  return return_value;
}

int ETCL_Interpreter::is_empty_string ( const char *  str  )  [static, protected]

Definition at line 50 of file ETCL_Interpreter.cpp.

{
  int return_value = 0;

  if (str != 0)
    {
      int i = 0;

      while (str[i] != '\0')
        {
          if (str[i] != ' ')
            {
              break;
            }

          ++i;
        }

      if (str[i] == '\0')
        {
          return_value = 1;
        }
    }

  return return_value;
}


Member Data Documentation

ETCL_Parser_Export ACE_SYNCH_MUTEX ETCL_Interpreter::parserMutex__ [static, private]

This mutex protects the <build_tree> method from reentrance.

Definition at line 66 of file ETCL_Interpreter.h.

The root of the expression tree, not equal to null if build_tree successfully builds a tree from the constraints.

Definition at line 63 of file ETCL_Interpreter.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines