1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef ModelAPI_AttributeTables_H_
21 #define ModelAPI_AttributeTables_H_
24 #include <ModelAPI_Attribute.h>
28 /// \class ModelAPI_AttributeTables
29 /// \ingroup DataModel
30 /// \brief API for the attribute that contains tables of some values type.
32 /// The type of values can be changed. But all the values in the tables must have the same one
33 /// type. The currently allowed types now are: Boolean, Integer, Double, String.
34 /// By default there is only one table, but it may be increased/decreased by adding/removing
35 /// tables one by one.
36 /// The number of rows and columns are equal in all tables. If table, row or column is added,
37 /// the previous values are kept unchanged. New cells are filled by zero, false or empty strings.
38 class ModelAPI_AttributeTables: public ModelAPI_Attribute
41 /// Type of the value in the table
56 /// Returns the number of rows in the table
57 MODELAPI_EXPORT virtual int rows() = 0;
58 /// Returns the number of columns in the table
59 MODELAPI_EXPORT virtual int columns() = 0;
60 /// Returns the number of tables
61 MODELAPI_EXPORT virtual int tables() = 0;
63 /// Sets the new size of the tables set. This method tries to keep old values if number of
64 /// rows, columns or tables is increased.
65 MODELAPI_EXPORT virtual void setSize(
66 const int theRows, const int theColumns, const int theTables = 1) = 0;
68 /// Defines the tyoe of values in the table. If it differs from the current, erases the content.
69 MODELAPI_EXPORT virtual void setType(ValueType theType) = 0;
70 /// Defines the tyoe of values in the table. If it differs from the current, erases the content.
71 MODELAPI_EXPORT virtual const ValueType& type() const = 0;
72 /// Defines the value by the index in the tables set (indexes are zero-based).
73 MODELAPI_EXPORT virtual void setValue(
74 const Value theValue, const int theRow, const int theColumn, const int theTable = 0) = 0;
75 /// Returns the value by the index (indexes are zero-based).
76 MODELAPI_EXPORT virtual Value value(
77 const int theRow, const int theColumn, const int theTable = 0) = 0;
79 /// Returns the value in the format of string (usefull for the python connection)
80 MODELAPI_EXPORT virtual std::string valueStr(
81 const int theRow, const int theColumn, const int theTable = 0) = 0;
83 /// Returns the type of this class of attributes
84 MODELAPI_EXPORT static std::string typeId()
88 /// Returns the type of this class of attributes, not static method
89 MODELAPI_EXPORT virtual std::string attributeType();
90 /// To virtually destroy the fields of successors
91 MODELAPI_EXPORT virtual ~ModelAPI_AttributeTables();
94 /// Objects are created for features automatically
95 MODELAPI_EXPORT ModelAPI_AttributeTables();
98 /// Pointer on double attribute
99 typedef std::shared_ptr<ModelAPI_AttributeTables> AttributeTablesPtr;