SHOGUN
v3.2.0
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
base
SGRefObject.h
浏览该文件的文档.
1
/*
2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License as published by
4
* the Free Software Foundation; either version 3 of the License, or
5
* (at your option) any later version.
6
*
7
* Written (W) 2008-2010 Soeren Sonnenburg
8
* Written (W) 2011-2013 Heiko Strathmann
9
* Written (W) 2013 Thoralf Klein
10
* Copyright (C) 2008-2010 Fraunhofer Institute FIRST and Max Planck Society
11
*/
12
13
#ifndef __SGREFOBJECT_H__
14
#define __SGREFOBJECT_H__
15
16
#include <
shogun/lib/config.h
>
17
#include <
shogun/lib/common.h
>
18
#include <
shogun/lib/DataType.h
>
19
#include <
shogun/lib/RefCount.h
>
20
24
namespace
shogun
25
{
26
27
// define reference counter macros
28
//
29
#ifdef USE_REFERENCE_COUNTING
30
#define SG_REF(x) { if (x) (x)->ref(); }
31
#define SG_UNREF(x) { if (x) { if ((x)->unref()==0) (x)=NULL; } }
32
#define SG_UNREF_NO_NULL(x) { if (x) { (x)->unref(); } }
33
#else
34
#define SG_REF(x)
35
#define SG_UNREF(x)
36
#define SG_UNREF_NO_NULL(x)
37
#endif
38
46
class
SGRefObject
47
{
48
public
:
50
SGRefObject
();
51
53
SGRefObject
(
const
SGRefObject
& orig);
54
56
virtual
~SGRefObject
();
57
58
#ifdef USE_REFERENCE_COUNTING
59
63
int32_t ref();
64
69
int32_t ref_count();
70
76
int32_t unref();
77
#endif //USE_REFERENCE_COUNTING
78
84
virtual
const
char
*
get_name
()
const
= 0;
85
86
#ifdef TRACE_MEMORY_ALLOCS
87
static
void
list_memory_allocs()
88
{
89
shogun::list_memory_allocs();
90
}
91
#endif
92
93
private
:
94
void
init();
95
96
private
:
97
98
RefCount
* m_refcount;
99
};
100
}
101
#endif // __SGREFOBJECT_H__
DataType.h
shogun::SGRefObject::SGRefObject
SGRefObject()
Definition:
SGRefObject.cpp:22
shogun::RefCount
Definition:
RefCount.h:16
shogun::SGRefObject
Class SGRefObject is a reference count based memory management class.
Definition:
SGRefObject.h:46
RefCount.h
config.h
shogun::SGRefObject::get_name
virtual const char * get_name() const =0
common.h
shogun::SGRefObject::~SGRefObject
virtual ~SGRefObject()
Definition:
SGRefObject.cpp:37
SHOGUN
Machine Learning Toolbox - Documentation