]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelAPI/ModelAPI_Data.h
Salome HOME
2922f6d9b3891b4875e51e509a96a4d401670c94
[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 class ModelAPI_Attribute;
16
17 /**\class ModelAPI_Data
18  * \ingroup DataModel
19  * \brief General object of the application that allows
20  * to get/set attributes from the document and compute result of an operation.
21  */
22
23 class MODELAPI_EXPORT ModelAPI_Data
24 {
25 public:
26
27   /// Returns the name of the feature visible by the user in the object browser
28   virtual std::string getName() = 0;
29
30   /// Defines the name of the feature visible by the user in the object browser
31   virtual void setName(std::string theName) = 0;
32
33   /// Returns the attribute that references to another document
34   virtual boost::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID) = 0;
35   /// Returns the attribute that contains real value with double precision
36   virtual boost::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID) = 0;
37
38   /// Returns the generic attribute by identifier
39   /// \param theID identifier of the attribute
40   virtual boost::shared_ptr<ModelAPI_Attribute> attribute(const std::string theID) = 0;
41
42   /// Initializes object by the attributes: must be called just after the object is created
43   /// for each attribute of the object
44   /// \param theID identifier of the attribute that can be referenced by this ID later
45   /// \param theAttrType type of the created attribute (received from the type method)
46   virtual void addAttribute(std::string theID, std::string theAttrType) = 0;
47
48   /// To virtually destroy the fields of successors
49   virtual ~ModelAPI_Data() {}
50
51 protected:
52   /// Objects are created for features automatically
53   ModelAPI_Data()
54   {}
55 };
56
57 #endif