Salome HOME
Error message correction for the following case, found by squish:
[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 typeId()
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   /// Appends the feature to the end of a list
32   virtual void append(ObjectPtr theObject) = 0;
33
34   /// Erases the first meet of the feature in the list
35   virtual void remove(ObjectPtr theObject) = 0;
36
37   /// Removes all references from the list
38   virtual void clear() = 0;
39
40   /// Returns number of features in the list
41   ///\param theWithEmpty if it is false, returns the number of not-empty referenced objects
42   virtual int size(const bool theWithEmpty = true) const = 0;
43
44   /// Returns the list of features
45   virtual std::list<ObjectPtr> list() = 0;
46
47   /// Returns true if the object is in list
48   virtual bool isInList(const ObjectPtr& theObj) = 0;
49
50   /// Returns the referenced object by the zero-based index
51   ///\param theIndex zero-based index in the list
52   ///\param theWithEmpty if it is false, counts the not-empty referenced objects only
53   virtual ObjectPtr object(const int theIndex, const bool theWithEmpty = true) const = 0;
54
55   /// Substitutes the object by another one. Does nothing if such object is not found.
56   virtual void substitute(const ObjectPtr& theCurrent, const ObjectPtr& theNew) = 0;
57
58   /// Substitutes the object by another one and back. So, features wil become exchanged in the list
59   virtual void exchange(const ObjectPtr& theObject1, const ObjectPtr& theObject2) = 0;
60
61   /// Removes the last element in the list.
62   virtual void removeLast() = 0;
63
64   MODELAPI_EXPORT virtual ~ModelAPI_AttributeRefList();
65  protected:
66   /// Objects are created for features automatically
67   MODELAPI_EXPORT ModelAPI_AttributeRefList();
68
69 };
70
71 typedef std::shared_ptr<ModelAPI_AttributeRefList> AttributeRefListPtr;
72
73 #endif