2 // File : SALOMEDS_TargetAttribute.cxx
3 // Created : Fri Aug 16 10:20:05 2002
4 // Author : Yves FRICAUD
7 // Copyright : Open CASCADE 2001
10 #include "SALOMEDS_TargetAttribute.ixx"
11 #include <TDF_Reference.hxx>
12 #include <TDF_ListIteratorOfAttributeList.hxx>
13 #include "utilities.h"
15 //=======================================================================
18 //=======================================================================
20 const Standard_GUID& SALOMEDS_TargetAttribute::GetID ()
22 static Standard_GUID SALOMEDS_TargetAttributeID ("12837197-8F52-11d6-A8A3-0001021E8C7F");
23 return SALOMEDS_TargetAttributeID;
28 //=======================================================================
31 //=======================================================================
33 Handle(SALOMEDS_TargetAttribute) SALOMEDS_TargetAttribute::Set (const TDF_Label& L)
35 Handle(SALOMEDS_TargetAttribute) A;
36 if (!L.FindAttribute(SALOMEDS_TargetAttribute::GetID(),A)) {
37 A = new SALOMEDS_TargetAttribute();
44 //=======================================================================
45 //function : constructor
47 //=======================================================================
48 SALOMEDS_TargetAttribute::SALOMEDS_TargetAttribute()
51 //=======================================================================
54 //=======================================================================
56 void SALOMEDS_TargetAttribute::Append(TDF_Label& theReferencedObject) {
58 Handle(TDF_Reference) aReference;
59 if (theReferencedObject.FindAttribute(TDF_Reference::GetID(),aReference)) {
60 GetVariables().Append(aReference);
62 MESSAGE("SALOMEDS_TargetAttribute::Append: can't append referenced object");
66 //=======================================================================
69 //=======================================================================
70 void SALOMEDS_TargetAttribute::Get(TDF_LabelList& theReferencedObjects) {
71 theReferencedObjects.Clear();
72 TDF_ListIteratorOfAttributeList anIter(GetVariables());
73 for(;anIter.More();anIter.Next()) {
74 theReferencedObjects.Append(anIter.Value()->Label());
78 //=======================================================================
81 //=======================================================================
82 void SALOMEDS_TargetAttribute::Remove(TDF_Label& theReferencedObject) {
84 TDF_ListIteratorOfAttributeList anIter(GetVariables());
85 for(;anIter.More();anIter.Next()) {
86 if (anIter.Value()->Label() == theReferencedObject) {
87 GetVariables().Remove(anIter);
91 MESSAGE("SALOMEDS_TargetAttribute::Remove: nothing to remove");
94 //=======================================================================
97 //=======================================================================
99 const Standard_GUID& SALOMEDS_TargetAttribute::ID () const { return GetID(); }