aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Common/Object.h
blob: 6c9d09352945fc47e38c0a1759555d4460a4a8ad (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
#ifndef __JIN_COMMON_OBJECT_H
#define __JIN_COMMON_OBJECT_H

namespace jin
{

    class Object
    {
    private:

        // The reference count.
        int count;

    public:

        /**
        * Constructor. Sets reference count to one.
        **/
        Object();

        /**
        * Destructor.
        **/
        virtual ~Object() = 0;

        /**
        * Gets the reference count of this Object.
        * @returns The reference count.
        **/
        int getReferenceCount() const;

        /**
        * Retains the Object, i.e. increases the
        * reference count by one.
        **/
        void retain();

        /**
        * Releases one reference to the Object, i.e. decrements the
        * reference count by one, and potentially deletes the Object
        * if there are no more references.
        **/
        void release();

    }; // Object

} // jin

#endif