Salome HOME
73fe3d7ded337819b4e5ca8dbfbb7aa69755ac32
[modules/shaper.git] / src / ModelAPI / ModelAPI_Data.h
1 // File:        ModelAPI_Data.hxx
2 // Created:     21 Mar 2014
3 // Author:      Mikhail PONIKAROV
4
5 #ifndef ModelAPI_Data_HeaderFile
6 #define ModelAPI_Data_HeaderFile
7
8 #include "ModelAPI.h"
9 #include <string>
10 #include <boost/shared_ptr.hpp>
11
12 class ModelAPI_AttributeDocRef;
13 class ModelAPI_AttributeDouble;
14 class ModelAPI_Document;
15
16 /**\class ModelAPI_Data
17  * \ingroup DataModel
18  * \brief General object of the application that allows
19  * to get/set attributes from the document and compute result of an operation.
20  */
21
22 class MODELAPI_EXPORT ModelAPI_Data
23 {
24 public:
25
26   /// Returns the name of the feature visible by the user in the object browser
27   virtual std::string getName() = 0;
28
29   /// Defines the name of the feature visible by the user in the object browser
30   virtual void setName(std::string theName) = 0;
31
32   /// Returns the attribute that references to another document
33   virtual boost::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID) = 0;
34   /// Returns the attribute that contains real value with double precision
35   virtual boost::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID) = 0;
36
37   /// Initializes object by the attributes: must be called just after the object is created
38   /// for each attribute of the object
39   /// \param theID identifier of the attribute that can be referenced by this ID later
40   /// \param theAttrType type of the created attribute (received from the type method)
41   virtual void addAttribute(std::string theID, std::string theAttrType) = 0;
42
43   /// Returns the document of this data
44   virtual boost::shared_ptr<ModelAPI_Document> document() = 0;
45
46   /// To virtually destroy the fields of successors
47   virtual ~ModelAPI_Data() {}
48
49 protected:
50   /// Objects are created for features automatically
51   ModelAPI_Data()
52   {}
53 };
54
55 #endif