Version: 9.15.0
YACS::presettypeParser< T > Struct Template Reference

Class for PresetNode parser. More...

#include <presetParsers.hxx>

Inheritance diagram for YACS::presettypeParser< T >:
Collaboration diagram for YACS::presettypeParser< T >:

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 create ()
 
virtual void pre ()
 
virtual void name (const std::string &name)
 
virtual void kind (const std::string &kind)
 
virtual void parameter (myoutport &p)
 
- Public Member Functions inherited from YACS::nodetypeParser< ENGINE::DataNode * >
virtual void state (const std::string &name)
 
virtual void type (const std::string &name)
 
virtual void property (const myprop &prop)
 
virtual ENGINE::DataNodepost ()
 
YACS::ENGINE::InlineNodepost ()
 
- 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 _kind
 
- Public Attributes inherited from YACS::nodetypeParser< ENGINE::DataNode * >
std::string _type
 
std::string _name
 
std::string _state
 
std::string _container
 
ENGINE::DataNode_node
 
- 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 presettypeParser< T > presetParser
 
- Static Public Attributes inherited from YACS::nodetypeParser< ENGINE::DataNode * >
static nodetypeParser< ENGINE::DataNode * > nodeParser
 
- 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

template<class T = ENGINE::DataNode*>
struct YACS::presettypeParser< T >

Class for PresetNode parser.

Its XML schema is:

    <xsd:complexType name="PresetType">
      <xsd:attribute name="name" type="xsd:string" use="required"/>
      <xsd:element name="parameter" type="ParameterType"/>
    </xsd:complexType>

Definition at line 135 of file presetParsers.hxx.

Member Function Documentation

◆ buildAttr()

template<class T >
void YACS::presettypeParser< T >::buildAttr ( const XML_Char **  attr)
virtual

Reimplemented from YACS::nodetypeParser< ENGINE::DataNode * >.

Definition at line 177 of file presetParsers.hxx.

178  {
179  if (!attr)
180  return;
181  DEBTRACE("presettypeParser::buildAttr");
182  this->required("name",attr);
183  for (int i = 0; attr[i]; i += 2)
184  {
185  if(std::string(attr[i]) == "name")name(attr[i+1]);
186  if(std::string(attr[i]) == "kind")kind(attr[i+1]);
187  }
188  create();
189  }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
virtual void required(const std::string &name, const XML_Char **attr)
Definition: parserBase.cxx:186
virtual void kind(const std::string &kind)
virtual void name(const std::string &name)

References DEBTRACE, and yacsorb.CORBAEngineTest::i.

◆ create()

template<class T >
void YACS::presettypeParser< T >::create
virtual

Definition at line 210 of file presetParsers.hxx.

211 {
213 }
YACS::ENGINE::Runtime * theRuntime
Definition: parsers.cxx:40
virtual DataNode * createInDataNode(const std::string &kind, const std::string &name)
Definition: Runtime.cxx:180

References YACS::ENGINE::Runtime::createInDataNode(), and theRuntime.

◆ kind()

template<class T >
void YACS::presettypeParser< T >::kind ( const std::string &  kind)
virtual

Definition at line 204 of file presetParsers.hxx.

205 {
206  _kind=kind;
207 }

◆ name()

template<class T >
void YACS::presettypeParser< T >::name ( const std::string &  name)
virtual

Reimplemented from YACS::nodetypeParser< ENGINE::DataNode * >.

Definition at line 198 of file presetParsers.hxx.

199 {
200  _name=name;
201 }

◆ onEnd()

template<class T >
void YACS::presettypeParser< T >::onEnd ( const char *  el,
parser child 
)
virtual

Reimplemented from YACS::nodetypeParser< ENGINE::DataNode * >.

Definition at line 168 of file presetParsers.hxx.

169  {
170  DEBTRACE("presettypeParser::onEnd");
171  std::string element(el);
172  if(element == "parameter")parameter(((presetdatatypeParser*)child)->post());
173  if(element == "property")this->property(((propertytypeParser*)child)->post());
174  }
virtual void property(const myprop &prop)
virtual ENGINE::DataNode * post()
virtual void parameter(myoutport &p)

References DEBTRACE.

◆ onStart()

template<class T >
void YACS::presettypeParser< T >::onStart ( const XML_Char el,
const XML_Char **  attr 
)
virtual

Reimplemented from YACS::nodetypeParser< ENGINE::DataNode * >.

Definition at line 154 of file presetParsers.hxx.

155  {
156  DEBTRACE("presettypeParser::onStart");
157  std::string element(el);
159  if(element == "parameter")pp=&presetdatatypeParser::presetdataParser;
160  if(element == "property")pp=&propertytypeParser::propertyParser;
161  this->SetUserDataAndPush(pp);
162  pp->init();
163  pp->pre();
164  pp->buildAttr(attr);
165  }
virtual void SetUserDataAndPush(parser *pp)
Definition: parserBase.cxx:55
static parser main_parser
Definition: parserBase.hxx:41
static presetdatatypeParser presetdataParser
static propertytypeParser propertyParser

References YACS::parser::buildAttr(), DEBTRACE, YACS::parser::init(), YACS::parser::main_parser, YACS::parser::pre(), YACS::presetdatatypeParser::presetdataParser, and YACS::propertytypeParser::propertyParser.

◆ parameter()

template<class T >
void YACS::presettypeParser< T >::parameter ( myoutport p)
virtual

Definition at line 216 of file presetParsers.hxx.

217 {
218  DEBTRACE("presettypeParser::parameter");
219  if(currentProc->typeMap.count(p._type)==0)
220  {
221  //Check if the typecode is defined in the runtime
223  if(t==0)
224  {
225  std::string msg="Unknown Type: ";
226  msg=msg+p._type+" for node: "+this->_node->getName()+" port name: "+p._name;
227  this->logError(msg);
228  return;
229  }
230  else
231  {
232  currentProc->typeMap[p._type]=t;
233  t->incrRef();
234  }
235  }
236  ENGINE::OutputPort *port = this->_node->edAddOutputPort(p._name,currentProc->typeMap[p._type]);
237  this->_node->setData(port,p._props["value"]);
238 }
YACS::ENGINE::Proc * currentProc
Definition: parserBase.cxx:30
virtual void setData(InputPort *port, const std::string &data)
Definition: DataNode.cxx:29
virtual OutputPort * edAddOutputPort(const std::string &outputPortName, TypeCode *type)
const std::string & getName() const
Definition: Node.hxx:125
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
Proc * p
Definition: driver.cxx:216
void logError(const std::string &reason)
Definition: parserBase.cxx:214
std::string _name
Definition: factory.hxx:80

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

◆ pre()

template<class T >
void YACS::presettypeParser< T >::pre
virtual

Reimplemented from YACS::nodetypeParser< ENGINE::DataNode * >.

Definition at line 192 of file presetParsers.hxx.

193 {
194  _kind="";
195 }

Member Data Documentation

◆ _kind

template<class T = ENGINE::DataNode*>
std::string YACS::presettypeParser< T >::_kind

Definition at line 147 of file presetParsers.hxx.

◆ _name

template<class T = ENGINE::DataNode*>
std::string YACS::presettypeParser< T >::_name

Definition at line 146 of file presetParsers.hxx.

◆ presetParser

template<class T >
presettypeParser< T > YACS::presettypeParser< T >::presetParser
static

Definition at line 137 of file presetParsers.hxx.


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