OSoLReader.cpp
Go to the documentation of this file.
1 /* $Id: OSoLReader.cpp 4820 2014-07-09 14:17:48Z Gassmann $ */
17 #ifndef NDEBUG
18 #include <cstdio>
19 #endif
20 
21 #include "OSoLReader.h"
22 #include "OSOutput.h"
23 
24 
25 //bison function
27 //lex functions
28 int osollex_init(void** ptr_yy_globals);
29 int osollex_destroy (void* scanner );
30 void osolset_extra (OSoLParserData* parserData , void* yyscanner );
31 
32 
34 {
35 #ifndef NDEBUG
37 #endif
38  m_osoption = new OSOption();
39 #ifndef NDEBUG
40  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSoL_parser, ENUM_OUTPUT_LEVEL_trace, "new OSoLParserData()");
41 #endif
43 #ifndef NDEBUG
44  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSoL_parser, ENUM_OUTPUT_LEVEL_trace, "new OSgLParserData()");
45 #endif
46  m_osglData = new OSgLParserData();
47 #ifndef NDEBUG
48  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSoL_parser, ENUM_OUTPUT_LEVEL_trace, "new OSnLParserData()");
49 #endif
50  m_osnlData = new OSnLParserData();
51  // initialize the lexer and set yyextra
52 #ifndef NDEBUG
53  osoutput->OSPrint(ENUM_OUTPUT_AREA_OSoL_parser, ENUM_OUTPUT_LEVEL_trace, "initialize the lexer");
54 #endif
57 #ifndef NDEBUG
59 #endif
60 }
61 
63 {
64  if(m_osoption != NULL) delete m_osoption;
65  m_osoption = NULL;
66  // now delete the flex scanner that was initialized
68  if( m_parserData != NULL) delete m_parserData;
69  m_parserData = NULL;
70  if( m_osglData != NULL) delete m_osglData;
71  m_osglData = NULL;
72  if( m_osnlData != NULL) delete m_osnlData;
73  m_osnlData = NULL;
74 }
75 
76 OSOption* OSoLReader::readOSoL(const std::string& posol) throw(ErrorClass)
77 {
78  if (posol.length() > 0)
79  {
80  const char *ch = posol.c_str();
81  yygetOSOption( ch, m_osoption, m_parserData, m_osglData, m_osnlData);
82  }
83  return m_osoption;
84 }//end readOSoL
85 
86 
87 
88 
~OSoLReader()
Class destructor.
Definition: OSoLReader.cpp:62
const OSSmartPtr< OSOutput > osoutput
Definition: OSOutput.cpp:39
void yygetOSOption(const char *osil, OSOption *osoption, OSoLParserData *parserData, OSgLParserData *osglData, OSnLParserData *osnlData)
#define scanner
int osollex_init(void **ptr_yy_globals)
OSOption * osoption
int osollex_destroy(void *scanner)
OSnLParserData * m_osnlData
m_osnlData is the object used in the parser to temporarily store data from the OSnL schema elements...
Definition: OSoLReader.h:80
OSnLParserData * osnlData
OSgLParserData * osglData
OSiLParserData * parserData
The Option Class.
Definition: OSOption.h:3564
void osolset_extra(OSoLParserData *parserData, void *yyscanner)
void * scanner
scanner is used to store data in a reentrant lexer we use this to pass an OSoLParserData object to th...
OSgLParserData * m_osglData
m_osglData is the object used in the parser to temporarily store data from the OSgL schema elements...
Definition: OSoLReader.h:75
OSoLReader()
Default constructor.
Definition: OSoLReader.cpp:33
OSOption * readOSoL(const std::string &osol)
parse the OSoL solver options.
Definition: OSoLReader.cpp:76
OSoLParserData * m_parserData
m_parserData is the object used in the parser to temporarily store data
Definition: OSoLReader.h:70
OSOption * m_osoption
m_osoption is the OSOption object returned by the OSoLReader
Definition: OSoLReader.h:66
The OSgLParserData Class.
used for throwing exceptions.
Definition: OSErrorClass.h:31
The OSnLParserData Class.
The OSoLParserData Class.