Version: 9.16.0
SALOMEDSImpl_AttributeTableOfInteger.hxx
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, 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_AttributeTableOfInteger.hxx
25// Author : Michael Ponikarov
26// Module : SALOME
27//
28#ifndef _SALOMEDSImpl_AttributeTableOfInteger_HeaderFile
29#define _SALOMEDSImpl_AttributeTableOfInteger_HeaderFile
30
32#include "DF_Attribute.hxx"
33#include "DF_Label.hxx"
36
37#include <string>
38#include <vector>
39#include <map>
40
41
44{
45
46public:
47 virtual std::string Save();
48 virtual void Load(const std::string&);
49
50 static const std::string& GetID();
51 static SALOMEDSImpl_AttributeTableOfInteger* Set(const DF_Label& label);
52
54
55 void SetNbColumns(const int theNbColumns);
56 void SetTitle(const std::string& theTitle);
57 std::string GetTitle() const;
58 void SetRowData(const int theRow, const std::vector<int>& theData);
59 std::vector<int> GetRowData(const int theRow);
60 void SetRowTitle(const int theRow, const std::string& theTitle);
61 void SetRowUnit(const int theRow, const std::string& theUnit);
62 std::string GetRowUnit(const int theRow) const;
63 void SetRowUnits(const std::vector<std::string>& theUnits);
64 std::vector<std::string> GetRowUnits();
65 void SetRowTitles(const std::vector<std::string>& theTitles);
66 std::vector<std::string> GetRowTitles();
67 std::string GetRowTitle(const int theRow) const;
68 void SetColumnData(const int theColumn, const std::vector<int>& theData);
69 std::vector<int> GetColumnData(const int theColumn);
70 void SetColumnTitle(const int theColumn, const std::string& theTitle);
71 std::string GetColumnTitle(const int theColumn) const;
72 void SetColumnTitles(const std::vector<std::string>& theTitles);
73 std::vector<std::string> GetColumnTitles();
74 int GetNbRows() const;
75 int GetNbColumns() const;
76
77 void PutValue(const int theValue, const int theRow, const int theColumn);
78 bool HasValue(const int theRow, const int theColumn);
79 int GetValue(const int theRow, const int theColumn);
80 void RemoveValue(const int theRow, const int theColumn);
81 const std::string& ID() const;
82 void Restore(DF_Attribute* with);
83 DF_Attribute* NewEmpty() const;
84 void Paste(DF_Attribute* into);
85
86 std::vector<int> GetSetRowIndices(const int theRow);
87 std::vector<int> GetSetColumnIndices(const int theColumn);
88
89 std::vector<int> SortRow(const int theRow, SortOrder sortOrder, SortPolicy sortPolicy);
90 std::vector<int> SortColumn(const int theColumn, SortOrder sortOrder, SortPolicy sortPolicy);
91 std::vector<int> SortByRow(const int theRow, SortOrder sortOrder, SortPolicy sortPolicy);
92 std::vector<int> SortByColumn(const int theColumn, SortOrder sortOrder, SortPolicy sortPolicy);
93
94 void SwapCells(const int theRow1, const int theColumn1, const int theRow2, const int theColumn2);
95 void SwapRows(const int theRow1, const int theRow2);
96 void SwapColumns(const int theColumn1, const int theColumn2);
97
99
100private:
101 std::map<int, int> myTable;
102 std::string myTitle;
103 std::vector<std::string> myRows;
104 std::vector<std::string> myCols;
107};
108
109#endif
#define SALOMEDSIMPL_EXPORT
Definition: SALOMEDSImpl_Defines.hxx:34
Definition: DF_Attribute.hxx:30
virtual void Restore(DF_Attribute *theAttribute)=0
virtual const std::string & ID() const =0
virtual std::string Save()
Definition: DF_Attribute.hxx:47
virtual DF_Attribute * NewEmpty() const =0
virtual void Load(const std::string &)
Definition: DF_Attribute.hxx:48
virtual void Paste(DF_Attribute *theIntoAttribute)=0
Definition: DF_Label.hxx:65
Definition: SALOMEDSImpl_AttributeTableOfInteger.hxx:44
int myNbRows
Definition: SALOMEDSImpl_AttributeTableOfInteger.hxx:105
std::string myTitle
Definition: SALOMEDSImpl_AttributeTableOfInteger.hxx:102
std::vector< std::string > myRows
Definition: SALOMEDSImpl_AttributeTableOfInteger.hxx:103
std::map< int, int > myTable
Definition: SALOMEDSImpl_AttributeTableOfInteger.hxx:101
std::vector< std::string > myCols
Definition: SALOMEDSImpl_AttributeTableOfInteger.hxx:104
int myNbColumns
Definition: SALOMEDSImpl_AttributeTableOfInteger.hxx:106
~SALOMEDSImpl_AttributeTableOfInteger()
Definition: SALOMEDSImpl_AttributeTableOfInteger.hxx:98
Definition: SALOMEDSImpl_AttributeTable.hxx:29
SortPolicy
Sort policy (specifies how empty cells are taken into account when sorting)
Definition: SALOMEDSImpl_AttributeTable.hxx:38
SortOrder
Sort order.
Definition: SALOMEDSImpl_AttributeTable.hxx:32
Definition: SALOMEDSImpl_GenericAttribute.hxx:39