20 #ifndef _SERVICEPARSERS_HXX_
21 #define _SERVICEPARSERS_HXX_
49 static std::string
t2[]={
"ref",
"node",
"component",
"componentinstance",
""};
51 template <
class T=YACS::ENGINE::ServiceNode*>
59 DEBTRACE(
"servicetypeParser::onEnd: " << el )
60 std::string element(el);
74 virtual void ref (
const std::string&
name)
78 this->
_node->setRef(name);
83 DEBTRACE(
"componentinstance: " << name )
88 this->
_node->setComponent(inst);
93 DEBTRACE(
"service_component: " << name )
96 this->
_node->setComponent(inst);
101 DEBTRACE(
"service_node: " << name )
102 std::string fullname = currentProc->
names.back()+
name;
109 else if(currentProc->
serviceMap.count(fullname) != 0)
124 DEBTRACE(
"service_method: " << name )
126 throw YACS::Exception(
"ServiceNode must be completely defined before defining its method");
129 this->
logError(
"a service name must be a non empty string");
132 this->
_node->setMethod(name);
147 throw YACS::Exception(
"ServiceNode must be completely defined before defining its ports");
154 std::string msg=
"Unknown InStreamPort Type: ";
155 msg=msg+p.
_type+
" for node: "+this->
_node->getName()+
" port name: "+p.
_name;
167 std::map<std::string, std::string>::const_iterator pt;
177 throw YACS::Exception(
"ServiceNode must be completely defined before defining its ports");
184 std::string msg=
"Unknown OutStreamPort Type: ";
185 msg=msg+p.
_type+
" for node: "+this->
_node->getName()+
" port name: "+p.
_name;
197 std::map<std::string, std::string>::const_iterator pt;
205 if(this->
_state ==
"disabled")this->
_node->exDisabledState();
208 if(!this->
_node->getComponent())
214 if(this->
_node->getComponent()->getContainer())
219 if(this->
_node->getComponent()->isAnonymous())
221 if(currentProc->
containerMap.count(this->_container) != 0)
222 this->
_node->getComponent()->setContainer(currentProc->
containerMap[this->_container]);
228 currentProc->
containerMap[
"DefaultContainer"]->checkCapabilityToDealWith(this->
_node->getComponent());
229 this->
_node->getComponent()->setContainer(currentProc->
containerMap[
"DefaultContainer"]);
235 std::cerr <<
"WARNING: Unknown container " << this->
_container <<
" ignored" << std::endl;
241 template <
class T> servicetypeParser<T> servicetypeParser<T>::serviceParser;
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);
269 this->SetUserDataAndPush(pp);