summaryrefslogtreecommitdiff
path: root/src/TDF/TDF_TagSource.cxx
blob: 0812ee3f233eb928e73d2b7dd088c8debe570d65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// File:	TDF_TagSource.cxx
// Created:	Mon Aug  4 16:26:55 1997
// Author:	VAUTHIER Jean-Claude


#include <TDF_TagSource.ixx>
#include <Standard_GUID.hxx>


//=======================================================================
//function : GetID
//purpose  : 
//=======================================================================

const Standard_GUID& TDF_TagSource::GetID () { 

  static Standard_GUID TDF_TagSourceID("2a96b611-ec8b-11d0-bee7-080009dc3333");
  return TDF_TagSourceID;
}



//=======================================================================
//function : Set
//purpose  : 
//=======================================================================

Handle(TDF_TagSource) TDF_TagSource::Set (const TDF_Label& L) {

  Handle(TDF_TagSource) T;
  if (!L.FindAttribute (TDF_TagSource::GetID (), T)) {
    T = new TDF_TagSource ();
    L.AddAttribute (T);
  }
  return T;
}

//=======================================================================
//function : NewChild
//purpose  : 
//=======================================================================

TDF_Label TDF_TagSource::NewChild (const TDF_Label& L) 
{
  Handle(TDF_TagSource) T;
  if (!L.FindAttribute(GetID(),T)) {
    T = new TDF_TagSource();
    L.AddAttribute(T);
  }
  return T->NewChild();
}



//=======================================================================
//function : TDF_TagSource
//purpose  : 
//=======================================================================

TDF_TagSource::TDF_TagSource () : myTag(0) { }



//=======================================================================
//function : NewTag
//purpose  : 
//=======================================================================

Standard_Integer TDF_TagSource::NewTag ()  {

  Backup(); // FID 02/07/98
  return ++myTag;
}


//=======================================================================
//function : NewChild
//purpose  : 
//=======================================================================

TDF_Label TDF_TagSource::NewChild () {
  return Label().FindChild(NewTag(),Standard_True);
}


//=======================================================================
//function : Get
//purpose  : 
//=======================================================================

Standard_Integer TDF_TagSource::Get() const
{
  return myTag;
}

//=======================================================================
//function : Set
//purpose  : 
//=======================================================================

void TDF_TagSource::Set (const Standard_Integer T) {
  // OCC2932 correction
  if(myTag == T) return;

  Backup (); // FID 02/07/98
  myTag = T;
}


//=======================================================================
//function : ID
//purpose  : 
//=======================================================================

const Standard_GUID& TDF_TagSource::ID() const { return GetID (); }




//=======================================================================
//function : NewEmpty
//purpose  : 
//=======================================================================

Handle(TDF_Attribute) TDF_TagSource::NewEmpty () const
{  
  return new TDF_TagSource (); 
}


//=======================================================================
//function : Restore
//purpose  : 
//=======================================================================

void TDF_TagSource::Restore(const Handle(TDF_Attribute)& With) 
{
  myTag = Handle(TDF_TagSource)::DownCast (With)->Get ();
}



//=======================================================================
//function : Paste
//purpose  : 
//=======================================================================

void TDF_TagSource::Paste (
  const Handle(TDF_Attribute)&       Into,
  const Handle(TDF_RelocationTable)& RT) const
{
  Handle(TDF_TagSource)::DownCast(Into)->Set (myTag);
}