Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / ModelAPI / ModelAPI_AttributeIntArray.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_AttributeIntArray.h
4 // Created:     6 Mar 2015
5 // Author:      Natalia ERMOLAEVA
6
7 #ifndef ModelAPI_AttributeIntArray_H_
8 #define ModelAPI_AttributeIntArray_H_
9
10 #include <ModelAPI.h>
11 #include <ModelAPI_Attribute.h>
12
13 #include <string>
14
15
16 /**\class ModelAPI_AttributeIntArray
17  * \ingroup DataModel
18  * \brief API for the attribute that contains several integers in the array inside.
19  * Used for RGB color storage for an example. By default size is one, zero-based.
20  */
21
22 class ModelAPI_AttributeIntArray : public ModelAPI_Attribute
23 {
24  public:
25
26   /// Returns the size of the array (zero means that it is empty)
27   MODELAPI_EXPORT virtual int size() = 0;
28
29   /// Sets the new size of the array. The previous data is erased.
30   MODELAPI_EXPORT virtual void setSize(const int theSize) = 0;
31
32   /// Defines the value of the array by index [0; size-1]
33   MODELAPI_EXPORT virtual void setValue(const int theIndex,
34                                          const int theValue) = 0;
35
36   /// Returns the value by the index
37   MODELAPI_EXPORT virtual int value(const int theIndex) = 0;
38
39   /// Returns the type of this class of attributes
40   MODELAPI_EXPORT static std::string type()
41   {
42     return "IntArray";
43   }
44
45   /// Returns the type of this class of attributes, not static method
46   MODELAPI_EXPORT virtual std::string attributeType();
47
48   /// To virtually destroy the fields of successors
49   MODELAPI_EXPORT virtual ~ModelAPI_AttributeIntArray();
50
51  protected:
52   /// Objects are created for features automatically
53   MODELAPI_EXPORT ModelAPI_AttributeIntArray();
54 };
55
56 //! Pointer on double attribute
57 typedef std::shared_ptr<ModelAPI_AttributeIntArray> AttributeIntArrayPtr;
58
59 #endif