49 using namespace YACS::ENGINE;
69 _out <<
"</proc>" << endl;
76 _out.open(xmlSchema.c_str(), ios::out);
79 string what =
"Impossible to open file for writing: " + xmlSchema;
82 _out <<
"<?xml version='1.0' encoding='iso-8859-1' ?>" << endl;
88 _out <<
"</proc>" << endl;
99 _out <<
" state=\"disabled\">" << endl;
103 node->ComposedNode::accept(
this);
134 _out <<
" state=\"disabled\"";
142 node->DynParaLoop::accept(
this);
145 _out <<
indent(depth) <<
"</foreach>" << endl;
159 _out <<
" state=\"disabled\"";
167 node->DynParaLoop::accept(
this);
170 _out <<
indent(depth) <<
"</optimizer>" << endl;
181 _out <<
indent(depth+1) <<
"<initnode>" << endl;
183 _out <<
indent(depth+1) <<
"</initnode>" << endl;
191 _out <<
indent(depth+1) <<
"<finalizenode>" << endl;
193 _out <<
indent(depth+1) <<
"</finalizenode>" << endl;
206 _out <<
" state=\"disabled\"";
212 node->ComposedNode::accept(
this);
215 _out <<
indent(depth) <<
"</forloop>" << endl;
230 _out <<
" state=\"disabled\">" << endl;
233 _out <<
indent(depth+1) <<
"<script><code><![CDATA[";
235 _out <<
"]]></code></script>" << endl;
240 _out <<
indent(depth+1) <<
"<load container=\"" << cont->
getName() <<
"\"/>" << endl;
267 _out <<
" state=\"disabled\">" << endl;
273 _out <<
"]]></code>" << endl;
274 _out <<
indent(depth+1) <<
"</function>" << endl;
279 _out <<
indent(depth+1) <<
"<load container=\"" << cont->
getName() <<
"\"/>" << endl;
302 node->ComposedNode::accept(
this);
313 _out <<
"<proc name=\""<< node->
getName() <<
"\">" << endl;
319 node->ComposedNode::accept(
this);
335 _out <<
" state=\"disabled\">" << endl;
338 if (node->
getKind() ==
"xmlsh")
340 _out <<
indent(depth+1) <<
"<kind>xmlsh</kind>" << endl;
357 map<string, Container*>::const_iterator it;
360 if (it->second == cont)
break;
363 _out <<
indent(depth+1) <<
"<load container=\"" << it->first <<
"\"/>" << endl;
372 _out <<
indent(depth+1) <<
"<component>" <<
"UNKNOWN" <<
"</component>" << endl;
382 _out <<
indent(depth) <<
"</service>" << endl;
394 _out <<
" state=\"disabled\">" << endl;
398 map<string, Container*>::const_iterator it;
401 if (it->second == cont)
break;
404 _out <<
indent(depth+1) <<
"<loadcontainer>" << it->first <<
"</loadcontainer>" << endl;
410 _out <<
indent(depth+2) <<
"<script><code><![CDATA[";
412 _out <<
"]]></code></script>" << endl;
431 _out <<
" state=\"disabled\">" << endl;
442 _out <<
"]]></code>" << endl;
443 _out <<
indent(depth+1) <<
"</function>" << endl;
447 _out <<
indent(depth) <<
"</serviceInline>" << endl;
485 _out <<
" state=\"disabled\"";
491 node->ComposedNode::accept(
this);
507 _out <<
" state=\"disabled\">" << endl;
511 node->ComposedNode::accept(
this);
524 map<string,string>::const_iterator it;
525 for(it = properties.begin(); it != properties.end(); ++it)
527 _out <<
indent(depth) <<
"<property name=\"" << it->first
528 <<
"\" value=\"" << it->second <<
"\"/>" << endl;
535 string typeName = type->
name();
536 if (typeNames.find(typeName) != typeNames.end())
542 typeNames.insert(typeName);
543 _out <<
indent(depth) <<
"<type name=\"" << typeName <<
"\" kind=\"double\"/>" << endl;
548 typeNames.insert(typeName);
549 _out <<
indent(depth) <<
"<type name=\"" << typeName <<
"\" kind=\"int\"/>" << endl;
554 typeNames.insert(typeName);
555 _out <<
indent(depth) <<
"<type name=\"" << typeName <<
"\" kind=\"string\"/>" << endl;
560 typeNames.insert(typeName);
561 _out <<
indent(depth) <<
"<type name=\"" << typeName <<
"\" kind=\"bool\"/>" << endl;
569 for(std::list<TypeCodeObjref*>::iterator il=listOfBases.begin(); il != listOfBases.end(); ++il)
571 if (typeNames.find((*il)->name()) == typeNames.end())
575 typeNames.insert(typeName);
576 _out <<
indent(depth) <<
"<objref name=\"" << typeName <<
"\" id=\""
577 << objref->
id() <<
"\"";
578 if (listOfBases.empty())
579 _out <<
"/>" << endl;
583 for(std::list<TypeCodeObjref*>::iterator il=listOfBases.begin(); il != listOfBases.end(); ++il)
586 _out << (*il)->name();
587 _out <<
"</base>" << endl;
596 if (typeNames.find(content->
name()) == typeNames.end())
601 typeNames.insert(typeName);
602 _out <<
indent(depth) <<
"<sequence name=\"" << typeName <<
"\" content=\""
603 << content->
name() <<
"\"/>" << endl;
609 if (typeNames.find(content->
name()) == typeNames.end())
614 typeNames.insert(typeName);
615 _out <<
indent(depth) <<
"<array name=\"" << typeName <<
"\" content=\""
616 << content->
name() <<
"\"/>" << endl;
624 for (
int i=0;
i<mbCnt;
i++)
627 if (typeNames.find(member->
name()) == typeNames.end())
633 typeNames.insert(typeName);
634 _out <<
indent(depth) <<
"<struct name=\"" << typeName <<
"\">" << endl;
635 for (
int i=0;
i<mbCnt;
i++)
638 _out <<
indent(depth+1) <<
"<member name=\"" <<tcStruct->
memberName(
i) <<
"\" type=\"" << member->
name() <<
"\"/>" << endl;
645 string what =
"wrong TypeCode: ";
655 map<string, TypeCode*>::const_iterator it;
656 set<string> typeNames;
660 for (it = typeMap.begin(); it != typeMap.end(); it++)
669 std::map<std::string, ComponentInstance*>::const_iterator it;
672 string name = it->first;
681 _out <<
indent(depth+1) <<
"<load container=\"" << cont->
getName() <<
"\"/>" << endl;
683 std::map<std::string, std::string> properties = inst->
getProperties();
684 std::map<std::string, std::string>::const_iterator itm;
685 for(itm = properties.begin(); itm != properties.end(); ++itm)
686 _out <<
indent(depth+1) <<
"<property name=\"" << (*itm).first
687 <<
"\" value=\"" << (*itm).second <<
"\"/>" << endl;
689 _out <<
indent(depth) <<
"</componentinstance>" << endl;
698 map<string, Container*>::const_iterator it;
701 string name = it->first;
702 _out <<
indent(depth) <<
"<container name=\"" << name <<
"\">" << endl;
704 _out <<
indent(depth+1) <<
"<property name=\"" <<
Container::AOC_ENTRY <<
"\" value=\"" << (int)it->second->isAttachedOnCloning() <<
"\"/>" << endl;
705 map<string, string> properties = (it->second)->getProperties();
706 map<string, string>::iterator itm;
707 for(itm = properties.begin(); itm != properties.end(); ++itm)
715 _out <<
indent(depth+1) <<
"<property name=\"" << (*itm).first <<
"\" value=\"" << (*itm).second <<
"\"/>" << endl;
719 _out <<
indent(depth+1) <<
"<initializescriptkey><code><![CDATA[" << (*itm).second <<
"]]></code></initializescriptkey>" << endl;
722 _out <<
indent(depth) <<
"</container>" << endl;
731 for (list<InputPort*>::iterator it = listOfInputPorts.begin(); it != listOfInputPorts.end(); ++it)
733 _out <<
indent(depth) <<
"<inport name=\"" << (*it)->getName() <<
"\" type=\""
734 << (*it)->edGetType()->name() <<
"\"/>" << endl;
742 for (list<InputDataStreamPort*>::iterator it = listOfInputPorts.begin(); it != listOfInputPorts.end(); ++it)
744 std::map<std::string,std::string> aPropMap = (*it)->getProperties();
745 if ( aPropMap.empty() )
746 _out <<
indent(depth) <<
"<instream name=\"" << (*it)->getName() <<
"\" type=\""
747 << (*it)->edGetType()->name() <<
"\"/>" << endl;
750 _out <<
indent(depth) <<
"<instream name=\"" << (*it)->getName() <<
"\" type=\""
751 << (*it)->edGetType()->name() <<
"\">" << endl;
752 for (std::map<std::string,std::string>::iterator itP = aPropMap.begin(); itP != aPropMap.end(); itP++)
753 _out <<
indent(depth+1) <<
"<property name=\"" << (*itP).first <<
"\" value=\""
754 << (*itP).second <<
"\"/>" << endl;
755 _out <<
indent(depth) <<
"</instream>" << endl;
764 for (list<OutputPort*>::iterator it = listOfOutputPorts.begin(); it != listOfOutputPorts.end(); ++it)
766 _out <<
indent(depth) <<
"<outport name=\"" << (*it)->getName() <<
"\" type=\""
767 << (*it)->edGetType()->name() <<
"\"/>" << endl;
775 for (list<OutputDataStreamPort*>::iterator it = listOfOutputPorts.begin(); it != listOfOutputPorts.end(); ++it)
777 std::map<std::string,std::string> aPropMap = (*it)->getProperties();
778 if ( aPropMap.empty() )
779 _out <<
indent(depth) <<
"<outstream name=\"" << (*it)->getName() <<
"\" type=\""
780 << (*it)->edGetType()->name() <<
"\"/>" << endl;
783 _out <<
indent(depth) <<
"<outstream name=\"" << (*it)->getName() <<
"\" type=\""
784 << (*it)->edGetType()->name() <<
"\">" << endl;
785 for (std::map<std::string,std::string>::iterator itP = aPropMap.begin(); itP != aPropMap.end(); itP++)
786 _out <<
indent(depth+1) <<
"<property name=\"" << (*itP).first <<
"\" value=\""
787 << (*itP).second <<
"\"/>" << endl;
788 _out <<
indent(depth) <<
"</outstream>" << endl;
797 for (list<Node*>::iterator ic = setOfChildren.begin(); ic != setOfChildren.end(); ++ic)
800 list<InGate*> setOfInGates = (*ic)->getOutGate()->edSetInGate();
801 for (list<InGate*>::iterator ig = setOfInGates.begin(); ig != setOfInGates.end(); ++ig)
803 Node *to = (*ig)->getNode();
808 _out <<
"<tonode>" << node->
getChildName(to) <<
"</tonode> </control>" << endl;
813 list<OutGate*> listOfOutGates = (*ic)->getInGate()->getBackLinks();
814 for (list<OutGate*>::iterator ig = listOfOutGates.begin(); ig != listOfOutGates.end(); ++ig)
816 Node *from = (*ig)->getNode();
821 _out <<
"<tonode>" << node->
getChildName(to) <<
"</tonode> </control>" << endl;
839 list<Node*> setOfChildrenPlusSplitters = setOfChildren;
841 for (list<Node*>::iterator ic = setOfChildren.begin(); ic != setOfChildren.end(); ++ic)
843 if ( dynamic_cast<ForEachLoop*>( *ic ) )
846 if(find(setOfChildrenPlusSplitters.begin(),setOfChildrenPlusSplitters.end(),nodeToInsert)==setOfChildrenPlusSplitters.end())
847 setOfChildrenPlusSplitters.push_back(nodeToInsert);
852 for (list<Node*>::iterator ic = setOfChildrenPlusSplitters.begin(); ic != setOfChildrenPlusSplitters.end(); ++ic)
856 for (list<OutputPort*>::iterator io = listOP.begin(); io != listOP.end(); ++io)
860 for (set<InPort*>::iterator iip = setIP.begin(); iip != setIP.end(); ++iip)
867 if (child && (child->getNumId() != node->
getNumId())
873 if ( dynamic_cast<SplitterNode*>(from) && dynamic_cast<ForEachLoop*>(from->
getFather()) )
879 if ( dynamic_cast<SplitterNode*>(to) && dynamic_cast<ForEachLoop*>(to->
getFather()) )
883 _out <<
indent(depth) <<
"<datalink control=\"false\">" << endl;
884 _out <<
indent(depth+1) <<
"<fromnode>" << fromName <<
"</fromnode> ";
885 _out <<
"<fromport>" << anOP->
getName() <<
"</fromport>" << endl;
886 _out <<
indent(depth+1) <<
"<tonode>" << childName <<
"</tonode> ";
887 _out <<
"<toport>" << anIP->
getName() <<
"</toport>" << endl;
888 _out <<
indent(depth) <<
"</datalink>" << endl;
893 struct DataLinkInfo aLink = { from, to, anOP, anIP,
false };
902 if (!dynamic_cast<Switch*>(node))
904 std::multimap<int, DataLinkInfo>::iterator pos;
907 Node* to = (pos->second).to;
911 InPort* anIP = (pos->second).inp;
913 Node* from = (pos->second).from;
919 OutPort *anOP = (pos->second).outp;
920 (pos->second).toDelete =
true;
921 _out <<
indent(depth) <<
"<datalink control=\"false\">" << endl;
922 _out <<
indent(depth+1) <<
"<fromnode>" << childName <<
"</fromnode> ";
923 _out <<
"<fromport>" << anOP->
getName() <<
"</fromport>" << endl;
925 _out <<
"<toport>" << anIP->
getName() <<
"</toport>" << endl;
926 _out <<
indent(depth) <<
"</datalink>" << endl;
935 if ((pos->second).toDelete)
950 for (list<Node*>::iterator ic = setOfChildren.begin(); ic != setOfChildren.end(); ++ic)
953 if ( dynamic_cast<ComposedNode*>(from) )
continue;
955 for (list<OutputDataStreamPort*>::iterator io = listOP.begin(); io != listOP.end(); ++io)
959 for (set<InPort*>::iterator iip = setIP.begin(); iip != setIP.end(); ++iip)
966 if (child && (child->getNumId() != node->
getNumId())
973 _out <<
"<fromport>" << anOP->
getName() <<
"</fromport>" << endl;
974 _out <<
indent(depth+1) <<
"<tonode>" << childName <<
"</tonode> ";
975 _out <<
"<toport>" << anIP->
getName() <<
"</toport>" << endl;
977 std::map<std::string,std::string> aPropMap =
dynamic_cast<InputDataStreamPort*
>(anIP)->getProperties();
978 for (std::map<std::string,std::string>::iterator itP = aPropMap.begin(); itP != aPropMap.end(); itP++)
980 string notAlinkProperty =
"DependencyType";
981 if (notAlinkProperty != (*itP).first)
982 _out <<
indent(depth+1) <<
"<property name=\"" << (*itP).first <<
"\" value=\""
983 << (*itP).second <<
"\"/>" << endl;
999 if (!dynamic_cast<Switch*>(node))
1001 std::multimap<int, StreamLinkInfo>::iterator pos;
1004 Node* to = (pos->second).to;
1008 InPort* anIP = (pos->second).inp;
1010 Node* from = (pos->second).from;
1017 (pos->second).toDelete =
true;
1019 _out <<
indent(depth+1) <<
"<fromnode>" << childName <<
"</fromnode> ";
1020 _out <<
"<fromport>" << anOP->
getName() <<
"</fromport>" << endl;
1022 _out <<
"<toport>" << anIP->
getName() <<
"</toport>" << endl;
1024 std::map<std::string,std::string> aPropMap =
dynamic_cast<InputDataStreamPort*
>(anIP)->getProperties();
1025 for (std::map<std::string,std::string>::iterator itP = aPropMap.begin(); itP != aPropMap.end(); itP++)
1026 _out <<
indent(depth+1) <<
"<property name=\"" << (*itP).first <<
"\" value=\""
1027 << (*itP).second <<
"\"/>" << endl;
1029 _out <<
indent(depth) <<
"</stream>" << endl;
1038 if ((pos->second).toDelete)
1050 for(list<Node *>::iterator iter=setOfNode.begin();iter!=setOfNode.end();iter++)
1052 if ( dynamic_cast<ComposedNode*> (*iter) )
1054 set<Node *> myCurrentSet =
getAllNodes(dynamic_cast<ComposedNode*> (*iter));
1055 ret.insert(myCurrentSet.begin(),myCurrentSet.end());
1060 list<ElementaryNode *> myCurrentSet=(*iter)->getRecursiveConstituents();
1061 ret.insert(myCurrentSet.begin(),myCurrentSet.end());
1072 for (set<Node*>::iterator iter = nodeSet.begin(); iter != nodeSet.end(); ++iter)
1085 list<InputPort *>::iterator iter;
1086 for(iter = setOfInputPort.begin(); iter != setOfInputPort.end(); ++iter)
1088 if (!(*iter)->isEmpty())
1090 _out <<
indent(depth) <<
"<parameter>" << endl;
1092 _out <<
"<toport>" << (*iter)->getName() <<
"</toport>" <<endl;
1099 _out <<
"<value><error><![CDATA[" << e.
what() <<
"]]></error></value>" << endl;
1101 _out <<
indent(depth) <<
"</parameter>" << endl;
1114 _out <<
indent(depth) <<
"<default>" << endl;
1116 _out <<
indent(depth) <<
"<case id=\"" << myCase <<
"\">" << endl;
1128 _out <<
indent(depth) <<
"</default>" << endl;
1141 if (dynamic_cast<Switch*>(father)) depth +=1;