SHAPER  9.12.0
Model_AttributeRefAttrList.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef Model_AttributeRefAttrList_H_
21 #define Model_AttributeRefAttrList_H_
22 
23 #include "Model.h"
24 #include "ModelAPI_AttributeRefAttrList.h"
25 #include "ModelAPI_Feature.h"
26 
27 #include <TDF_Label.hxx>
28 #include <TDataStd_ReferenceList.hxx>
29 #include <TDataStd_ExtStringList.hxx>
30 
38 {
39  TDF_Label myLab;
40  Handle_TDataStd_ReferenceList myRef;
41  Handle_TDataStd_ExtStringList myIDs;
42  public:
44  MODEL_EXPORT virtual void append(ObjectPtr theObject);
46  MODEL_EXPORT virtual void append(AttributePtr theAttr);
47 
49  MODEL_EXPORT virtual void remove(ObjectPtr theObject);
51  MODEL_EXPORT virtual void remove(AttributePtr theAttr);
52 
54  MODEL_EXPORT virtual void clear();
55 
57  MODEL_EXPORT virtual int size() const;
58 
60  MODEL_EXPORT virtual std::list<std::pair<ObjectPtr, AttributePtr> > list();
61 
63  MODEL_EXPORT virtual bool isInList(const ObjectPtr& theObj);
65  MODEL_EXPORT virtual bool isInList(const AttributePtr& theObj);
66 
68  MODEL_EXPORT virtual bool isAttribute(const int theIndex) const;
69 
72  MODEL_EXPORT virtual ObjectPtr object(const int theIndex) const;
75  MODEL_EXPORT virtual AttributePtr attribute(const int theIndex) const;
76 
78  MODEL_EXPORT virtual void removeLast();
79 
82  MODEL_EXPORT virtual void remove(const std::set<int>& theIndices);
83 
85  MODEL_EXPORT virtual bool isInitialized();
86  protected:
88  MODEL_EXPORT Model_AttributeRefAttrList(TDF_Label& theLabel);
90  virtual void reinit();
91 
92  friend class Model_Data;
93 };
94 
95 #endif
Attribute that contains list of references to features (located in the same document) or references t...
Definition: ModelAPI_AttributeRefAttrList.h:34
Attribute that contains list of references to features (located in the same document) or references t...
Definition: Model_AttributeRefAttrList.h:38
virtual std::list< std::pair< ObjectPtr, AttributePtr > > list()
Returns the list of features and attributes (if it is reference to the attribute)
Definition: Model_AttributeRefAttrList.cpp:150
virtual bool isInitialized()
Returns true if attribute was initialized by some value.
Definition: Model_AttributeRefAttrList.cpp:142
virtual int size() const
Returns number of features in the list.
Definition: Model_AttributeRefAttrList.cpp:137
virtual bool isInList(const ObjectPtr &theObj)
Returns true if the object is in list.
Definition: Model_AttributeRefAttrList.cpp:174
virtual void reinit()
Reinitializes the internal state of the attribute (may be needed on undo/redo, abort,...
Definition: Model_AttributeRefAttrList.cpp:334
virtual void append(ObjectPtr theObject)
Appends the feature to the end of a list.
Definition: Model_AttributeRefAttrList.cpp:28
virtual bool isAttribute(const int theIndex) const
Returns true if this is reference to an attribute, not just object.
Definition: Model_AttributeRefAttrList.cpp:227
Model_AttributeRefAttrList(TDF_Label &theLabel)
Objects are created for features automatically.
Definition: Model_AttributeRefAttrList.cpp:328
virtual void remove(ObjectPtr theObject)
Erases the first meet of the feature in the list.
Definition: Model_AttributeRefAttrList.cpp:58
virtual ObjectPtr object(const int theIndex) const
Returns the referenced object by the zero-based index.
Definition: Model_AttributeRefAttrList.cpp:241
virtual void removeLast()
Removes the last element in the list.
Definition: Model_AttributeRefAttrList.cpp:285
virtual void clear()
Removes all references from the list.
Definition: Model_AttributeRefAttrList.cpp:125
virtual AttributePtr attribute(const int theIndex) const
Returns the referenced attribute by the zero-based index.
Definition: Model_AttributeRefAttrList.cpp:261
General object of the application that allows to get/set attributes from the document and compute res...
Definition: Model_Data.h:61