/home/coin/SVN-release/OS-2.2.0/OS/src/OSCommonInterfaces/OSrLReader.cpp

Go to the documentation of this file.
00001 /* $Id: OSrLReader.cpp 2698 2009-06-09 04:14:07Z kmartin $ */
00017 //#define OSRLREADER_DEBUG
00018 
00019 #include "OSrLReader.h"
00020 
00021 
00022 
00023 
00024 void yygetOSResult( const char *ch, OSResult* m_osresult, OSrLParserData *m_parserData) throw(ErrorClass);
00025 int osrllex_init(void** ptr_yy_globals);
00026 int osrllex_destroy (void* scanner );
00027 void osrlset_extra (OSrLParserData* parserData , void* yyscanner );
00028 
00029 
00030 OSrLReader::OSrLReader( )  {    
00031 #ifdef OSRLREADER_DEBUG
00032         std::cout << "new OSrLParserData()" << std::endl;
00033 #endif
00034         m_parserData = new OSrLParserData();
00035 #ifdef OSRLREADER_DEBUG
00036         std::cout << "new OSResult()" << std::endl;
00037 #endif
00038         m_osresult = new OSResult(); 
00039         // initialize the lexer and set yyextra
00040 #ifdef OSRLREADER_DEBUG
00041         std::cout << "initialize the lexer" << std::endl;
00042 #endif
00043         osrllex_init( &(m_parserData->scanner) );
00044         osrlset_extra (m_parserData ,   m_parserData->scanner);                                         
00045 #ifdef OSRLREADER_DEBUG
00046         std::cout << "done" << std::endl;
00047 #endif
00048 }
00049 
00050 OSrLReader::~OSrLReader(){
00051         // delete the osresult object
00052 #ifdef OSRLREADER_DEBUG
00053         std::cout << "delete m_osresult" << std::endl;
00054 #endif
00055         if(m_osresult != NULL) delete m_osresult;
00056         m_osresult = NULL;
00057 
00058         // now delete the scanner that was initialized
00059 #ifdef OSRLREADER_DEBUG
00060         std::cout << "delete scanner" << std::endl;
00061 #endif
00062         osrllex_destroy(m_parserData->scanner );
00063 
00064         // findally delete parser data
00065 #ifdef OSRLREADER_DEBUG
00066         std::cout << "delete parser data" << std::endl;
00067 #endif
00068         if( m_parserData != NULL) delete m_parserData;
00069         m_parserData = NULL;
00070         
00071 #ifdef OSRLREADER_DEBUG
00072         std::cout << "success!" << std::endl;
00073 #endif
00074 } 
00075 
00076 OSResult* OSrLReader::readOSrL(const std::string& posrl) throw(ErrorClass){     
00077         try{
00078                 const char *ch = posrl.c_str();
00079                 yygetOSResult( ch, m_osresult, m_parserData);
00080                 return m_osresult;
00081         }
00082                 catch(const ErrorClass& eclass){
00083                 throw ErrorClass( eclass.errormsg); 
00084         }
00085 }

Generated on Thu Aug 5 03:03:00 2010 by  doxygen 1.4.7