Salome HOME
Add checking that object is used before the delete operation
[modules/shaper.git] / src / ModelAPI / ModelAPI_AttributeRefList.h
1 // File:        ModelAPI_AttributeRefList.h
2 // Created:     8 May 2014
3 // Author:      Mikhail PONIKAROV
4
5 #ifndef ModelAPI_AttributeRefList_H_
6 #define ModelAPI_AttributeRefList_H_
7
8 #include "ModelAPI_Attribute.h"
9 #include "ModelAPI_Feature.h"
10 #include <list>
11
12 /**\class ModelAPI_AttributeRefList
13  * \ingroup DataModel
14  * \brief Attribute that contains list of references to features (located in the same document).
15  */
16
17 class ModelAPI_AttributeRefList : public ModelAPI_Attribute
18 {
19  public:
20   /// Returns the type of this class of attributes
21   MODELAPI_EXPORT static std::string type()
22   {
23     return "RefList";
24   }
25
26   /// Returns the type of this class of attributes, not static method
27   MODELAPI_EXPORT virtual std::string attributeType()
28   {
29     return type();
30   }
31
32   /// Appends the feature to the end of a list
33   MODELAPI_EXPORT virtual void append(ObjectPtr theObject) = 0;
34
35   /// Erases the first meet of the feature in the list
36   MODELAPI_EXPORT virtual void remove(ObjectPtr theObject) = 0;
37
38   /// Returns number of features in the list
39   MODELAPI_EXPORT virtual int size() = 0;
40
41   /// Returns the list of features
42   MODELAPI_EXPORT virtual std::list<ObjectPtr> list() = 0;
43
44  protected:
45   /// Objects are created for features automatically
46   MODELAPI_EXPORT ModelAPI_AttributeRefList()
47   {
48   }
49 };
50
51 #endif