1 // Copyright (C) 2006-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "containerParsers.hxx"
21 #include "propertyParsers.hxx"
22 #include "HomogeneousPoolContainer.hxx"
25 #include "YacsTrace.hxx"
29 containertypeParser containertypeParser::containerParser;
30 machinetypeParser machinetypeParser::machineParser;
31 loadtypeParser loadtypeParser::loadParser;
33 void machinetypeParser::buildAttr(const XML_Char** attr)
37 required("name",attr);
38 for (int i = 0; attr[i]; i += 2)
40 if(std::string(attr[i]) == "name")name(attr[i+1]);
43 void machinetypeParser::pre (){_mach._name="";}
44 void machinetypeParser::name(const std::string& name){ _mach._name=name; }
45 machine machinetypeParser::post()
50 void containertypeParser::buildAttr(const XML_Char** attr)
54 required("name",attr);
55 for (int i = 0; attr[i]; i += 2)
57 if(std::string(attr[i]) == "name")name(attr[i+1]);
60 void containertypeParser::onStart(const XML_Char* el, const XML_Char** attr)
62 std::string element(el);
63 parser* pp=&parser::main_parser;
64 if(element == "machine")pp=&machinetypeParser::machineParser;
65 if(element == "property")pp=&propertytypeParser::propertyParser;
66 if(element == "initializescriptkey")pp=&codetypeParser::codeParser;
67 SetUserDataAndPush(pp);
72 void containertypeParser::onEnd(const char *el,parser* child)
74 std::string element(el);
75 if(element == "machine")machine_(((machinetypeParser*)child)->post());
76 if(element == "property")property(((propertytypeParser*)child)->post());
77 if(element == "initializescriptkey")initializescriptkey(((codetypeParser*)child)->post());
79 void containertypeParser::pre ()
81 _container._machs.clear();
82 _container._props.clear();
84 void containertypeParser::name(const std::string& name){ _container._name=name; }
85 void containertypeParser::machine_(const machine& m)
87 DEBTRACE( "machine: " << m._name )
88 _container._machs.push_back(m);
90 void containertypeParser::property (const myprop& prop)
92 DEBTRACE( "property_set: " << prop._name << " " << prop._value );
93 _container._props[prop._name]=prop._value;
95 void containertypeParser::initializescriptkey(const myfunc& f)
97 _container._props[YACS::ENGINE::HomogeneousPoolContainer::INITIALIZE_SCRIPT_KEY]=f._code;
100 mycontainer containertypeParser::post()
102 //mincount("machine",1);
106 void loadtypeParser::buildAttr(const XML_Char** attr)
110 required("container",attr);
111 for (int i = 0; attr[i]; i += 2)
113 if(std::string(attr[i]) == "container")container(attr[i+1]);
116 void loadtypeParser::pre (){_loadon._container="";}
117 void loadtypeParser::container(const std::string& name){ _loadon._container=name; }
118 loadon loadtypeParser::post()