Salome HOME
updated copyright message
[modules/yacs.git] / src / engine / PropertyInterface.cxx
1 // Copyright (C) 2006-2023  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, or (at your option) any later version.
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
20 #include "PropertyInterface.hxx"
21
22 //#define _DEVDEBUG_
23 #include "YacsTrace.hxx"
24
25 using namespace std;
26 using namespace YACS::ENGINE;
27
28 /*! \class YACS::ENGINE::PropertyInterface
29  *  \brief Class for adding property interface to another class
30  *
31  */
32
33 PropertyInterface::~PropertyInterface()
34 {
35 }
36
37 void PropertyInterface::setProperty(const std::string& name, const std::string& value)
38 {
39   DEBTRACE("PropertyInterface::setProperty " << name << " " << value);
40   _propertyMap[name]=value;
41 }
42
43 //! Get a property value given its name
44 /*!
45  *  \param name : the property name
46  *  \return the property value
47  */
48 std::string PropertyInterface::getProperty(const std::string& name)
49 {
50   DEBTRACE("PropertyInterface::getProperty " << name );
51   return _propertyMap[name];
52 }
53
54 void PropertyInterface::setProperties(std::map<std::string,std::string> properties)
55 {
56   DEBTRACE("PropertyInterface::setProperties " );
57   _propertyMap.clear();
58   std::map<std::string,std::string>::iterator it;
59   for (it = properties.begin(); it != properties.end(); ++it)
60     {
61       setProperty(it->first, it->second); // setProperty virtual and derived
62     }
63 }