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);
88 this->
_node->setComponent(inst);
96 this->
_node->setComponent(inst);
109 else if(currentProc->
serviceMap.count(fullname) != 0)
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);
137 DEBTRACE(
"service_load: " <<
l._container);
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;
168 for(pt=
p._props.begin();pt!=
p._props.end();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;
198 for(pt=
p._props.begin();pt!=
p._props.end();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]);
229 this->
_node->getComponent()->setContainer(currentProc->
containerMap[
"DefaultContainer"]);
235 std::cerr <<
"WARNING: Unknown container " << this->
_container <<
" ignored" << std::endl;
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);
Base class for all component instances.
virtual void setProperty(const std::string &name, const std::string &value)
Set a new value for a property of the port.
Base class for all schema objects.
std::map< std::string, ServiceNode * > serviceMap
std::map< std::string, TypeCode * > typeMap
std::vector< std::string > names
std::map< std::string, Container * > containerMap
std::map< std::string, ComponentInstance * > componentInstanceMap
virtual ComponentInstance * createComponentInstance(const std::string &componame, const std::string &name="", const std::string &kind="")
Create a new ComponentInstance and add it into componentInstanceMap.
virtual ServiceNode * createRefNode(const std::string &kind, const std::string &name)
virtual TypeCode * getTypeCode(const std::string &name)
Get a typecode by its name from runtime catalogs.
virtual ServiceNode * createCompoNode(const std::string &kind, const std::string &name)
Class for calculation node associated with a component service.
virtual ServiceNode * createNode(const std::string &name)=0
Base class for all type objects.
YACS::ENGINE::Runtime * theRuntime
YACS::ENGINE::Proc * currentProc
virtual void outport(const myoutport &p)
virtual void kind(const std::string &name)
virtual void inport(const myinport &p)
Class for loading parser.
static loadtypeParser loadParser
virtual void property(const myprop &prop)
virtual void name(const std::string &name)
Class for Outport parser.
virtual void mincount(std::string name, int min)
virtual void buildAttr(const XML_Char **attr)
static parser main_parser
void logError(const std::string &reason)
Class for property parser.
static propertytypeParser propertyParser
virtual void ref(const std::string &name)
virtual void load(const loadon &l)
virtual void instream(const myinport &p)
virtual void onStart(const XML_Char *el, const XML_Char **attr)
virtual void method(const std::string &name)
virtual void onEnd(const char *el, parser *child)
virtual void componentinstance(const std::string &name)
virtual void node(const std::string &name)
virtual void component(const std::string &name)
static servicetypeParser< T > serviceParser
virtual void outstream(const myoutport &p)
static stringtypeParser stringParser