Version: 8.3.0
SALOMEDSImpl_AttributeTableOfString.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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 
23 // SALOME SALOMEDSImpl : data structure of SALOME and sources of Salome data server
24 // File : SALOMEDSImpl_AttributeTableOfString.hxx
25 // Author : Sergey Ruin
26 // Module : SALOME
27 //
28 #ifndef _SALOMEDSImpl_AttributeTableOfString_HeaderFile
29 #define _SALOMEDSImpl_AttributeTableOfString_HeaderFile
30 
31 #include "SALOMEDSImpl_Defines.hxx"
32 #include "DF_Label.hxx"
33 #include "DF_Attribute.hxx"
36 
37 #include <string>
38 #include <vector>
39 #include <map>
40 
43 {
44 
45 public:
46  virtual std::string Save();
47  virtual void Load(const std::string&);
48 
49  static const std::string& GetID();
50  static SALOMEDSImpl_AttributeTableOfString* Set(const DF_Label& label);
51 
53  void SetNbColumns(const int theNbColumns);
54  void SetTitle(const std::string& theTitle);
55  std::string GetTitle() const;
56  void SetRowData(const int theRow, const std::vector<std::string>& theData);
57  std::vector<std::string> GetRowData(const int theRow);
58  void SetRowTitle(const int theRow, const std::string& theTitle);
59  void SetRowUnit(const int theRow, const std::string& theUnit);
60  std::string GetRowUnit(const int theRow) const;
61  void SetRowUnits(const std::vector<std::string>& theUnits);
62  std::vector<std::string> GetRowUnits();
63  void SetRowTitles(const std::vector<std::string>& theTitles);
64  std::vector<std::string> GetRowTitles();
65  std::string GetRowTitle(const int theRow) const;
66  void SetColumnData(const int theColumn, const std::vector<std::string>& theData);
67  std::vector<std::string> GetColumnData(const int theColumn);
68  void SetColumnTitle(const int theColumn, const std::string& theTitle);
69  std::string GetColumnTitle(const int theColumn) const;
70  void SetColumnTitles(const std::vector<std::string>& theTitles);
71  std::vector<std::string> GetColumnTitles();
72  int GetNbRows() const;
73  int GetNbColumns() const;
74 
75  void PutValue(const std::string& theValue, const int theRow, const int theColumn);
76  bool HasValue(const int theRow, const int theColumn);
77  std::string GetValue(const int theRow, const int theColumn);
78  void RemoveValue(const int theRow, const int theColumn);
79  const std::string& ID() const;
80  void Restore(DF_Attribute* with);
81  DF_Attribute* NewEmpty() const;
82  void Paste(DF_Attribute* into);
83 
84  std::vector<int> GetSetRowIndices(const int theRow);
85  std::vector<int> GetSetColumnIndices(const int theColumn);
86 
87  std::vector<int> SortRow(const int theRow, SortOrder sortOrder, SortPolicy sortPolicy);
88  std::vector<int> SortColumn(const int theColumn, SortOrder sortOrder, SortPolicy sortPolicy);
89  std::vector<int> SortByRow(const int theRow, SortOrder sortOrder, SortPolicy sortPolicy);
90  std::vector<int> SortByColumn(const int theColumn, SortOrder sortOrder, SortPolicy sortPolicy);
91 
92  void SwapCells(const int theRow1, const int theColumn1, const int theRow2, const int theColumn2);
93  void SwapRows(const int theRow1, const int theRow2);
94  void SwapColumns(const int theColumn1, const int theColumn2);
95 
97 
98 private:
99  std::map<int, std::string> myTable;
100  std::string myTitle;
101  std::vector<std::string> myRows;
102  std::vector<std::string> myCols;
103  int myNbRows;
105 };
106 
107 #endif