shogun reference count managed data
Definition at line 33 of file SGReferencedData.h.
Public Member Functions | |
SGReferencedData (bool ref_counting=true) | |
SGReferencedData (const SGReferencedData &orig) | |
SGReferencedData & | operator= (const SGReferencedData &orig) |
virtual | ~SGReferencedData () |
int32_t | ref_count () |
Protected Member Functions | |
void | copy_refcount (const SGReferencedData &orig) |
int32_t | ref () |
int32_t | unref () |
virtual void | copy_data (const SGReferencedData &orig)=0 |
virtual void | init_data ()=0 |
virtual void | free_data ()=0 |
SGReferencedData | ( | bool | ref_counting = true |
) |
default constructor
Definition at line 37 of file SGReferencedData.h.
SGReferencedData | ( | const SGReferencedData & | orig | ) |
copy constructor
Definition at line 49 of file SGReferencedData.h.
virtual ~SGReferencedData | ( | ) | [virtual] |
empty destructor
NOTE: unref() has to be called in derived classes to avoid memory leaks.
Definition at line 73 of file SGReferencedData.h.
virtual void copy_data | ( | const SGReferencedData & | orig | ) | [protected, pure virtual] |
needs to be overridden to copy data
Implemented in SGMatrix< T >, SGMatrixList< T >, SGNDArray< T >, SGSparseMatrix< T >, SGSparseVector< T >, SGStringList< T >, SGVector< T >, SGMatrix< uint32_t >, SGMatrix< double >, SGMatrix< ST >, SGMatrix< float64_t >, SGMatrix< int >, SGMatrix< float32_t >, SGMatrix< int32_t >, SGMatrix< uint16_t >, SGMatrixList< ST >, SGNDArray< float64_t >, SGSparseVector< ST >, SGSparseVector< float64_t >, SGVector< float64_t >, SGVector< VwExample >, SGVector< float32_t >, SGVector< int32_t >, SGVector< index_t >, and SGVector< SGSparseVectorEntry< T > >.
void copy_refcount | ( | const SGReferencedData & | orig | ) | [protected] |
copy refcount
Definition at line 102 of file SGReferencedData.h.
virtual void free_data | ( | ) | [protected, pure virtual] |
needs to be overridden to free data
Implemented in SGMatrix< T >, SGMatrixList< T >, SGNDArray< T >, SGSparseMatrix< T >, SGSparseVector< T >, SGStringList< T >, SGVector< T >, SGMatrix< uint32_t >, SGMatrix< double >, SGMatrix< ST >, SGMatrix< float64_t >, SGMatrix< int >, SGMatrix< float32_t >, SGMatrix< int32_t >, SGMatrix< uint16_t >, SGMatrixList< ST >, SGNDArray< float64_t >, SGSparseVector< ST >, SGSparseVector< float64_t >, SGVector< float64_t >, SGVector< VwExample >, SGVector< float32_t >, SGVector< int32_t >, SGVector< index_t >, and SGVector< SGSparseVectorEntry< T > >.
virtual void init_data | ( | ) | [protected, pure virtual] |
needs to be overridden to initialize empty data
Implemented in SGMatrix< T >, SGMatrixList< T >, SGNDArray< T >, SGSparseMatrix< T >, SGSparseVector< T >, SGStringList< T >, SGVector< T >, SGMatrix< uint32_t >, SGMatrix< double >, SGMatrix< ST >, SGMatrix< float64_t >, SGMatrix< int >, SGMatrix< float32_t >, SGMatrix< int32_t >, SGMatrix< uint16_t >, SGMatrixList< ST >, SGNDArray< float64_t >, SGSparseVector< ST >, SGSparseVector< float64_t >, SGVector< float64_t >, SGVector< VwExample >, SGVector< float32_t >, SGVector< int32_t >, SGVector< index_t >, and SGVector< SGSparseVectorEntry< T > >.
SGReferencedData& operator= | ( | const SGReferencedData & | orig | ) |
override assignment operator to increase refcount on assignments
Definition at line 56 of file SGReferencedData.h.
int32_t ref | ( | ) | [protected] |
increase reference counter
Definition at line 111 of file SGReferencedData.h.
int32_t ref_count | ( | ) |
int32_t unref | ( | ) | [protected] |
decrement reference counter and deallocate object if refcount is zero before or after decrementing it
Definition at line 136 of file SGReferencedData.h.