1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModelAPI_AttributeTables.h
4 // Created: 14 Nov 2016
5 // Author: Mikhail Ponikarov
7 #ifndef ModelAPI_AttributeTables_H_
8 #define ModelAPI_AttributeTables_H_
11 #include <ModelAPI_Attribute.h>
15 /// \class ModelAPI_AttributeTables
16 /// \ingroup DataModel
17 /// \brief API for the attribute that contains tables of some values type.
19 /// The type of values can be changed. But all the values in the tables must have the same one
20 /// type. The currently allowed types now are: Boolean, Integer, Double, String.
21 /// By default there is only one table, but it may be increased/decreased by adding/removing
22 /// tables one by one.
23 /// The number of rows and columns are equal in all tables. If table, row or column is added,
24 /// the previous values are kept unchanged. New cells are filled by zero, false or empty strings.
25 class ModelAPI_AttributeTables: public ModelAPI_Attribute
28 /// Type of the value in the table
43 /// Returns the number of rows in the table
44 MODELAPI_EXPORT virtual int rows() = 0;
45 /// Returns the number of columns in the table
46 MODELAPI_EXPORT virtual int columns() = 0;
47 /// Returns the number of tables
48 MODELAPI_EXPORT virtual int tables() = 0;
50 /// Sets the new size of the tables set. This method tries to keep old values if number of
51 /// rows, columns or tables is increased.
52 MODELAPI_EXPORT virtual void setSize(
53 const int theRows, const int theColumns, const int theTables = 1) = 0;
55 /// Defines the tyoe of values in the table. If it differs from the current, erases the content.
56 MODELAPI_EXPORT virtual void setType(ValueType theType) = 0;
57 /// Defines the tyoe of values in the table. If it differs from the current, erases the content.
58 MODELAPI_EXPORT virtual const ValueType& type() const = 0;
59 /// Defines the value by the index in the tables set (indexes are zero-based).
60 MODELAPI_EXPORT virtual void setValue(
61 const Value theValue, const int theRow, const int theColumn, const int theTable = 0) = 0;
62 /// Returns the value by the index (indexes are zero-based).
63 MODELAPI_EXPORT virtual Value value(
64 const int theRow, const int theColumn, const int theTable = 0) = 0;
66 /// Returns the value in the format of string (usefull for the python connection)
67 MODELAPI_EXPORT virtual std::string valueStr(
68 const int theRow, const int theColumn, const int theTable = 0) = 0;
70 /// Returns the type of this class of attributes
71 MODELAPI_EXPORT static std::string typeId()
75 /// Returns the type of this class of attributes, not static method
76 MODELAPI_EXPORT virtual std::string attributeType();
77 /// To virtually destroy the fields of successors
78 MODELAPI_EXPORT virtual ~ModelAPI_AttributeTables();
81 /// Objects are created for features automatically
82 MODELAPI_EXPORT ModelAPI_AttributeTables();
85 /// Pointer on double attribute
86 typedef std::shared_ptr<ModelAPI_AttributeTables> AttributeTablesPtr;