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

#include <serviceParsers.hxx>

Inheritance diagram for YACS::servicetypeParser< T >:
Collaboration diagram for YACS::servicetypeParser< 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 ref (const std::string &name)
 
virtual void componentinstance (const std::string &name)
 
virtual void component (const std::string &name)
 
virtual void node (const std::string &name)
 
virtual void method (const std::string &name)
 
virtual void load (const loadon &l)
 
virtual void instream (const myinport &p)
 
virtual void outstream (const myoutport &p)
 
virtual T post ()
 
- Public Member Functions inherited from YACS::inlinetypeParser< YACS::ENGINE::ServiceNode * >
virtual void buildAttr (const XML_Char **attr)
 
virtual void pre ()
 
virtual void weight (const double &x)
 
virtual void kind (const std::string &name)
 
virtual void script (const myfunc &f)
 
void script (const myfunc &f)
 
virtual void function (const myfunc &f)
 
void function (const myfunc &f)
 
void function (const myfunc &f)
 
virtual void inport (const myinport &p)
 
virtual void outport (const myoutport &p)
 
- Public Member Functions inherited from YACS::nodetypeParser< T >
virtual void name (const std::string &name)
 
virtual void state (const std::string &name)
 
virtual void type (const std::string &name)
 
virtual void property (const myprop &prop)
 
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)
 

Static Public Attributes

static servicetypeParser< T > serviceParser
 
- Static Public Attributes inherited from YACS::inlinetypeParser< YACS::ENGINE::ServiceNode * >
static inlinetypeParser< YACS::ENGINE::ServiceNode * > inlineParser
 
- Static Public Attributes inherited from YACS::nodetypeParser< T >
static nodetypeParser< T > 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)
 
- Public Attributes inherited from YACS::inlinetypeParser< YACS::ENGINE::ServiceNode * >
std::string _kind
 
double _weight
 
- Public Attributes inherited from YACS::nodetypeParser< T >
std::string _type
 
std::string _name
 
std::string _state
 
std::string _container
 
_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
 

Detailed Description

template<class T = YACS::ENGINE::ServiceNode*>
struct YACS::servicetypeParser< T >

Definition at line 52 of file serviceParsers.hxx.

Member Function Documentation

◆ component()

template<class T = YACS::ENGINE::ServiceNode*>
virtual void YACS::servicetypeParser< T >::component ( const std::string &  name)
inlinevirtual

Definition at line 91 of file serviceParsers.hxx.

92  {
93  DEBTRACE( "service_component: " << name )
94  this->_node=theRuntime->createCompoNode(this->_kind,this->_name);
96  this->_node->setComponent(inst);
97  inst->decrRef();
98  }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
Base class for all component instances.
virtual ComponentInstance * createComponentInstance(const std::string &componame, const std::string &name="", const std::string &kind="")
Create a new ComponentInstance and add it into componentInstanceMap.
Definition: Proc.cxx:599
virtual ServiceNode * createCompoNode(const std::string &kind, const std::string &name)
Definition: Runtime.cxx:205
YACS::ENGINE::Runtime * theRuntime
Definition: parsers.cxx:40
YACS::ENGINE::Proc * currentProc
Definition: parserBase.cxx:30
virtual void name(const std::string &name)
Definition: nodeParsers.hxx:90

References YACS::inlinetypeParser< YACS::ENGINE::ServiceNode * >::_kind, YACS::nodetypeParser< T >::_name, YACS::nodetypeParser< T >::_node, YACS::ENGINE::Proc::createComponentInstance(), YACS::ENGINE::Runtime::createCompoNode(), currentProc, DEBTRACE, YACS::ENGINE::RefCounter::decrRef(), and YACS::nodetypeParser< T >::name().

Referenced by YACS::servicetypeParser< T >::onEnd().

◆ componentinstance()

template<class T = YACS::ENGINE::ServiceNode*>
virtual void YACS::servicetypeParser< T >::componentinstance ( const std::string &  name)
inlinevirtual

◆ instream()

template<class T = YACS::ENGINE::ServiceNode*>
virtual void YACS::servicetypeParser< T >::instream ( const myinport p)
inlinevirtual

Definition at line 141 of file serviceParsers.hxx.

142  {
143  DEBTRACE( "service_instream" )
144  DEBTRACE( p._type )
145  DEBTRACE( p._name )
146  if(this->_node==0)
147  throw YACS::Exception("ServiceNode must be completely defined before defining its ports");
148 
149  if(currentProc->typeMap.count(p._type)==0)
150  {
152  if(t==0)
153  {
154  std::string msg="Unknown InStreamPort Type: ";
155  msg=msg+p._type+" for node: "+this->_node->getName()+" port name: "+p._name;
156  throw YACS::Exception(msg);
157  }
158  else
159  {
160  currentProc->typeMap[p._type]=t;
161  t->incrRef();
162  }
163  }
165  port=this->_node->edAddInputDataStreamPort(p._name,currentProc->typeMap[p._type]);
166  // Set all properties for this port
167  std::map<std::string, std::string>::const_iterator pt;
168  for(pt=p._props.begin();pt!=p._props.end();pt++)
169  port->setProperty((*pt).first,(*pt).second);
170  }
virtual void setProperty(const std::string &name, const std::string &value)
Set a new value for a property of the port.
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
std::string _name
Definition: factory.hxx:80

References myinport::_name, YACS::nodetypeParser< T >::_node, currentProc, DEBTRACE, YACS::ENGINE::Runtime::getTypeCode(), p, YACS::ENGINE::DataStreamPort::setProperty(), gui.Appli::t, theRuntime, and YACS::ENGINE::Proc::typeMap.

Referenced by YACS::servicetypeParser< T >::onEnd().

◆ load()

template<class T = YACS::ENGINE::ServiceNode*>
virtual void YACS::servicetypeParser< T >::load ( const loadon l)
inlinevirtual

Definition at line 135 of file serviceParsers.hxx.

136  {
137  DEBTRACE( "service_load: " << l._container);
138  this->_container=l._container;
139  }
std::string _container
std::string _container
Definition: factory.hxx:122

References loadon::_container, YACS::nodetypeParser< T >::_container, DEBTRACE, and testCppPluginInvokation::l.

Referenced by YACS::servicetypeParser< T >::onEnd().

◆ method()

template<class T = YACS::ENGINE::ServiceNode*>
virtual void YACS::servicetypeParser< T >::method ( const std::string &  name)
inlinevirtual

Definition at line 122 of file serviceParsers.hxx.

123  {
124  DEBTRACE( "service_method: " << name )
125  if(this->_node==0)
126  throw YACS::Exception("ServiceNode must be completely defined before defining its method");
127  if(name == "")
128  {
129  this->logError("a service name must be a non empty string");
130  return;
131  }
132  this->_node->setMethod(name);
133  }
void logError(const std::string &reason)
Definition: parserBase.cxx:214

References YACS::nodetypeParser< T >::_node, DEBTRACE, YACS::parser::logError(), and YACS::nodetypeParser< T >::name().

Referenced by YACS::servicetypeParser< T >::onEnd().

◆ node()

template<class T = YACS::ENGINE::ServiceNode*>
virtual void YACS::servicetypeParser< T >::node ( const std::string &  name)
inlinevirtual

Definition at line 99 of file serviceParsers.hxx.

100  {
101  DEBTRACE( "service_node: " << name )
102  std::string fullname = currentProc->names.back()+name;
103  if(currentProc->serviceMap.count(name) != 0)
104  {
105  //ServiceNode with absolute name found
107  this->_node =n->createNode(this->_name);
108  }
109  else if(currentProc->serviceMap.count(fullname) != 0)
110  {
111  //ServiceNode with relative name found
112  //TODO: must be a short name (possible only in the same context)
114  this->_node =n->createNode(this->_name);
115  }
116  else
117  {
118  throw YACS::Exception("Unknown ServiceNode");
119  }
120  }
std::map< std::string, ServiceNode * > serviceMap
Definition: Proc.hxx:88
std::vector< std::string > names
Definition: Proc.hxx:93
Class for calculation node associated with a component service.
Definition: ServiceNode.hxx:35
virtual ServiceNode * createNode(const std::string &name)=0

References YACS::nodetypeParser< T >::_name, YACS::nodetypeParser< T >::_node, YACS::ENGINE::ServiceNode::createNode(), currentProc, DEBTRACE, gui.Appli::n, YACS::nodetypeParser< T >::name(), YACS::ENGINE::Proc::names, and YACS::ENGINE::Proc::serviceMap.

Referenced by gui.cataitems.ItemNode::addNode(), gui.cataitems.ItemComposedNode::addNode(), gui.Items.ItemComposedNode::addNode(), gui.Items.ItemForLoop::addNode(), gui.CItems.Cell::customEvent(), gui.Items.ItemComposedNode::dblselected(), gui.Items.ItemComposedNode::getChildren(), gui.Items.ItemNode::getChildren(), gui.Items.ItemService::handleCancel(), gui.Items.ItemService::handleSave(), gui.graph.Graph::layout(), gui.CItems.ControlItem::moveBy(), gui.CItems.PortItem::moveBy(), gui.GraphViewer.PortItem::moveBy(), YACS::servicetypeParser< T >::onEnd(), gui.CItems.Cell::selected(), gui.Items.ItemComposedNode::selected(), gui.Items.ItemNode::selected(), and gui.CItems.Cell::tooltip().

◆ onEnd()

template<class T = YACS::ENGINE::ServiceNode*>
virtual void YACS::servicetypeParser< T >::onEnd ( const char *  el,
parser child 
)
inlinevirtual

Reimplemented from YACS::inlinetypeParser< YACS::ENGINE::ServiceNode * >.

Definition at line 57 of file serviceParsers.hxx.

58  {
59  DEBTRACE( "servicetypeParser::onEnd: " << el )
60  std::string element(el);
61  if(element == "kind")this->kind(((stringtypeParser*)child)->post());
62  else if(element == "ref") ref(((stringtypeParser*)child)->post());
63  else if(element == "component") component(((stringtypeParser*)child)->post());
64  else if(element == "componentinstance") componentinstance(((stringtypeParser*)child)->post());
65  else if(element == "node") node(((stringtypeParser*)child)->post());
66  else if(element == "method") method(((stringtypeParser*)child)->post());
67  else if(element == "load") load(((loadtypeParser*)child)->post());
68  else if(element == "property")this->property(((propertytypeParser*)child)->post());
69  else if(element == "inport") this->inport(((inporttypeParser<myinport>*)child)->post());
70  else if(element == "outport") this->outport(((outporttypeParser<myoutport>*)child)->post());
71  else if(element == "instream") instream(((inporttypeParser<myinport>*)child)->post());
72  else if(element == "outstream") outstream(((outporttypeParser<myoutport>*)child)->post());
73  }
virtual void kind(const std::string &name)
virtual void property(const myprop &prop)
virtual void ref(const std::string &name)
virtual void load(const loadon &l)
virtual void instream(const myinport &p)
virtual void method(const std::string &name)
virtual void componentinstance(const std::string &name)
virtual void node(const std::string &name)
virtual void component(const std::string &name)
virtual void outstream(const myoutport &p)

References YACS::servicetypeParser< T >::component(), YACS::servicetypeParser< T >::componentinstance(), DEBTRACE, YACS::inlinetypeParser< YACS::ENGINE::ServiceNode * >::inport(), YACS::servicetypeParser< T >::instream(), YACS::inlinetypeParser< YACS::ENGINE::ServiceNode * >::kind(), YACS::servicetypeParser< T >::load(), YACS::servicetypeParser< T >::method(), YACS::servicetypeParser< T >::node(), YACS::inlinetypeParser< YACS::ENGINE::ServiceNode * >::outport(), YACS::servicetypeParser< T >::outstream(), YACS::servicetypeParser< T >::post(), YACS::nodetypeParser< T >::property(), and YACS::servicetypeParser< T >::ref().

◆ onStart()

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

Reimplemented from YACS::inlinetypeParser< YACS::ENGINE::ServiceNode * >.

Definition at line 244 of file serviceParsers.hxx.

245  {
246  DEBTRACE( "servicetypeParser::onStart: " << el )
247  std::string element(el);
249  this->maxcount("kind",1,element);
250  this->maxcount("ref",1,element);
251  this->maxcount("node",1,element);
252  this->maxcount("component",1,element);
253  this->maxcount("componentinstance",1,element);
254  this->maxcount("method",1,element);
255  this->maxcount("load",1,element);
256  this->maxchoice(t2,1,element);
257  if(element == "kind")pp=&stringtypeParser::stringParser;
258  else if(element == "ref")pp=&stringtypeParser::stringParser;
259  else if(element == "component")pp=&stringtypeParser::stringParser;
260  else if(element == "componentinstance")pp=&stringtypeParser::stringParser;
261  else if(element == "node")pp=&stringtypeParser::stringParser;
262  else if(element == "method")pp=&stringtypeParser::stringParser;
263  else if(element == "load")pp=&loadtypeParser::loadParser;
264  else if(element == "property")pp=&propertytypeParser::propertyParser;
265  else if(element == "inport")pp=&inporttypeParser<>::inportParser;
266  else if(element == "outport")pp=&outporttypeParser<>::outportParser;
267  else if(element == "instream")pp=&inporttypeParser<>::inportParser;
268  else if(element == "outstream")pp=&outporttypeParser<>::outportParser;
269  this->SetUserDataAndPush(pp);
270  pp->init();
271  pp->pre();
272  pp->buildAttr(attr);
273  }
static std::string t2[]
static inporttypeParser< T > inportParser
Definition: portParsers.hxx:50
static loadtypeParser loadParser
static outporttypeParser< T > outportParser
Definition: portParsers.hxx:71
virtual void maxcount(std::string name, int max, std::string &el)
Definition: parserBase.cxx:122
virtual void SetUserDataAndPush(parser *pp)
Definition: parserBase.cxx:55
static parser main_parser
Definition: parserBase.hxx:41
virtual void maxchoice(std::string *names, int max, std::string &el)
Definition: parserBase.cxx:145
static propertytypeParser propertyParser
static stringtypeParser stringParser
Definition: dataParsers.hxx:33

References YACS::parser::buildAttr(), DEBTRACE, YACS::parser::init(), YACS::loadtypeParser::loadParser, YACS::parser::main_parser, YACS::parser::pre(), YACS::propertytypeParser::propertyParser, YACS::stringtypeParser::stringParser, and YACS::t2.

◆ outstream()

template<class T = YACS::ENGINE::ServiceNode*>
virtual void YACS::servicetypeParser< T >::outstream ( const myoutport p)
inlinevirtual

Definition at line 171 of file serviceParsers.hxx.

172  {
173  DEBTRACE( "service_outstream" )
174  DEBTRACE( p._type )
175  DEBTRACE( p._name )
176  if(this->_node==0)
177  throw YACS::Exception("ServiceNode must be completely defined before defining its ports");
178 
179  if(currentProc->typeMap.count(p._type)==0)
180  {
182  if(t==0)
183  {
184  std::string msg="Unknown OutStreamPort Type: ";
185  msg=msg+p._type+" for node: "+this->_node->getName()+" port name: "+p._name;
186  throw YACS::Exception(msg);
187  }
188  else
189  {
190  currentProc->typeMap[p._type]=t;
191  t->incrRef();
192  }
193  }
195  port=this->_node->edAddOutputDataStreamPort(p._name,currentProc->typeMap[p._type]);
196  // Set all properties for this port
197  std::map<std::string, std::string>::const_iterator pt;
198  for(pt=p._props.begin();pt!=p._props.end();pt++)
199  port->setProperty((*pt).first,(*pt).second);
200  }

References myinport::_name, YACS::nodetypeParser< T >::_node, currentProc, DEBTRACE, YACS::ENGINE::Runtime::getTypeCode(), p, YACS::ENGINE::DataStreamPort::setProperty(), gui.Appli::t, theRuntime, and YACS::ENGINE::Proc::typeMap.

Referenced by YACS::servicetypeParser< T >::onEnd().

◆ post()

template<class T = YACS::ENGINE::ServiceNode*>
virtual T YACS::servicetypeParser< T >::post ( )
inlinevirtual

Reimplemented from YACS::inlinetypeParser< YACS::ENGINE::ServiceNode * >.

Definition at line 201 of file serviceParsers.hxx.

202  {
203  DEBTRACE( "service_post " << this->_node->getName() )
204  this->mincount("method",1);
205  if(this->_state == "disabled")this->_node->exDisabledState();
206 
207  // If the service node has no component instance don't go further return the node
208  if(!this->_node->getComponent())
209  return this->_node;
210 
211  // when container is not defined by <load container="xxx"/> but indirectly by <node>xxx</node>
212  // this->_container is not set, and there is no need to setContainer
213  // so stop here and return the node
214  if(this->_node->getComponent()->getContainer())
215  return this->_node;
216 
217  //If the component instance is anonymous set the container
218  // with the load directive or with the DefaultContainer
219  if(this->_node->getComponent()->isAnonymous())
220  {
221  if(currentProc->containerMap.count(this->_container) != 0)
222  this->_node->getComponent()->setContainer(currentProc->containerMap[this->_container]);
223  else if(this->_container == "" && currentProc->containerMap.count("DefaultContainer") != 0)
224  {
225  //a default container is defined : use it if supported
226  try
227  {
228  currentProc->containerMap["DefaultContainer"]->checkCapabilityToDealWith(this->_node->getComponent());
229  this->_node->getComponent()->setContainer(currentProc->containerMap["DefaultContainer"]);
230  }
231  catch(YACS::Exception)
232  {}
233  }
234  else
235  std::cerr << "WARNING: Unknown container " << this->_container << " ignored" << std::endl;
236  }
237  return this->_node;
238  }
std::map< std::string, Container * > containerMap
Definition: Proc.hxx:91
virtual void mincount(std::string name, int min)
Definition: parserBase.cxx:134

References YACS::nodetypeParser< T >::_container, YACS::nodetypeParser< T >::_node, YACS::nodetypeParser< T >::_state, YACS::ENGINE::Proc::containerMap, currentProc, DEBTRACE, and YACS::parser::mincount().

Referenced by YACS::servicetypeParser< T >::onEnd().

◆ ref()

template<class T = YACS::ENGINE::ServiceNode*>
virtual void YACS::servicetypeParser< T >::ref ( const std::string &  name)
inlinevirtual

Definition at line 74 of file serviceParsers.hxx.

75  {
76  DEBTRACE( "service_ref: " << name )
77  this->_node=theRuntime->createRefNode(this->_kind,this->_name);
78  this->_node->setRef(name);
79  }
virtual ServiceNode * createRefNode(const std::string &kind, const std::string &name)
Definition: Runtime.cxx:200

References YACS::inlinetypeParser< YACS::ENGINE::ServiceNode * >::_kind, YACS::nodetypeParser< T >::_name, YACS::nodetypeParser< T >::_node, YACS::ENGINE::Runtime::createRefNode(), DEBTRACE, and YACS::nodetypeParser< T >::name().

Referenced by YACS::servicetypeParser< T >::onEnd().

Member Data Documentation

◆ serviceParser

template<class T >
servicetypeParser< T > YACS::servicetypeParser< T >::serviceParser
static

Definition at line 54 of file serviceParsers.hxx.


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