SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RefCount.h
Go to the documentation of this file.
1 #ifdef HAVE_CXX11_ATOMIC
2 #include <atomic>
3 #endif
4 
5 #include <shogun/lib/config.h>
6 
7 #include <shogun/lib/common.h>
8 #include <shogun/lib/Lock.h>
9 
10 #ifndef _REFCOUNT__H__
11 #define _REFCOUNT__H__
12 
13 namespace shogun
14 {
18 class RefCount
19 {
20 public:
25  RefCount(int32_t ref_start=0) : rc(ref_start) {}
26 
31  int32_t ref();
32 
37  int32_t unref();
38 
43  int32_t ref_count();
44 
46 #ifdef HAVE_CXX11_ATOMIC
47  volatile std::atomic<int> rc;
48 #else
49  int32_t rc;
50 
53 #endif
54 };
55 }
56 
57 #endif //_REFCOUNT__H__

SHOGUN Machine Learning Toolbox - Documentation