Version: 9.16.0
YACS::servertypeParser< T > Struct Template Reference

#include <serverParsers.hxx>

Inheritance diagram for YACS::servertypeParser< T >:
Collaboration diagram for YACS::servertypeParser< 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 loadcontainer (const std::string &name)
 
virtual void script (const myfunc &f)
 
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::ServerNode * >
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 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)
 
virtual YACS::ENGINE::ServerNodepost ()
 
- Public Member Functions inherited from YACS::nodetypeParser< YACS::ENGINE::ServerNode * >
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 state (const std::string &name)
 
virtual void type (const std::string &name)
 
virtual void property (const myprop &prop)
 
virtual YACS::ENGINE::ServerNodepost ()
 
YACS::ENGINE::InlineNodepost ()
 
- Public Member Functions inherited from YACS::parser
 parser ()
 
virtual ~parser ()
 
virtual void SetUserDataAndPush (parser *pp)
 
virtual void onStart (const XML_Char *el, const XML_Char **attr)
 
virtual void onEnd (const XML_Char *el, parser *child)
 
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 pre ()
 
virtual void required (const std::string &name, const XML_Char **attr)
 
virtual void buildAttr (const XML_Char **attr)
 
std::stack< parser * > & getStack ()
 
template<class T >
T post ()
 
void logError (const std::string &reason)
 

Static Public Attributes

static servertypeParser< TserverParser
 
- Static Public Attributes inherited from YACS::inlinetypeParser< YACS::ENGINE::ServerNode * >
static inlinetypeParser< YACS::ENGINE::ServerNode * > inlineParser
 
- Static Public Attributes inherited from YACS::nodetypeParser< YACS::ENGINE::ServerNode * >
static nodetypeParser< YACS::ENGINE::ServerNode * > 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::ServerNode * >
std::string _kind
 
double _weight
 
- Public Attributes inherited from YACS::nodetypeParser< YACS::ENGINE::ServerNode * >
std::string _type
 
std::string _name
 
std::string _state
 
std::string _container
 
YACS::ENGINE::ServerNode_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::ServerNode*>
struct YACS::servertypeParser< T >

Definition at line 34 of file serverParsers.hxx.

Member Function Documentation

◆ instream()

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

Definition at line 131 of file serverParsers.hxx.

132 {
133 DEBTRACE( "server_instream" )
134 DEBTRACE( p._type )
135 DEBTRACE( p._name )
136 if(this->_node==0)
137 throw YACS::Exception("ServerNode must be completely defined before defining its ports");
138
139 if(currentProc->typeMap.count(p._type)==0)
140 {
142 if(t==0)
143 {
144 std::string msg="Unknown InStreamPort Type: ";
145 msg=msg+p._type+" for node: "+this->_node->getName()+" port name: "+p._name;
146 throw YACS::Exception(msg);
147 }
148 else
149 {
150 currentProc->typeMap[p._type]=t;
151 t->incrRef();
152 }
153 }
156 // Set all properties for this port
157 std::map<std::string, std::string>::const_iterator pt;
158 for(pt=p._props.begin();pt!=p._props.end();pt++)
159 port->setProperty((*pt).first,(*pt).second);
160 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
virtual void setProperty(const std::string &name, const std::string &value)
Set a new value for a property of the port.
virtual InputDataStreamPort * edAddInputDataStreamPort(const std::string &inputPortDSName, 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
YACS::ENGINE::Runtime * theRuntime
Definition: parsers.cxx:40
YACS::ENGINE::Proc * currentProc
Definition: parserBase.cxx:30
std::string _name
Definition: factory.hxx:80

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

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

◆ load()

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

◆ loadcontainer()

template<class T = YACS::ENGINE::ServerNode*>
virtual void YACS::servertypeParser< T >::loadcontainer ( const std::string &  name)
inlinevirtual

Definition at line 67 of file serverParsers.hxx.

68 {
69 DEBTRACE( "server_loadcontainer: " << name )
70 this->_node=(YACS::ENGINE::ServerNode*)theRuntime->createFuncNode("DistPython",this->_name);
71 std::map<std::string,YACS::ENGINE::Container *>::const_iterator it(currentProc->containerMap.find(name));
72 if(it!=currentProc->containerMap.end())
73 {
74 this->_node->setContainer((*it).second);
75 }
76 else
77 {
79 cont->setName(name);
80 this->_node->setContainer(cont);
81 cont->decrRef();
82 }
83 }
void setName(std::string name)
WARNING ! name is used in edition to identify different containers, it is not the runtime name of the...
Definition: Container.hxx:83
virtual void setContainer(Container *container)
Definition: InlineNode.cxx:105
virtual Container * createContainer(const std::string &name, const std::string &kind="")
Create a new Container and store it in containerMap.
Definition: Proc.cxx:506
std::map< std::string, Container * > containerMap
Definition: Proc.hxx:91
virtual InlineFuncNode * createFuncNode(const std::string &kind, const std::string &name)
Definition: Runtime.cxx:190
virtual std::string getEffectiveKindOfServer() const =0
virtual void name(const std::string &name)
Definition: nodeParsers.hxx:90

References YACS::nodetypeParser< YACS::ENGINE::ServerNode * >::_node, YACS::ENGINE::Proc::containerMap, YACS::ENGINE::Proc::createContainer(), YACS::ENGINE::Runtime::createFuncNode(), currentProc, DEBTRACE, YACS::ENGINE::RefCounter::decrRef(), YACS::ENGINE::ServerNode::getEffectiveKindOfServer(), YACS::nodetypeParser< YACS::ENGINE::ServerNode * >::name(), YACS::ENGINE::InlineNode::setContainer(), YACS::ENGINE::Container::setName(), and theRuntime.

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

◆ method()

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

Definition at line 112 of file serverParsers.hxx.

113 {
114 DEBTRACE( "server_method: " << name )
115 if(this->_node==0)
116 throw YACS::Exception("ServerNode must be completely defined before defining its method");
117 if(name == "")
118 {
119 this->logError("a server name must be a non empty string");
120 return;
121 }
122 this->_node->setFname(name);
123 }
virtual void setFname(const std::string &fname)
Set the function name to use in node execution.
Definition: InlineNode.cxx:69
void logError(const std::string &reason)
Definition: parserBase.cxx:214

References YACS::nodetypeParser< YACS::ENGINE::ServerNode * >::_node, DEBTRACE, YACS::parser::logError(), YACS::nodetypeParser< YACS::ENGINE::ServerNode * >::name(), and YACS::ENGINE::InlineFuncNode::setFname().

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

◆ node()

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

Definition at line 89 of file serverParsers.hxx.

90 {
91 DEBTRACE( "server_node: " << name )
92 std::string fullname = currentProc->names.back()+name;
93 if(currentProc->inlineMap.count(name) != 0)
94 {
95 //ServerNode with absolute name found
97 this->_node =n->createNode(this->_name);
98 }
99 else if(currentProc->inlineMap.count(fullname) != 0)
100 {
101 //ServerNode with relative name found
102 //TODO: must be a short name (possible only in the same context)
104 this->_node =n->createNode(this->_name);
105 }
106 else
107 {
108 throw YACS::Exception("Unknown ServerNode");
109 }
110 }
std::map< std::string, InlineNode * > inlineMap
Definition: Proc.hxx:89
std::vector< std::string > names
Definition: Proc.hxx:93

References currentProc, DEBTRACE, YACS::ENGINE::Proc::inlineMap, gui.Appli::n, YACS::nodetypeParser< YACS::ENGINE::ServerNode * >::name(), and YACS::ENGINE::Proc::names.

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::servertypeParser< 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::ServerNode*>
virtual void YACS::servertypeParser< T >::onEnd ( const char *  el,
parser child 
)
inlinevirtual

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

Definition at line 39 of file serverParsers.hxx.

40 {
41 DEBTRACE( "servertypeParser::onEnd: " << el )
42 std::string element(el);
43 if(element == "kind")this->kind(((stringtypeParser*)child)->post());
44 else if(element == "loadcontainer") loadcontainer(((stringtypeParser*)child)->post());
45 //else if(element == "loadcontainerinstance") containerinstance(((stringtypeParser*)child)->post());
46 else if(element == "script") script(((codetypeParser*)child)->post());
47 else if(element == "node") node(((stringtypeParser*)child)->post());
48 else if(element == "method") method(((stringtypeParser*)child)->post());
49 else if(element == "load") load(((loadtypeParser*)child)->post());
50 else if(element == "property")this->property(((propertytypeParser*)child)->post());
51 else if(element == "inport") this->inport(((inporttypeParser<myinport>*)child)->post());
52 else if(element == "outport") this->outport(((outporttypeParser<myoutport>*)child)->post());
53 else if(element == "instream") instream(((inporttypeParser<myinport>*)child)->post());
54 else if(element == "outstream") outstream(((outporttypeParser<myoutport>*)child)->post());
55 }
virtual void kind(const std::string &name)
virtual void property(const myprop &prop)
virtual void method(const std::string &name)
virtual void node(const std::string &name)
virtual void outstream(const myoutport &p)
virtual void script(const myfunc &f)
virtual void loadcontainer(const std::string &name)
virtual void load(const loadon &l)
virtual void instream(const myinport &p)

References DEBTRACE, YACS::inlinetypeParser< YACS::ENGINE::ServerNode * >::inport(), YACS::servertypeParser< T >::instream(), YACS::inlinetypeParser< YACS::ENGINE::ServerNode * >::kind(), YACS::servertypeParser< T >::load(), YACS::servertypeParser< T >::loadcontainer(), YACS::servertypeParser< T >::method(), YACS::servertypeParser< T >::node(), YACS::inlinetypeParser< YACS::ENGINE::ServerNode * >::outport(), YACS::servertypeParser< T >::outstream(), YACS::servertypeParser< T >::post(), YACS::nodetypeParser< YACS::ENGINE::ServerNode * >::property(), and YACS::servertypeParser< T >::script().

◆ onStart()

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

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

Definition at line 235 of file serverParsers.hxx.

236 {
237 DEBTRACE( "servertypeParser::onStart: " << el )
238 std::string element(el);
240 this->maxcount("kind",1,element);
241 this->maxcount("ref",1,element);
242 this->maxcount("node",1,element);
243 this->maxcount("component",1,element);
244 this->maxcount("componentinstance",1,element);
245 this->maxcount("loadcontainer",1,element);
246 this->maxcount("script",1,element);
247 this->maxcount("method",1,element);
248 this->maxcount("load",1,element);
249 this->maxchoice(t22,1,element);
250 if(element == "kind")pp=&stringtypeParser::stringParser;
251 else if(element == "ref")pp=&stringtypeParser::stringParser;
252 else if(element == "component")pp=&stringtypeParser::stringParser;
253 else if(element == "componentinstance")pp=&stringtypeParser::stringParser;
254 else if(element == "loadcontainer")pp=&stringtypeParser::stringParser;
255 else if(element == "script")pp=&codetypeParser::codeParser;
256 else if(element == "node")pp=&stringtypeParser::stringParser;
257 else if(element == "method")pp=&stringtypeParser::stringParser;
258 else if(element == "load")pp=&loadtypeParser::loadParser;
259 else if(element == "property")pp=&propertytypeParser::propertyParser;
260 else if(element == "inport")pp=&inporttypeParser<>::inportParser;
261 else if(element == "outport")pp=&outporttypeParser<>::outportParser;
262 else if(element == "instream")pp=&inporttypeParser<>::inportParser;
263 else if(element == "outstream")pp=&outporttypeParser<>::outportParser;
264 this->SetUserDataAndPush(pp);
265 pp->init();
266 pp->pre();
267 pp->buildAttr(attr);
268 }
static std::string t22[]
static codetypeParser codeParser
Definition: codeParsers.hxx:36
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(), YACS::codetypeParser::codeParser, DEBTRACE, YACS::parser::init(), YACS::loadtypeParser::loadParser, YACS::parser::main_parser, YACS::parser::pre(), YACS::propertytypeParser::propertyParser, YACS::stringtypeParser::stringParser, and YACS::t22.

◆ outstream()

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

Definition at line 161 of file serverParsers.hxx.

162 {
163 DEBTRACE( "server_outstream" )
164 DEBTRACE( p._type )
165 DEBTRACE( p._name )
166 if(this->_node==0)
167 throw YACS::Exception("ServerNode must be completely defined before defining its ports");
168
169 if(currentProc->typeMap.count(p._type)==0)
170 {
172 if(t==0)
173 {
174 std::string msg="Unknown OutStreamPort Type: ";
175 msg=msg+p._type+" for node: "+this->_node->getName()+" port name: "+p._name;
176 throw YACS::Exception(msg);
177 }
178 else
179 {
180 currentProc->typeMap[p._type]=t;
181 t->incrRef();
182 }
183 }
186 // Set all properties for this port
187 std::map<std::string, std::string>::const_iterator pt;
188 for(pt=p._props.begin();pt!=p._props.end();pt++)
189 port->setProperty((*pt).first,(*pt).second);
190 }
virtual OutputDataStreamPort * edAddOutputDataStreamPort(const std::string &outputPortDSName, TypeCode *type)

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

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

◆ post()

template<class T = YACS::ENGINE::ServerNode*>
virtual T YACS::servertypeParser< T >::post ( )
inlinevirtual

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

Definition at line 191 of file serverParsers.hxx.

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

References YACS::nodetypeParser< YACS::ENGINE::ServerNode * >::_container, YACS::nodetypeParser< YACS::ENGINE::ServerNode * >::_node, YACS::nodetypeParser< YACS::ENGINE::ServerNode * >::_state, YACS::ENGINE::Proc::containerMap, currentProc, DEBTRACE, YACS::ENGINE::Node::exDisabledState(), YACS::ENGINE::ElementaryNode::getComponent(), YACS::ENGINE::ComponentInstance::getContainer(), YACS::ENGINE::Node::getName(), YACS::ENGINE::ComponentInstance::isAnonymous(), YACS::parser::mincount(), and YACS::ENGINE::ComponentInstance::setContainer().

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

◆ script()

template<class T = YACS::ENGINE::ServerNode*>
virtual void YACS::servertypeParser< T >::script ( const myfunc f)
inlinevirtual

Member Data Documentation

◆ serverParser

template<class T >
servertypeParser< T > YACS::servertypeParser< T >::serverParser
static

Definition at line 36 of file serverParsers.hxx.


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