Salome HOME
ecaca8920761a0f9e736b38f9997bf59bbe5bce0
[modules/shaper.git] / src / Model / Model_Object.h
1 // File:        Model_Object.hxx
2 // Created:     21 Mar 2014
3 // Author:      Mikhail PONIKAROV
4
5 #ifndef Model_Object_HeaderFile
6 #define Model_Object_HeaderFile
7
8 #include "Model.h"
9 #include <ModelAPI_Object.h>
10 #include <TDF_Label.hxx>
11
12 #include <map>
13
14 class ModelAPI_Attribute;
15
16 /**\class Model_Object
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 Model_Object: public ModelAPI_Object
23 {
24   TDF_Label myLab; ///< label of the feature in the document
25   /// All attributes of the object identified by the attribute ID
26   std::map<std::string, std::shared_ptr<ModelAPI_Attribute> > myAttrs;
27
28   Model_Object();
29
30   friend class Model_Document;
31
32 public:
33   /// Returns the name of the feature visible by the user in the object browser
34   virtual std::string getName();
35   /// Defines the name of the feature visible by the user in the object browser
36   virtual void setName(std::string theName);
37   /// Returns the attribute that references to another document
38   virtual std::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID);
39   /// Returns the attribute that contains real value with double precision
40   virtual std::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID);
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);
47
48   /// Puts feature to the document data sub-structure
49   void setLabel(TDF_Label& theLab);
50 };
51
52 #endif