From 7d5f055547e70fa93ee9ac944e62f8d657b9dc55 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 19 Oct 2018 08:36:44 +0800 Subject: =?UTF-8?q?*=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/Common/je_object.h | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/libjin/Common/je_object.h (limited to 'src/libjin/Common/je_object.h') diff --git a/src/libjin/Common/je_object.h b/src/libjin/Common/je_object.h new file mode 100644 index 0000000..c4bf225 --- /dev/null +++ b/src/libjin/Common/je_object.h @@ -0,0 +1,49 @@ +#ifndef __LIBJIN_COMMON_OBJECT_H +#define __LIBJIN_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 + +} // namespace jin + +#endif \ No newline at end of file -- cgit v1.1-26-g67d0