Salome HOME
merge from branch BR_V5_DEV
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_AttributeTableOfReal.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  SALOME SALOMEDSImpl : data structure of SALOME and sources of Salome data server 
23 //  File   : SALOMEDSImpl_AttributeTableOfReal.hxx
24 //  Author : Michael Ponikarov
25 //  Module : SALOME
26 //
27 #ifndef _SALOMEDSImpl_AttributeTableOfReal_HeaderFile
28 #define _SALOMEDSImpl_AttributeTableOfReal_HeaderFile
29
30 #include "SALOMEDSImpl_Defines.hxx"
31 #include "DF_Attribute.hxx"
32 #include "DF_Label.hxx"      
33 #include "SALOMEDSImpl_GenericAttribute.hxx"
34
35 #include <string>
36 #include <vector>
37 #include <map>
38
39 class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeTableOfReal :
40   public SALOMEDSImpl_GenericAttribute 
41 {
42
43 public:
44   virtual std::string Save();
45   virtual void Load(const std::string&); 
46   static const std::string& GetID() ;
47   static SALOMEDSImpl_AttributeTableOfReal* Set(const DF_Label& label) ;
48   SALOMEDSImpl_AttributeTableOfReal();
49   void SetNbColumns(const int theNbColumns);
50   void SetTitle(const std::string& theTitle) ;
51   std::string GetTitle() const;
52   void SetRowData(const int theRow,const std::vector<double>& theData) ;
53   std::vector<double> GetRowData(const int theRow) ;
54   void SetRowTitle(const int theRow,const std::string& theTitle) ;
55   void SetRowUnit(const int theRow,const std::string& theUnit) ;
56   std::string GetRowUnit(const int theRow) const;
57   void SetRowUnits(const std::vector<std::string>& theUnits) ;
58   std::vector<std::string> GetRowUnits();
59   void SetRowTitles(const std::vector<std::string>& theTitles) ;
60   std::vector<std::string> GetRowTitles();
61   std::string GetRowTitle(const int theRow) const;
62   void SetColumnData(const int theColumn,const std::vector<double>& theData) ;
63   std::vector<double> GetColumnData(const int theColumn) ;
64   void SetColumnTitle(const int theColumn,const std::string& theTitle) ;
65   void SetColumnTitles(const std::vector<std::string>& theTitles);
66   std::vector<std::string> GetColumnTitles();
67   std::string GetColumnTitle(const int theColumn) const;
68   int GetNbRows() const;
69   int GetNbColumns() const;
70
71   void PutValue(const double& theValue,const int theRow,const int theColumn) ;
72   bool HasValue(const int theRow,const int theColumn) ;
73   double GetValue(const int theRow,const int theColumn) ;
74   const std::string& ID() const;
75   void Restore(DF_Attribute* with) ;
76   DF_Attribute* NewEmpty() const;
77   void Paste(DF_Attribute* into);
78
79   std::vector<int> GetSetRowIndices(const int theRow);
80   std::vector<int> GetSetColumnIndices(const int theColumn);
81
82   ~SALOMEDSImpl_AttributeTableOfReal() {}
83
84 private: 
85   std::map<int, double> myTable;
86   std::string myTitle;
87   std::vector<std::string> myRows;
88   std::vector<std::string> myCols;
89   int myNbRows;
90   int myNbColumns;
91
92 };
93
94 #endif