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 Model_AttributeDoubleArray_H_
22 #define Model_AttributeDoubleArray_H_
26 #include <ModelAPI_AttributeDoubleArray.h>
28 #include <TDF_Label.hxx>
29 #include <TDataStd_RealArray.hxx>
33 /// \class Model_AttributeDoubleArray
34 /// \ingroup DataModel
35 /// \brief API for the attribute that contains several double in the array inside.
36 class Model_AttributeDoubleArray: public ModelAPI_AttributeDoubleArray
39 /// Returns the size of the array (zero means that it is empty)
40 MODEL_EXPORT virtual int size();
42 /// Sets the new size of the array. The previous data is erased.
43 MODEL_EXPORT virtual void setSize(const int theSize);
45 /// Defines the value of the array by index [0; size-1]
46 MODEL_EXPORT virtual void setValue(const int theIndex,
47 const double theValue);
49 /// Returns the value by the index
50 MODEL_EXPORT virtual double value(const int theIndex);
53 /// Initializes attibutes
54 Model_AttributeDoubleArray(TDF_Label& theLabel);
55 /// Reinitializes the internal state of the attribute (may be needed on undo/redo, abort, etc)
56 virtual void reinit();
59 /// The OCCT array that keeps all values.
60 Handle_TDataStd_RealArray myArray;
62 /// Stores the label as a field to set array if size is not null (null array is buggy in OCAF)
65 friend class Model_Data;