PSDL_Interpreter.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 // PSDL_Interpreter.h,v 1.2 2003/07/21 23:51:30 dhinton Exp
00003 
00004 // ========================================================================
00005 //
00006 // = LIBRARY
00007 //    orbsvcs/PSS
00008 //
00009 // = FILENAME
00010 //    PSDL_Interpreter.h
00011 //
00012 // = AUTHOR
00013 //    Priyanka Gontla <pgontla@doc.ece.uci.edu>
00014 //
00015 // ========================================================================
00016 
00017 #ifndef TAO_PSDL_INTERPRETER_H
00018 #define TAO_PSDL_INTERPRETER_H
00019 #include /**/ "ace/pre.h"
00020 
00021 #include "psdl_export.h"
00022 
00023 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00024 # pragma once
00025 #endif /* ACE_LACKS_PRAGMA_ONCE */
00026 
00027 #include "tao/orbconf.h"
00028 #include "ace/Synch.h"
00029 
00030 class TAO_PSDL_Node;
00031 
00032 class TAO_PSDL_Export TAO_PSDL_Interpreter
00033 {
00034   // = TITLE
00035   //      TAO_PSDL_Interpreter is the superclass for all PSDL interpreters.
00036   //      Its build tree method invokes the yacc parser to parse a constraint
00037   //      or preference string.
00038 protected:
00039   // = Initialization and termination methods.
00040   TAO_PSDL_Interpreter (void);
00041   // Constructor.
00042 
00043   ~TAO_PSDL_Interpreter (void);
00044   // Destructor.
00045 
00046   int build_tree (const char* constraints);
00047   // Using the Yacc generated parser, construct an expression tree
00048   // representing <nodes> from the tokens returned by it.
00049 
00050   static int is_empty_string (const char* str);
00051 
00052   TAO_PSDL_Node* root_;
00053   // The root of the expression tree, not equal to null if build_tree
00054   // successfully builds a tree from the constraints.
00055 private:
00056   static TAO_SYNCH_MUTEX parserMutex__;
00057   // This mutex protects the <build_tree> method from reentrance.
00058 };
00059 
00060 
00061 // Functions we need for parsing.
00062 extern int TAO_PSDL_yyparse (void *);
00063 extern void yyrestart (FILE*);
00064 extern int yylex (TAO_PSDL_Node **, void *);
00065 
00066 // Have yylex read from the node string, not from stdin.
00067 //#undef YY_INPUT
00068 //#define YY_INPUT(b, r, ms) (r = TAO_Lex_String_Input::copy_into(b, ms))
00069 
00070 class TAO_Lex_String_Input
00071 {
00072   // = TITLE
00073   //   Have Lex read from a string and not from stdin. Essentially,
00074   //   the interpreter needs to call yylex() until EOF, and call
00075   //   TAO_Lex_String_Input::reset() with the new string, prior to
00076   //   calling yyparse.
00077 public:
00078   static void reset (char* input_string);
00079   // Reset the lex input.
00080 
00081   static int copy_into (char* buf, int max_size);
00082   // Method lex will call to read from the input string.
00083 
00084 private:
00085 
00086   static char* string_;
00087   static char* current_;
00088   static char* end_;
00089   // Pointers to keep track of the input string.
00090 };
00091 
00092 // The union used by lex and bison to build the Abstract Syntax Tree.
00093 #define YYSTYPE TAO_PSDL_Node *
00094 
00095 extern YYSTYPE yylval;
00096 extern YYSTYPE yyval;
00097 
00098 #include /**/ "ace/post.h"
00099 #endif /* TAO_PSDL_INTERPRETER_H */

Generated on Thu Nov 9 14:07:02 2006 for TAO_PSS by doxygen 1.3.6