/usr/include/shogun/lib/SGReferencedData.h is in libshogun-dev 3.2.0-7.3build4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | /*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012 Soeren Sonnenburg
*/
#ifndef __SGREFERENCED_DATA_H__
#define __SGREFERENCED_DATA_H__
#include <shogun/lib/common.h>
namespace shogun
{
class RefCount;
/** @brief shogun reference count managed data */
class SGReferencedData
{
public:
/** default constructor */
SGReferencedData(bool ref_counting=true);
/** copy constructor */
SGReferencedData(const SGReferencedData &orig);
/** override assignment operator to increase refcount on assignments */
SGReferencedData& operator= (const SGReferencedData &orig);
/** empty destructor
*
* NOTE: unref() has to be called in derived classes
* to avoid memory leaks.
*/
virtual ~SGReferencedData();
/** display reference counter
*
* @return reference count
*/
int32_t ref_count();
protected:
/** copy refcount */
void copy_refcount(const SGReferencedData &orig);
/** increase reference counter
*
* @return reference count
*/
int32_t ref();
/** decrement reference counter and deallocate object if refcount is zero
* before or after decrementing it
*
* @return reference count
*/
int32_t unref();
/** needs to be overridden to copy data */
virtual void copy_data(const SGReferencedData &orig)=0;
/** needs to be overridden to initialize empty data */
virtual void init_data()=0;
/** needs to be overridden to free data */
virtual void free_data()=0;
private:
/** reference counter */
RefCount* m_refcount;
};
}
#endif // __SGREFERENCED_DATA_H__
|