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

#include <inlineParsers.hxx>

Inheritance diagram for YACS::inlinetypeParser< T >:
Collaboration diagram for YACS::inlinetypeParser< 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 pre ()
 
virtual void weight (const double &x)
 
virtual void kind (const std::string &name)
 
virtual void script (const myfunc &f)
 
virtual void function (const myfunc &f)
 
virtual void inport (const myinport &p)
 
virtual void outport (const myoutport &p)
 
virtual T post ()
 
void script (const myfunc &f)
 
void function (const myfunc &f)
 
void function (const myfunc &f)
 
- Public Member Functions inherited from YACS::nodetypeParser< YACS::ENGINE::InlineNode * >
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::InlineNodepost ()
 
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)
 

Public Attributes

std::string _kind
 
double _weight
 
- Public Attributes inherited from YACS::nodetypeParser< YACS::ENGINE::InlineNode * >
std::string _type
 
std::string _name
 
std::string _state
 
std::string _container
 
YACS::ENGINE::InlineNode_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 inlinetypeParser< TinlineParser
 
- Static Public Attributes inherited from YACS::nodetypeParser< YACS::ENGINE::InlineNode * >
static nodetypeParser< YACS::ENGINE::InlineNode * > 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 = YACS::ENGINE::InlineNode*>
struct YACS::inlinetypeParser< T >

Definition at line 51 of file inlineParsers.hxx.

Member Function Documentation

◆ buildAttr()

template<class T = YACS::ENGINE::InlineNode*>
virtual void YACS::inlinetypeParser< T >::buildAttr ( const XML_Char **  attr)
inlinevirtual

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

Definition at line 67 of file inlineParsers.hxx.

68 {
69 if (!attr)
70 return;
71 this->required("name",attr);
72 for (int i = 0; attr[i]; i += 2)
73 {
74 if(std::string(attr[i]) == "name")this->name(attr[i+1]);
75 if(std::string(attr[i]) == "elementaryWeight")this->weight(atof(attr[i+1]));
76 if(std::string(attr[i]) == "state")this->state(attr[i+1]);
77 }
78 }
virtual void weight(const double &x)
virtual void state(const std::string &name)
Definition: nodeParsers.hxx:95
virtual void name(const std::string &name)
Definition: nodeParsers.hxx:90
virtual void required(const std::string &name, const XML_Char **attr)
Definition: parserBase.cxx:186

References yacsorb.CORBAEngineTest::i, YACS::nodetypeParser< YACS::ENGINE::InlineNode * >::name(), YACS::parser::required(), YACS::nodetypeParser< YACS::ENGINE::InlineNode * >::state(), and YACS::inlinetypeParser< T >::weight().

◆ function() [1/3]

template<class T = YACS::ENGINE::InlineNode*>
virtual void YACS::inlinetypeParser< T >::function ( const myfunc f)
inlinevirtual

Reimplemented in YACS::remotetypeParser< T >.

Definition at line 99 of file inlineParsers.hxx.

99{}

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

◆ function() [2/3]

void YACS::inlinetypeParser< YACS::ENGINE::InlineNode * >::function ( const myfunc f)

Definition at line 179 of file inlineParsers.hxx.

180{
181 DEBTRACE( "inline_function: " << f._code )
182 YACS::ENGINE::InlineFuncNode *fnode;
183 fnode=theRuntime->createFuncNode(_kind,_name);
184 fnode->setScript(f._code);
185 fnode->setFname(f._name);
186 if(_weight>0)fnode->setWeight(_weight);
187 _node=fnode;
188}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
YACS::ENGINE::Runtime * theRuntime
Definition: parsers.cxx:40

References YACS::ENGINE::Runtime::createFuncNode(), DEBTRACE, gui.CONNECTOR::f(), YACS::ENGINE::InlineFuncNode::setFname(), YACS::ENGINE::InlineNode::setScript(), YACS::ENGINE::ElementaryNode::setWeight(), and theRuntime.

◆ function() [3/3]

Definition at line 98 of file sinlineParsers.hxx.

99{
100 DEBTRACE( "sinline_function: " << f._code )
101 YACS::ENGINE::ServiceInlineNode *fnode;
102 fnode=theRuntime->createSInlineNode(_kind,_name);
103 fnode->setScript(f._code);
104 fnode->setMethod(f._name);
105 // TODO: update with currentProc->createComponentInstance() method
106 fnode->setComponent(theRuntime->createComponentInstance("PyCompo","SalomePy"));
107 _node=fnode;
108}
YACS::ENGINE::Runtime * theRuntime
Definition: parsers.cxx:40

References YACS::ENGINE::Runtime::createComponentInstance(), YACS::ENGINE::Runtime::createSInlineNode(), DEBTRACE, gui.CONNECTOR::f(), YACS::ENGINE::ServiceNode::setComponent(), YACS::ENGINE::ServiceNode::setMethod(), YACS::ENGINE::ServiceInlineNode::setScript(), and theRuntime.

◆ inport()

template<class T = YACS::ENGINE::InlineNode*>
virtual void YACS::inlinetypeParser< T >::inport ( const myinport p)
inlinevirtual

Definition at line 101 of file inlineParsers.hxx.

102 {
103 DEBTRACE( "inline_inport: " << p._name <<":"<<p._type)
104 if(this->_node==0)
105 throw YACS::Exception("Node must be completely defined before defining its ports");
106
107 if(currentProc->typeMap.count(p._type)==0)
108 {
109 //Check if the typecode is defined in the runtime
111 if(t==0)
112 {
113 std::string msg="Unknown InPort Type: ";
114 msg=msg+p._type+" for node: "+this->_node->getName()+" port name: "+p._name;
115 throw YACS::Exception(msg);
116 }
117 else
118 {
119 currentProc->typeMap[p._type]=t;
120 t->incrRef();
121 }
122 }
123 this->_node->edAddInputPort(p._name,currentProc->typeMap[p._type]);
124 }
virtual InputPort * edAddInputPort(const std::string &inputPortName, 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::Proc * currentProc
Definition: parserBase.cxx:30
std::string _name
Definition: factory.hxx:80

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

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

◆ kind()

template<class T = YACS::ENGINE::InlineNode*>
virtual void YACS::inlinetypeParser< T >::kind ( const std::string &  name)
inlinevirtual

◆ onEnd()

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

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

Reimplemented in YACS::remotetypeParser< T >, YACS::servertypeParser< T >, YACS::servicetypeParser< T >, and YACS::sinlinetypeParser< T >.

Definition at line 56 of file inlineParsers.hxx.

57 {
58 DEBTRACE( "inlinetypeParser::onEnd: " << el )
59 std::string element(el);
60 if(element == "kind")kind(((stringtypeParser*)child)->post());
61 else if(element == "script")script(((codetypeParser*)child)->post());
62 else if(element == "function")function(((functypeParser*)child)->post());
63 else if(element == "property")this->property(((propertytypeParser*)child)->post());
64 else if(element == "inport") inport(((inporttypeParser<myinport>*)child)->post());
65 else if(element == "outport") outport(((outporttypeParser<myoutport>*)child)->post());
66 }
virtual void script(const myfunc &f)
virtual void function(const myfunc &f)
virtual void outport(const myoutport &p)
virtual void kind(const std::string &name)
virtual void inport(const myinport &p)
virtual void property(const myprop &prop)

References DEBTRACE, YACS::inlinetypeParser< T >::function(), YACS::inlinetypeParser< T >::inport(), YACS::inlinetypeParser< T >::kind(), YACS::inlinetypeParser< T >::outport(), YACS::inlinetypeParser< T >::post(), YACS::nodetypeParser< YACS::ENGINE::InlineNode * >::property(), and YACS::inlinetypeParser< T >::script().

◆ onStart()

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

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

Reimplemented in YACS::remotetypeParser< T >, YACS::servertypeParser< T >, YACS::servicetypeParser< T >, and YACS::sinlinetypeParser< T >.

Definition at line 191 of file inlineParsers.hxx.

193 {
194 DEBTRACE( "inlinetypeParser::onStart: " << el )
195 std::string element(el);
197 this->maxcount("kind",1,element);
198 this->maxcount("script",1,element);
199 this->maxcount("function",1,element);
200 this->maxchoice(t1,1,element);
201 if(element == "kind")pp=&stringtypeParser::stringParser;
202 else if(element == "script")pp=&codetypeParser::codeParser;
203 else if(element == "function")pp=&functypeParser::funcParser;
204 else if(element == "property")pp=&propertytypeParser::propertyParser;
205 else if(element == "inport")pp=&inporttypeParser<>::inportParser;
206 else if(element == "outport")pp=&outporttypeParser<>::outportParser;
207 this->SetUserDataAndPush(pp);
208 pp->init();
209 pp->pre();
210 pp->buildAttr(attr);
211 }
static std::string t1[]
static codetypeParser codeParser
Definition: codeParsers.hxx:36
static functypeParser funcParser
Definition: codeParsers.hxx:75
static inporttypeParser< T > inportParser
Definition: portParsers.hxx:50
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::parser::pre(), and YACS::t1.

◆ outport()

template<class T = YACS::ENGINE::InlineNode*>
virtual void YACS::inlinetypeParser< T >::outport ( const myoutport p)
inlinevirtual

Definition at line 125 of file inlineParsers.hxx.

126 {
127 DEBTRACE( "inline_outport: " << p._name <<":"<<p._type)
128 if(this->_node==0)
129 throw YACS::Exception("Node must be completely defined before defining its ports");
130
131 if(currentProc->typeMap.count(p._type)==0)
132 {
134 if(t==0)
135 {
136 std::string msg="Unknown OutPort Type: ";
137 msg=msg+p._type+" for node: "+this->_node->getName()+" port name: "+p._name;
138 throw YACS::Exception(msg);
139 }
140 else
141 {
142 currentProc->typeMap[p._type]=t;
143 t->incrRef();
144 }
145 }
147 }
virtual OutputPort * edAddOutputPort(const std::string &outputPortName, TypeCode *type)

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

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

◆ post()

template<class T = YACS::ENGINE::InlineNode*>
virtual T YACS::inlinetypeParser< T >::post ( )
inlinevirtual

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

Reimplemented in YACS::remotetypeParser< T >, YACS::servertypeParser< T >, YACS::servicetypeParser< T >, and YACS::sinlinetypeParser< T >.

Definition at line 148 of file inlineParsers.hxx.

149 {
150 DEBTRACE( "inline_post " << this->_node->getName() )
151 if(this->_state == "disabled")this->_node->exDisabledState();
152 /*
153 std::list<OutputPort *>::iterator iter;
154 std::list<OutputPort *> s=_node->getSetOfOutputPort();
155 for(iter=s.begin();iter!=s.end();iter++)
156 {
157 std::cerr << "port name: " << (*iter)->getName() << std::endl;
158 std::cerr << "port kind: " << (*iter)->edGetType()->kind() << std::endl;
159 }
160 */
161 return this->_node;
162 }

References YACS::nodetypeParser< YACS::ENGINE::InlineNode * >::_node, YACS::nodetypeParser< YACS::ENGINE::InlineNode * >::_state, DEBTRACE, YACS::ENGINE::Node::exDisabledState(), and YACS::ENGINE::Node::getName().

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

◆ pre()

◆ script() [1/2]

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

Reimplemented in YACS::remotetypeParser< T >, and YACS::servertypeParser< T >.

Definition at line 98 of file inlineParsers.hxx.

98{}

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

◆ script() [2/2]

void YACS::inlinetypeParser< YACS::ENGINE::InlineNode * >::script ( const myfunc f)

Definition at line 170 of file inlineParsers.hxx.

171{
172 DEBTRACE( "inline_script: " << f._code )
173 _node=theRuntime->createScriptNode(_kind,_name);
174 _node->setScript(f._code);
175 if(_weight>0)_node->setWeight(_weight);
176}

References YACS::ENGINE::Runtime::createScriptNode(), DEBTRACE, gui.CONNECTOR::f(), YACS::ENGINE::InlineNode::setScript(), and theRuntime.

◆ weight()

template<class T = YACS::ENGINE::InlineNode*>
virtual void YACS::inlinetypeParser< T >::weight ( const double x)
inlinevirtual

Definition at line 87 of file inlineParsers.hxx.

88 {
89 DEBTRACE("elementary_weight: " << x )
90 _weight=x;
91 }

References YACS::inlinetypeParser< T >::_weight, and DEBTRACE.

Referenced by YACS::inlinetypeParser< T >::buildAttr().

Member Data Documentation

◆ _kind

template<class T = YACS::ENGINE::InlineNode*>
std::string YACS::inlinetypeParser< T >::_kind

◆ _weight

template<class T = YACS::ENGINE::InlineNode*>
double YACS::inlinetypeParser< T >::_weight

◆ inlineParser

template<class T >
inlinetypeParser< T > YACS::inlinetypeParser< T >::inlineParser
static

Definition at line 53 of file inlineParsers.hxx.


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