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

Go to the documentation of this file.
00001 /* $Id: OSiLReader.cpp 4292 2011-09-21 05:47:18Z kmartin $ */
00016 #include "OSiLReader.h"
00017 
00018 
00019 //bison function
00020 void yygetOSInstance(const char *osil, OSInstance* osinstance, OSiLParserData *parserData) throw(ErrorClass);
00021 //lex functions
00022 int osillex_init(void** ptr_yy_globals);
00023 int osillex_destroy (void* scanner );
00024 void osilset_extra (OSiLParserData* parserData , void* yyscanner );
00025 
00026 
00027 OSiLReader::OSiLReader( )
00028 {
00029     m_osinstance = new OSInstance();
00030     m_parserData = new OSiLParserData();
00031     // initialize the lexer and set yyextra
00032     osillex_init( &(m_parserData->scanner) );
00033     osilset_extra (m_parserData ,   m_parserData->scanner);
00034 }
00035 
00036 OSiLReader::~OSiLReader()
00037 {
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 {
00048     try
00049     {
00050         const char *ch = posil.c_str();
00051         yygetOSInstance( ch, m_osinstance, m_parserData);
00052         return m_osinstance;
00053     }
00054     catch(const ErrorClass& eclass)
00055     {
00056         throw ErrorClass( eclass.errormsg);
00057     }
00058 }//end readOSiL
00059 
00060 
00061 
00062 

Generated on Thu Sep 22 03:06:00 2011 by  doxygen 1.4.7