Salome HOME
Update from BR_V5_DEV 13feb09
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_AttributeTableOfInteger.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_AttributeTableOfInteger.hxx
24 //  Author : Michael Ponikarov
25 //  Module : SALOME
26 //
27 #ifndef _SALOMEDSImpl_AttributeTableOfInteger_HeaderFile
28 #define _SALOMEDSImpl_AttributeTableOfInteger_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
40 class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeTableOfInteger :
41   public SALOMEDSImpl_GenericAttribute 
42 {
43
44 public:
45   virtual std::string Save();
46   virtual void Load(const std::string&); 
47   static const std::string& GetID() ;
48   static SALOMEDSImpl_AttributeTableOfInteger* Set(const DF_Label& label) ;
49   SALOMEDSImpl_AttributeTableOfInteger();
50   void SetNbColumns(const int theNbColumns);
51   void SetTitle(const std::string& theTitle) ;
52   std::string GetTitle() const;
53   void SetRowData(const int theRow,const std::vector<int>& theData) ;
54   std::vector<int> GetRowData(const int theRow) ;
55   void SetRowTitle(const int theRow,const std::string& theTitle) ;
56   void SetRowUnit(const int theRow,const std::string& theUnit) ;
57   std::string GetRowUnit(const int theRow) const;
58   void SetRowUnits(const std::vector<std::string>& theUnits) ;
59   std::vector<std::string> GetRowUnits();
60   void SetRowTitles(const std::vector<std::string>& theTitles) ;
61   std::vector<std::string> GetRowTitles();
62   std::string GetRowTitle(const int theRow) const;
63   void SetColumnData(const int theColumn,const std::vector<int>& theData) ;
64   std::vector<int> GetColumnData(const int theColumn) ;
65   void SetColumnTitle(const int theColumn,const std::string& theTitle) ;
66   std::string GetColumnTitle(const int theColumn) const;
67   void SetColumnTitles(const std::vector<std::string>& theTitles);
68   std::vector<std::string> GetColumnTitles();
69   int GetNbRows() const;
70   int GetNbColumns() const;
71
72   void PutValue(const int theValue,const int theRow,const int theColumn) ;
73   bool HasValue(const int theRow,const int theColumn) ;
74   int GetValue(const int theRow,const int theColumn) ;
75   const std::string& ID() const;
76   void Restore(DF_Attribute* with) ;
77   DF_Attribute* NewEmpty() const;
78   void Paste(DF_Attribute* into);
79
80   std::vector<int> GetSetRowIndices(const int theRow);
81   std::vector<int> GetSetColumnIndices(const int theColumn);
82
83   ~SALOMEDSImpl_AttributeTableOfInteger() {}
84
85 private: 
86
87   std::map<int, int> myTable;
88   std::string myTitle;
89   std::vector<std::string> myRows;
90   std::vector<std::string> myCols;
91   int myNbRows;
92   int myNbColumns;
93
94 };
95
96 #endif