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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SALOMEDS_TargetAttribute.cxx
25 // Author : Yves FRICAUD
30 #include "SALOMEDS_TargetAttribute.ixx"
31 #include <TDF_Reference.hxx>
32 #include <TDF_ListIteratorOfAttributeList.hxx>
33 #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 GetVariables().Append(aReference);
82 MESSAGE("SALOMEDS_TargetAttribute::Append: can't append referenced object");
86 //=======================================================================
89 //=======================================================================
90 void SALOMEDS_TargetAttribute::Get(TDF_LabelList& theReferencedObjects) {
91 theReferencedObjects.Clear();
92 TDF_ListIteratorOfAttributeList anIter(GetVariables());
93 for(;anIter.More();anIter.Next()) {
94 theReferencedObjects.Append(anIter.Value()->Label());
98 //=======================================================================
101 //=======================================================================
102 void SALOMEDS_TargetAttribute::Remove(TDF_Label& theReferencedObject) {
104 TDF_ListIteratorOfAttributeList anIter(GetVariables());
105 for(;anIter.More();anIter.Next()) {
106 if (anIter.Value()->Label() == theReferencedObject) {
107 GetVariables().Remove(anIter);
111 MESSAGE("SALOMEDS_TargetAttribute::Remove: nothing to remove");
114 //=======================================================================
117 //=======================================================================
119 const Standard_GUID& SALOMEDS_TargetAttribute::ID () const { return GetID(); }