Version: 9.15.0
YACS::objtypeParser Struct Reference

Class for objref parser. More...

#include <typeParsers.hxx>

Inheritance diagram for YACS::objtypeParser:
Collaboration diagram for YACS::objtypeParser:

Public Member Functions

virtual void onStart (const XML_Char *el, const XML_Char **attr)
 
virtual void onEnd (const char *el, parser *child)
 
virtual void buildAttr (const XML_Char **attr)
 
virtual void pre ()
 
virtual void name (const std::string &name)
 
virtual void id (const std::string &name)
 
virtual void base (const std::string &name)
 
virtual YACS::ENGINE::TypeCodepost ()
 
- Public Member Functions inherited from YACS::parser
 parser ()
 
virtual ~parser ()
 
virtual void SetUserDataAndPush (parser *pp)
 
virtual void charData (const XML_Char *s, int len)
 
virtual void endParser ()
 
virtual void init ()
 
virtual void incrCount (const XML_Char *elem)
 
virtual void checkOrder (std::string &el)
 
virtual void maxcount (std::string name, int max, std::string &el)
 
virtual void mincount (std::string name, int min)
 
virtual void maxchoice (std::string *names, int max, std::string &el)
 
virtual void minchoice (std::string *names, int min)
 
virtual void required (const std::string &name, const XML_Char **attr)
 
std::stack< parser * > & getStack ()
 
template<class T >
post ()
 
void logError (const std::string &reason)
 

Public Attributes

std::string _name
 
std::string _id
 
std::list< YACS::ENGINE::TypeCodeObjref * > _ltc
 
- Public Attributes inherited from YACS::parser
std::string _file
 
std::string _content
 
std::map< std::string, int > * _counts
 
std::map< std::string, int > _orders
 
int _orderState
 
int _level
 
std::stack< std::map< std::string, int > * > _stackCount
 
std::stack< int > _stackOrder
 
std::map< std::string, parser * > * _defaultParsersMap
 

Static Public Attributes

static objtypeParser objParser
 
- Static Public Attributes inherited from YACS::parser
static parser main_parser
 
static std::stack< parser * > _stackParser
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::parser
static void XMLCALL start_document (void *data)
 
static void XMLCALL end_document (void *data)
 
static void XMLCALL start_element (void *data, const xmlChar *name, const xmlChar **p)
 
static void XMLCALL end_element (void *data, const xmlChar *name)
 
static void XMLCALL characters (void *data, const xmlChar *ch, int len)
 
static void XMLCALL comment (void *data, const xmlChar *value)
 
static void XMLCALL cdata_block (void *data, const xmlChar *value, int len)
 
static void XMLCALL warning (void *data, const char *fmt,...)
 
static void XMLCALL error (void *data, const char *fmt,...)
 
static void XMLCALL fatal_error (void *data, const char *fmt,...)
 
static void XML_SetUserData (_xmlParserCtxt *ctxt, parser *par)
 

Detailed Description

Class for objref parser.

Class used to parse a objref (type) definition (class TypeCodeObjref in implementation)

XML schema is

  <xsd:complexType name="ObjrefType">
    <xsd:sequence>
      <xsd:element name="base" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
    <xsd:attribute name="name" type="xsd:string" use="required"/>
    <xsd:attribute name="id" type="xsd:string" />
  </xsd:complexType>

Definition at line 98 of file typeParsers.hxx.

Member Function Documentation

◆ base()

void YACS::objtypeParser::base ( const std::string &  name)
virtual

Definition at line 176 of file typeParsers.cxx.

177  {
178  DEBTRACE( "base_name: " << name )
179  if(currentProc->typeMap.count(name)==0)
180  {
181  //Check if the typecode is defined in the runtime
183  if(t==0)
184  {
185  std::stringstream msg;
186  msg << "Type " << name << " does not exist" << " (" <<__FILE__ << ":" << __LINE__ << ")";
187  throw Exception(msg.str());
188  }
189  else
190  {
192  t->incrRef();
193  }
194  }
195  if(currentProc->typeMap[name]->kind() != ENGINE::Objref)
196  {
197  std::stringstream msg;
198  msg << "Type " << name << " is not an objref" ;
199  msg << " (" <<__FILE__ << ":" << __LINE__ << ")";
200  throw Exception(msg.str());
201  }
202  _ltc.push_back((ENGINE::TypeCodeObjref *)currentProc->typeMap[name]);
203  }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
std::map< std::string, TypeCode * > typeMap
Definition: Proc.hxx:90
virtual TypeCode * getTypeCode(const std::string &name)
Get a typecode by its name from runtime catalogs.
Definition: Runtime.cxx:333
Base class for all type objects.
Definition: TypeCode.hxx:68
virtual void name(const std::string &name)
std::list< YACS::ENGINE::TypeCodeObjref * > _ltc
YACS::ENGINE::Runtime * theRuntime
Definition: parsers.cxx:40
YACS::ENGINE::Proc * currentProc
Definition: parserBase.cxx:30

References _ltc, currentProc, DEBTRACE, YACS::ENGINE::Runtime::getTypeCode(), name(), YACS::ENGINE::Objref, gui.Appli::t, theRuntime, and YACS::ENGINE::Proc::typeMap.

Referenced by onEnd().

◆ buildAttr()

void YACS::objtypeParser::buildAttr ( const XML_Char **  attr)
virtual

Reimplemented from YACS::parser.

Definition at line 150 of file typeParsers.cxx.

151  {
152  if (!attr)
153  return;
154  required("name",attr);
155  for (int i = 0; attr[i]; i += 2)
156  {
157  if(std::string(attr[i]) == "name")name(attr[i+1]);
158  if(std::string(attr[i]) == "id")id(attr[i+1]);
159  }
160  }
virtual void id(const std::string &name)
virtual void required(const std::string &name, const XML_Char **attr)
Definition: parserBase.cxx:186

References yacsorb.CORBAEngineTest::i, id(), name(), and YACS::parser::required().

◆ id()

void YACS::objtypeParser::id ( const std::string &  name)
virtual

Definition at line 171 of file typeParsers.cxx.

172  {
173  DEBTRACE( "objtype_id: " << name )
174  _id=name;
175  }

References _id, DEBTRACE, and name().

Referenced by buildAttr().

◆ name()

void YACS::objtypeParser::name ( const std::string &  name)
virtual

Definition at line 166 of file typeParsers.cxx.

167  {
168  DEBTRACE( "objtype_name: " << name )
169  _name=name;
170  }

References _name, and DEBTRACE.

Referenced by base(), buildAttr(), and id().

◆ onEnd()

void YACS::objtypeParser::onEnd ( const char *  el,
parser child 
)
virtual

Reimplemented from YACS::parser.

Definition at line 144 of file typeParsers.cxx.

145  {
146  DEBTRACE( "objtypeParser::onEnd: " << el )
147  std::string element(el);
148  if(element == "base")base(((stringtypeParser*)child)->post());
149  }
virtual void base(const std::string &name)
virtual YACS::ENGINE::TypeCode * post()

References base(), DEBTRACE, and post().

◆ onStart()

void YACS::objtypeParser::onStart ( const XML_Char el,
const XML_Char **  attr 
)
virtual

Reimplemented from YACS::parser.

Definition at line 133 of file typeParsers.cxx.

134  {
135  DEBTRACE( "objtypeParser::onStart: " << el )
136  std::string element(el);
138  if(element == "base")pp=&stringtypeParser::stringParser;
139  SetUserDataAndPush(pp);
140  pp->init();
141  pp->pre();
142  pp->buildAttr(attr);
143  }
virtual void SetUserDataAndPush(parser *pp)
Definition: parserBase.cxx:55
static parser main_parser
Definition: parserBase.hxx:41
static stringtypeParser stringParser
Definition: dataParsers.hxx:33

References YACS::parser::buildAttr(), DEBTRACE, YACS::parser::init(), YACS::parser::main_parser, YACS::parser::pre(), YACS::parser::SetUserDataAndPush(), and YACS::stringtypeParser::stringParser.

◆ post()

ENGINE::TypeCode * YACS::objtypeParser::post ( )
virtual

Definition at line 204 of file typeParsers.cxx.

205  {
206  DEBTRACE( "objtype_post" )
207  ENGINE::TypeCode *t = currentProc->createInterfaceTc(_id,_name,_ltc);
208  return t;
209  }

References _id, _ltc, _name, YACS::ENGINE::Proc::createInterfaceTc(), currentProc, DEBTRACE, and gui.Appli::t.

Referenced by onEnd().

◆ pre()

void YACS::objtypeParser::pre ( )
virtual

Reimplemented from YACS::parser.

Definition at line 161 of file typeParsers.cxx.

162  {
163  _id="";
164  _ltc.clear();
165  }

References _id, and _ltc.

Member Data Documentation

◆ _id

std::string YACS::objtypeParser::_id

Definition at line 110 of file typeParsers.hxx.

Referenced by id(), post(), and pre().

◆ _ltc

std::list<YACS::ENGINE::TypeCodeObjref *> YACS::objtypeParser::_ltc

Definition at line 111 of file typeParsers.hxx.

Referenced by base(), post(), and pre().

◆ _name

std::string YACS::objtypeParser::_name

Definition at line 109 of file typeParsers.hxx.

Referenced by name(), and post().

◆ objParser

objtypeParser YACS::objtypeParser::objParser
static

Definition at line 100 of file typeParsers.hxx.

Referenced by YACS::proctypeParser< T >::onStart().


The documentation for this struct was generated from the following files: