]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelAPI/ModelAPI_AttributeRefAttrList.h
Salome HOME
Implementation of AttributeRefAttrList for a fillet created in the list of points.
[modules/shaper.git] / src / ModelAPI / ModelAPI_AttributeRefAttrList.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModelAPI_AttributeRefAttrList.h
4 // Created:     20 Jan 2016
5 // Author:      Mikhail PONIKAROV
6
7 #ifndef ModelAPI_AttributeRefAttrList_H_
8 #define ModelAPI_AttributeRefAttrList_H_
9
10 #include "ModelAPI_Attribute.h"
11 #include "ModelAPI_Feature.h"
12 #include <list>
13
14 /**\class ModelAPI_AttributeRefAttrList
15  * \ingroup DataModel
16  * \brief Attribute that contains list of references to features (located in the same document)
17  * or references to attributes of the features (list of AttributeRefAttr)
18  */
19
20 class ModelAPI_AttributeRefAttrList : public ModelAPI_Attribute
21 {
22  public:
23   /// Returns the type of this class of attributes
24   MODELAPI_EXPORT static std::string typeId()
25   {
26     return "RefAttrList";
27   }
28
29   /// Returns the type of this class of attributes, not static method
30   MODELAPI_EXPORT virtual std::string attributeType();
31
32   /// Appends the feature to the end of a list
33   virtual void append(ObjectPtr theObject) = 0;
34   /// Appends the attribute to the end of a list
35   virtual void append(AttributePtr theAttr) = 0;
36
37   /// Erases the first meet of the feature in the list
38   virtual void remove(ObjectPtr theObject) = 0;
39   /// Erases the first meet of the attribute in the list
40   virtual void remove(AttributePtr theAttr) = 0;
41
42   /// Removes all references from the list
43   virtual void clear() = 0;
44
45   /// Returns number of features in the list
46   ///\param theWithEmpty if it is false, returns the number of not-empty referenced objects
47   virtual int size(const bool theWithEmpty = true) const = 0;
48
49   /// Returns the list of features and attributes (if it is reference to the attribute)
50   virtual std::list<std::pair<ObjectPtr, AttributePtr> > list() = 0;
51
52   /// Returns true if the object is in list
53   virtual bool isInList(const ObjectPtr& theObj) = 0;
54   /// Returns true if the attribute is in list
55   virtual bool isInList(const AttributePtr& theObj) = 0;
56
57   /// Returns true if this is reference to an attribute, not just object
58   virtual bool isAttribute(const int theIndex) const = 0;
59
60   /// Returns the referenced object by the zero-based index
61   ///\param theIndex zero-based index in the list
62   virtual ObjectPtr object(const int theIndex) const = 0;
63   /// Returns the referenced attribute by the zero-based index
64   ///\param theIndex zero-based index in the list
65   virtual AttributePtr attribute(const int theIndex) const = 0;
66
67   /// Removes the last element in the list.
68   virtual void removeLast() = 0;
69
70   /// Removes the elements from the list.
71   /// \param theIndices a list of indices of elements to be removed
72   virtual void remove(const std::set<int>& theIndices) = 0;
73
74   MODELAPI_EXPORT virtual ~ModelAPI_AttributeRefAttrList();
75  protected:
76   /// Objects are created for features automatically
77   MODELAPI_EXPORT ModelAPI_AttributeRefAttrList();
78
79 };
80
81 typedef std::shared_ptr<ModelAPI_AttributeRefAttrList> AttributeRefAttrListPtr;
82
83 #endif