source: trunk/packages/vizservers/nanovis/R2/include/R2/R2Object.h @ 2798

Last change on this file since 2798 was 2798, checked in by ldelgass, 12 years ago

Add emacs mode magic line in preparation for indentation cleanup

  • Property svn:eol-style set to native
File size: 585 bytes
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2#ifndef __R2_OBJECT_H__
3#define __R2_OBJECT_H__
4
5#include <R2/R2.h>
6
7class R2Object {
8    /**
9     * @brief reference count
10     */
11    R2int32 _refCount;
12
13public :
14    R2Object();
15protected :
16    virtual ~R2Object();
17
18public :
19    R2int32 getRef();
20    R2int32 ref();
21    void unref();
22};
23
24inline R2int32 R2Object::getRef()
25{
26    return _refCount;
27}
28
29inline R2int32 R2Object::ref()
30{
31    return ++_refCount;
32}
33
34inline void R2Object::unref()
35{
36    _refCount--;
37    if (_refCount <= 0) {
38        delete this;
39    }
40}
41
42
43#endif
44
Note: See TracBrowser for help on using the repository browser.