this repo has no description
1#include "io_object.h"
2
3io_object::io_object()
4: m_refs(1)
5{
6}
7
8io_object::~io_object()
9{
10}
11
12void io_object::retain()
13{
14 m_refs++;
15}
16
17void io_object::release()
18{
19 if (!(--m_refs))
20 delete this;
21}
22
23int IOObjectRetain(io_object_t obj)
24{
25 obj->retain();
26 return 0;
27}
28
29int IOObjectRelease(io_object_t obj)
30{
31 if (obj)
32 obj->release();
33 return 0;
34}
35
36uint32_t IOObjectGetRetainCount(io_object_t obj)
37{
38 if (!obj)
39 return 0;
40 return obj->refs();
41}
42
43uint32_t IOObjectGetUserRetainCount(io_object_t obj)
44{
45 if (!obj)
46 return 0;
47 return obj->refs();
48}
49
50bool IOObjectIsEqualTo(io_object_t o1, io_object_t o2)
51{
52 if (o1 == o2)
53 return true;
54 if (!o1 || !o2)
55 return false;
56 else
57 return *o1 == *o2;
58}