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

- File List
- File Members

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

Go to the documentation of this file.

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