Back to index

salome-kernel  6.5.0
DF_Container.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef DFCONTAINER_HXX
00021 #define DFCONTAINER_HXX
00022 
00023 #include "DF_definitions.hxx"
00024 #include "DF_Attribute.hxx"
00025 #include <string>
00026 #include <map>
00027 
00028 //Class DF_Container is used to store several types of data 
00029 class DF_Container : public DF_Attribute 
00030 {
00031 public:
00032 
00033   //Static method that returns an ID of the give type of attributes
00034   Standard_EXPORT static const std::string& GetID();
00035 
00036   //Creates if not exists a Container attribute and places if is not placed it the Label
00037   Standard_EXPORT static DF_Container* Set(DF_Label& theLabel);
00038 
00039   //Constructor
00040   Standard_EXPORT DF_Container();
00041 
00042   //Destructor
00043   Standard_EXPORT ~DF_Container();
00044 
00045   //Sets an integer value of the attribute with given ID
00046   Standard_EXPORT void SetInt(const std::string& theID, int theValue);
00047 
00048   //Returns an integer value of the attribute with given ID
00049   Standard_EXPORT int GetInt(const std::string& theID);
00050 
00051   //Returns True if there is an integer with given ID
00052   Standard_EXPORT bool HasIntID(const std::string& theID);
00053 
00054   //Sets a double value of the attribute with given ID
00055   Standard_EXPORT void SetDouble(const std::string& theID, const double& theValue);
00056 
00057   //Returns a double value of the attribute with given ID
00058   Standard_EXPORT double GetDouble(const std::string& theID);
00059 
00060   //Returns True if there is a double with given ID
00061   Standard_EXPORT bool HasDoubleID(const std::string& theID);
00062  
00063   //Sets a string value of the attribute with given ID
00064   Standard_EXPORT void SetString(const std::string& theID, const std::string& theValue);
00065 
00066   //Returns a string  value of the attribute with given ID
00067   Standard_EXPORT std::string GetString(const std::string& theID);
00068 
00069   //Returns True if there is a string with given ID
00070   Standard_EXPORT bool HasStringID(const std::string& theID);
00071 
00072   //Sets a boolean value of the attribute with given ID
00073   Standard_EXPORT void SetBool(const std::string& theID, bool theValue);
00074 
00075   //Returns a boolean value of the attribute with given ID
00076   Standard_EXPORT bool GetBool(const std::string& theID);
00077 
00078   //Returns True if there is a boolean value with given ID
00079   Standard_EXPORT bool HasBoolID(const std::string& theID);
00080 
00081   //Clears a content of the attribute
00082   Standard_EXPORT void Clear();
00083 
00084   //ID is a std::string that uniquely identify the given type of Attributes within the Application.
00085   Standard_EXPORT virtual const std::string& ID() const;
00086 
00087   //Restores a content of this Attribute from another Attribute
00088   Standard_EXPORT virtual  void Restore(DF_Attribute* theAttribute);
00089 
00090   //Creates a new empty copy of this Attribute
00091   Standard_EXPORT virtual DF_Attribute* NewEmpty() const;
00092 
00093   //Pastes a content of this Attribute into another Attribute 
00094   Standard_EXPORT virtual  void Paste(DF_Attribute* theIntoAttribute);
00095 
00096   
00097 protected:
00098   std::map<std::string, int>         _ints;
00099   std::map<std::string, double>      _doubles;
00100   std::map<std::string, std::string> _strings;
00101   std::map<std::string, bool>        _bools;
00102 };
00103 
00104 #endif