xref: /haiku/src/kits/debugger/files/LocatableEntry.cpp (revision efafab643ce980e3f3c916795ed302599f6b4f66)
1 /*
2  * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #include "LocatableEntry.h"
7 
8 #include "AutoLocker.h"
9 
10 #include "LocatableDirectory.h"
11 
12 
13 // #pragma mark - LocatableEntryOwner
14 
15 
16 LocatableEntryOwner::~LocatableEntryOwner()
17 {
18 }
19 
20 
21 // #pragma mark - LocatableEntry
22 
23 
24 LocatableEntry::LocatableEntry(LocatableEntryOwner* owner,
25 	LocatableDirectory* parent)
26 	:
27 	fOwner(owner),
28 	fParent(parent),
29 	fState(LOCATABLE_ENTRY_UNLOCATED)
30 {
31 	if (fParent != NULL)
32 		fParent->AcquireReference();
33 }
34 
35 
36 LocatableEntry::~LocatableEntry()
37 {
38 	if (fParent != NULL)
39 		fParent->ReleaseReference();
40 }
41 
42 
43 void
44 LocatableEntry::LastReferenceReleased()
45 {
46 	fOwner->LocatableEntryUnused(this);
47 	delete this;
48 }
49