SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SGReferencedData.h
Go to the documentation of this file.
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  * Copyright (C) 2012 Soeren Sonnenburg
8  */
9 #ifndef __SGREFERENCED_DATA_H__
10 #define __SGREFERENCED_DATA_H__
11 
12 #include <shogun/lib/config.h>
13 
14 #include <shogun/lib/common.h>
15 
16 namespace shogun
17 {
18 class RefCount;
19 
22 {
23  public:
25  SGReferencedData(bool ref_counting=true);
26 
29 
32 
38  virtual ~SGReferencedData();
39 
44  int32_t ref_count();
45 
46  protected:
48  void copy_refcount(const SGReferencedData &orig);
49 
54  int32_t ref();
55 
61  int32_t unref();
62 
64  virtual void copy_data(const SGReferencedData &orig)=0;
65 
67  virtual void init_data()=0;
68 
70  virtual void free_data()=0;
71 
72  private:
73 
75  RefCount* m_refcount;
76 };
77 }
78 #endif // __SGREFERENCED_DATA_H__

SHOGUN Machine Learning Toolbox - Documentation