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