1 // SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File : SALOMEDS_TargetAttribute.cxx
25 // Author : Yves FRICAUD
29 #include "SALOMEDS_TargetAttribute.ixx"
30 #include <TDF_Reference.hxx>
31 #include <TDF_ListIteratorOfAttributeList.hxx>
32 #include "utilities.h"
35 //=======================================================================
38 //=======================================================================
40 const Standard_GUID& SALOMEDS_TargetAttribute::GetID ()
42 static Standard_GUID SALOMEDS_TargetAttributeID ("12837197-8F52-11d6-A8A3-0001021E8C7F");
43 return SALOMEDS_TargetAttributeID;
48 //=======================================================================
51 //=======================================================================
53 Handle(SALOMEDS_TargetAttribute) SALOMEDS_TargetAttribute::Set (const TDF_Label& L)
55 Handle(SALOMEDS_TargetAttribute) A;
56 if (!L.FindAttribute(SALOMEDS_TargetAttribute::GetID(),A)) {
57 A = new SALOMEDS_TargetAttribute();
64 //=======================================================================
65 //function : constructor
67 //=======================================================================
68 SALOMEDS_TargetAttribute::SALOMEDS_TargetAttribute()
71 //=======================================================================
74 //=======================================================================
76 void SALOMEDS_TargetAttribute::Append(TDF_Label& theReferencedObject) {
78 Handle(TDF_Reference) aReference;
79 if (theReferencedObject.FindAttribute(TDF_Reference::GetID(),aReference)) {
80 TDF_ListIteratorOfAttributeList anIter(GetVariables());
81 for(;anIter.More();anIter.Next()) if(anIter.Value()->Label() == theReferencedObject) return; //BugID: PAL6192
82 GetVariables().Append(aReference);
84 MESSAGE("SALOMEDS_TargetAttribute::Append: can't append referenced object");
88 //=======================================================================
91 //=======================================================================
92 void SALOMEDS_TargetAttribute::Get(TDF_LabelList& theReferencedObjects) {
93 theReferencedObjects.Clear();
94 TDF_ListIteratorOfAttributeList anIter(GetVariables());
95 for(;anIter.More();anIter.Next()) {
96 theReferencedObjects.Append(anIter.Value()->Label());
100 //=======================================================================
103 //=======================================================================
104 void SALOMEDS_TargetAttribute::Remove(TDF_Label& theReferencedObject) {
106 TDF_ListIteratorOfAttributeList anIter(GetVariables());
107 for(;anIter.More();anIter.Next()) {
108 if (anIter.Value()->Label() == theReferencedObject) {
109 GetVariables().Remove(anIter);
113 MESSAGE("SALOMEDS_TargetAttribute::Remove: nothing to remove");
116 //=======================================================================
119 //=======================================================================
121 const Standard_GUID& SALOMEDS_TargetAttribute::ID () const { return GetID(); }