1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef ModelAPI_AttributeTables_H_
22 #define ModelAPI_AttributeTables_H_
25 #include <ModelAPI_Attribute.h>
29 /// \class ModelAPI_AttributeTables
30 /// \ingroup DataModel
31 /// \brief API for the attribute that contains tables of some values type.
33 /// The type of values can be changed. But all the values in the tables must have the same one
34 /// type. The currently allowed types now are: Boolean, Integer, Double, String.
35 /// By default there is only one table, but it may be increased/decreased by adding/removing
36 /// tables one by one.
37 /// The number of rows and columns are equal in all tables. If table, row or column is added,
38 /// the previous values are kept unchanged. New cells are filled by zero, false or empty strings.
39 class ModelAPI_AttributeTables: public ModelAPI_Attribute
42 /// Type of the value in the table
57 /// Returns the number of rows in the table
58 MODELAPI_EXPORT virtual int rows() = 0;
59 /// Returns the number of columns in the table
60 MODELAPI_EXPORT virtual int columns() = 0;
61 /// Returns the number of tables
62 MODELAPI_EXPORT virtual int tables() = 0;
64 /// Sets the new size of the tables set. This method tries to keep old values if number of
65 /// rows, columns or tables is increased.
66 MODELAPI_EXPORT virtual void setSize(
67 const int theRows, const int theColumns, const int theTables = 1) = 0;
69 /// Defines the tyoe of values in the table. If it differs from the current, erases the content.
70 MODELAPI_EXPORT virtual void setType(ValueType theType) = 0;
71 /// Defines the tyoe of values in the table. If it differs from the current, erases the content.
72 MODELAPI_EXPORT virtual const ValueType& type() const = 0;
73 /// Defines the value by the index in the tables set (indexes are zero-based).
74 MODELAPI_EXPORT virtual void setValue(
75 const Value theValue, const int theRow, const int theColumn, const int theTable = 0) = 0;
76 /// Returns the value by the index (indexes are zero-based).
77 MODELAPI_EXPORT virtual Value value(
78 const int theRow, const int theColumn, const int theTable = 0) = 0;
80 /// Returns the value in the format of string (usefull for the python connection)
81 MODELAPI_EXPORT virtual std::string valueStr(
82 const int theRow, const int theColumn, const int theTable = 0) = 0;
84 /// Returns the type of this class of attributes
85 MODELAPI_EXPORT static std::string typeId()
89 /// Returns the type of this class of attributes, not static method
90 MODELAPI_EXPORT virtual std::string attributeType();
91 /// To virtually destroy the fields of successors
92 MODELAPI_EXPORT virtual ~ModelAPI_AttributeTables();
95 /// Objects are created for features automatically
96 MODELAPI_EXPORT ModelAPI_AttributeTables();
99 /// Pointer on double attribute
100 typedef std::shared_ptr<ModelAPI_AttributeTables> AttributeTablesPtr;