- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/OS-2.3.5/OS/src/OSCommonInterfaces/OSiLReader.cpp

Go to the documentation of this file.

    00001 /* $Id: OSiLReader.cpp 2698 2009-06-09 04:14:07Z kmartin $ */
    00018 #include "OSiLReader.h"
    00019
    00020
    00021 //bison function
    00022 void yygetOSInstance(const char *osil, OSInstance* osinstance, OSiLParserData *parserData) throw(ErrorClass);
    00023 //lex functions
    00024 int osillex_init(void** ptr_yy_globals);
    00025 int osillex_destroy (void* scanner );
    00026 void osilset_extra (OSiLParserData* parserData , void* yyscanner );
    00027
    00028
    00029 OSiLReader::OSiLReader( ) {
    00030         m_osinstance = new OSInstance();
    00031         m_parserData = new OSiLParserData();
    00032         // initialize the lexer and set yyextra
    00033         osillex_init( &(m_parserData->scanner) );
    00034         osilset_extra (m_parserData ,   m_parserData->scanner);
    00035 }
    00036
    00037 OSiLReader::~OSiLReader(){
    00038         if(m_osinstance != NULL) delete m_osinstance;
    00039         m_osinstance = NULL;
    00040         // now delete the flex scanner that was initialized
    00041         osillex_destroy(m_parserData->scanner );
    00042         if( m_parserData != NULL) delete m_parserData;
    00043         m_parserData = NULL;
    00044 }
    00045
    00046 OSInstance* OSiLReader::readOSiL(const std::string& posil) throw(ErrorClass){
    00047         try{
    00048                 const char *ch = posil.c_str();
    00049                 yygetOSInstance( ch, m_osinstance, m_parserData);
    00050                 return m_osinstance;
    00051         }
    00052                 catch(const ErrorClass& eclass){
    00053                 throw ErrorClass( eclass.errormsg);
    00054         }
    00055 }//end readOSiL
    00056
    00057
    00058
    00059