1 // Copyright (C) 2006-2014 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 "ContainerTest.hxx"
21 #include "ComponentInstance.hxx"
22 #include "ToyNode.hxx"
26 using namespace YACS::ENGINE;
28 unsigned ContainerTest::_counter = 0;
30 const char ContainerTest::SUPPORTED_COMP_KIND[] = "TESTKIND1";
32 unsigned ContainerTest2::_counter = 0;
34 const char ContainerTest2::SUPPORTED_COMP_KIND[] = "TESTKIND2";
36 ContainerTest::ContainerTest():_alreadyStarted(false),_myCounter(_counter++)
40 std::string ContainerTest::getPlacementInfo() const
43 stream << "Cont#_" << _myCounter;
47 bool ContainerTest::isAlreadyStarted(const ComponentInstance *inst) const
49 return _alreadyStarted;
52 void ContainerTest::start(const ComponentInstance *inst) throw(YACS::Exception)
55 throw Exception("ContainerTest already started !!!!");
59 Container *ContainerTest::clone() const
61 if(_isAttachedOnCloning)
64 return (Container *) this;
67 return new ContainerTest;
70 void ContainerTest::checkCapabilityToDealWith(const ComponentInstance *inst) const throw(YACS::Exception)
72 if(inst->getKind()!=SUPPORTED_COMP_KIND)
73 throw Exception("ContainerTest not compatible with this type of instance.");
76 void ContainerTest::initAllContainers()
81 ContainerTest2::ContainerTest2():_alreadyStarted(false),_myCounter(_counter++)
85 bool ContainerTest2::isAlreadyStarted(const ComponentInstance *inst) const
87 return _alreadyStarted;
90 void ContainerTest2::start(const ComponentInstance *inst) throw(YACS::Exception)
93 throw Exception("ContainerTest already started !!!!");
97 Container *ContainerTest2::clone() const
99 if(_isAttachedOnCloning)
102 return (Container *) this;
105 return new ContainerTest2;
108 void ContainerTest2::initAllContainers()
113 void ContainerTest2::checkCapabilityToDealWith(const ComponentInstance *inst) const throw(YACS::Exception)
115 if(inst->getKind()!=SUPPORTED_COMP_KIND)
116 throw Exception("ContainerTest not compatible with this type of instance.");