Salome HOME
Issue #1540: Added attribute for array of double.
[modules/shaper.git] / src / ModelAPI / ModelAPI_AttributeDoubleArray.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_AttributeDoubleArray.h
4 // Created:     08 July 2016
5 // Author:      Dmitry Bobylev
6
7 #ifndef ModelAPI_AttributeDoubleArray_H_
8 #define ModelAPI_AttributeDoubleArray_H_
9
10 #include <ModelAPI.h>
11 #include <ModelAPI_Attribute.h>
12
13 #include <string>
14
15 /// \class ModelAPI_AttributeDoubleArray
16 /// \ingroup DataModel
17 /// \brief API for the attribute that contains several double in the array inside.
18 class ModelAPI_AttributeDoubleArray: public ModelAPI_Attribute
19 {
20 public:
21   /// Returns the size of the array (zero means that it is empty)
22   MODELAPI_EXPORT virtual int size() = 0;
23
24   /// Sets the new size of the array. The previous data is erased.
25   MODELAPI_EXPORT virtual void setSize(const int theSize) = 0;
26
27   /// Defines the value of the array by index [0; size-1]
28   MODELAPI_EXPORT virtual void setValue(const int theIndex,
29                                         const double theValue) = 0;
30
31   /// Returns the value by the index
32   MODELAPI_EXPORT virtual double value(const int theIndex) = 0;
33
34   /// Returns the type of this class of attributes
35   MODELAPI_EXPORT static std::string typeId()
36   {
37     return "DoubleArray";
38   }
39
40   /// Returns the type of this class of attributes, not static method
41   MODELAPI_EXPORT virtual std::string attributeType();
42
43   /// To virtually destroy the fields of successors
44   MODELAPI_EXPORT virtual ~ModelAPI_AttributeDoubleArray();
45
46 protected:
47   /// Objects are created for features automatically
48   MODELAPI_EXPORT ModelAPI_AttributeDoubleArray();
49 };
50
51 /// Pointer on double attribute
52 typedef std::shared_ptr<ModelAPI_AttributeDoubleArray> AttributeDoubleArrayPtr;
53
54 #endif