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