Salome HOME
mergefrom branch BR_V511_PR tag mergeto_trunk_03feb09
[modules/yacs.git] / src / engine / Container.cxx
1 //  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 #include "Container.hxx"
20 #include "ComponentInstance.hxx"
21
22 //#define _DEVDEBUG_
23 #include "YacsTrace.hxx"
24
25 using namespace std;
26 using namespace YACS::ENGINE;
27
28 Container::Container():_isAttachedOnCloning(false)
29 {
30 }
31
32 Container::~Container()
33 {
34 }
35
36 /*!
37  * By calling this method the current container 'this' is not destined to be deeply copied on clone call.
38  */
39 void Container::attachOnCloning() const
40 {
41   _isAttachedOnCloning=true;
42 }
43
44 /*!
45  * By calling this method the current container 'this' will be deeply copied on clone call.
46  */
47 void Container::dettachOnCloning() const
48 {
49   _isAttachedOnCloning=false;
50 }
51
52 bool Container::isAttachedOnCloning() const
53 {
54   return _isAttachedOnCloning;
55 }
56
57 /*!
58  * This method informs about the capability of the container to deal with CT an unpredictably number of components.
59  * By default : True
60  */
61 bool Container::isSupportingRTODefNbOfComp() const
62 {
63   return true;
64 }
65
66 void Container::setProperty(const std::string& name, const std::string& value)
67 {
68   DEBTRACE("Container::setProperty " << name << " " << value);
69   _propertyMap[name]=value;
70 }
71
72 std::string Container::getProperty(const std::string& name)
73 {
74   DEBTRACE("Container::getProperty " << name );
75   return _propertyMap[name];
76 }
77
78 void Container::setProperties(std::map<std::string,std::string> properties)
79 {
80   _propertyMap.clear();
81   std::map<std::string,std::string>::iterator it;
82   for (it = properties.begin(); it != properties.end(); ++it)
83     {
84       setProperty((*it).first, (*it).second); // setProperty virtual and derived
85     }
86 }