My Project
OSiLReader.cpp
Go to the documentation of this file.
1 /* $Id$ */
16 #include "OSiLReader.h"
17 
18 
19 //bison function
21 //lex functions
22 int osillex_init(void** ptr_yy_globals);
23 int osillex_destroy (void* scanner );
24 void osilset_extra (OSiLParserData* parserData , void* yyscanner );
25 
26 
28 {
29  m_osinstance = new OSInstance();
31  m_osglData = new OSgLParserData();
32  m_osnlData = new OSnLParserData();
33 
34  // initialize the lexer and set yyextra
37 }
38 
40 {
41  if(m_osinstance != NULL) delete m_osinstance;
42  m_osinstance = NULL;
43  // now delete the flex scanner that was initialized
45  if( m_parserData != NULL) delete m_parserData;
46  m_parserData = NULL;
47  if( m_osglData != NULL) delete m_osglData;
48  m_osglData = NULL;
49  if( m_osnlData != NULL) delete m_osnlData;
50  m_osnlData = NULL;
51 }
52 
53 OSInstance* OSiLReader::readOSiL(const std::string& posil)
54 {
55  try
56  {
57  const char *ch = posil.c_str();
59  return m_osinstance;
60  }
61  catch(const ErrorClass& eclass)
62  {
63  throw ErrorClass( eclass.errormsg);
64  }
65 }//end readOSiL
66 
67 
68 
69 
#define scanner
OSgLParserData * osglData
OSnLParserData * osnlData
OSoLParserData * parserData
void osilset_extra(OSiLParserData *parserData, void *yyscanner)
void yygetOSInstance(const char *osil, OSInstance *osinstance, OSiLParserData *parserData, OSgLParserData *osglData, OSnLParserData *osnlData)
int osillex_init(void **ptr_yy_globals)
int osillex_destroy(void *scanner)
used for throwing exceptions.
Definition: OSErrorClass.h:32
std::string errormsg
errormsg is the error that is causing the exception to be thrown
Definition: OSErrorClass.h:42
The in-memory representation of an OSiL instance..
Definition: OSInstance.h:2263
The OSgLParserData Class.
The OSiLParserData Class, used to store parser data.
void * scanner
scanner is used to store data in a reentrant lexer we use this to pass an OSiLParserData 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: OSiLReader.h:76
OSInstance * readOSiL(const std::string &osil)
parse the OSiL model instance.
Definition: OSiLReader.cpp:53
OSiLReader()
Default constructor.
Definition: OSiLReader.cpp:27
OSiLParserData * m_parserData
m_parserData is the object used in the parser to temporarily store data
Definition: OSiLReader.h:71
~OSiLReader()
Class destructor.
Definition: OSiLReader.cpp:39
OSnLParserData * m_osnlData
m_osnlData is the object used in the parser to temporarily store data from the OSnL schema elements.
Definition: OSiLReader.h:81
OSInstance * m_osinstance
m_osinstance is the OSInstance object returned by the OSiLReader
Definition: OSiLReader.h:67
The OSnLParserData Class.