SHOGUN  v3.0.0
 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/common.h>
13 
14 namespace shogun
15 {
16 class RefCount;
17 
20 {
21  public:
23  SGReferencedData(bool ref_counting=true);
24 
27 
30 
36  virtual ~SGReferencedData();
37 
42  int32_t ref_count();
43 
44  protected:
46  void copy_refcount(const SGReferencedData &orig);
47 
52  int32_t ref();
53 
59  int32_t unref();
60 
62  virtual void copy_data(const SGReferencedData &orig)=0;
63 
65  virtual void init_data()=0;
66 
68  virtual void free_data()=0;
69 
70  private:
71 
73  RefCount* m_refcount;
74 };
75 }
76 #endif // __SGREFERENCED_DATA_H__

SHOGUN Machine Learning Toolbox - Documentation