blob: bad55c3a870f383f8858d29ee8c2e4cec86f7169 (
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
|
#include <Handle_Standard_Transient.hxx>
#include <Standard_Atomic.hxx>
//============================================================================
void Handle(Standard_Transient)::Dump(Standard_OStream& out) const
{
out << Access();
}
//============================================================================
void Handle(Standard_Transient)::Assign (const Standard_Transient *anItem)
{
Standard_Transient *anIt = ( anItem ? (Standard_Transient*)anItem : UndefinedHandleAddress );
if ( anIt == entity ) return;
EndScope();
entity = anIt;
BeginScope();
}
//============================================================================
void Handle(Standard_Transient)::BeginScope()
{
if (entity != UndefinedHandleAddress)
{
Standard_Atomic_Increment (&entity->count);
}
}
//============================================================================
void Handle(Standard_Transient)::EndScope()
{
if (entity == UndefinedHandleAddress)
return;
if (Standard_Atomic_Decrement (&entity->count) == 0)
entity->Delete();
entity = UndefinedHandleAddress;
}
|