/usr/include/givaro/givpointer.h is in libgivaro-dev 3.2.13-1.2.
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 | #ifndef _GIVARO_POINTER_H_
#define _GIVARO_POINTER_H_
// ==========================================================================
// $Source: /var/lib/cvs/Givaro/src/kernel/memory/givpointer.h,v $
// Copyright(c)'94-97 by Givaro Team
// see the copyright file.
// Author: T. Gautier
// $Id: givpointer.h,v 1.1.1.1 2004/05/12 16:08:24 jgdumas Exp $
// ==========================================================================
// Description:
// - auto ptr management
#include "givaro/givaromm.h"
// ==================================================================== //
template<class T>
class RefCountPtr {
T* _data;
mutable int* _count;
public:
explicit RefCountPtr ( T* data )
: _data( data ), _count(0)
{
_count = GivaroMM<int>::allocate(1);
*_count = 1;
}
RefCountPtr ( const RefCountPtr<T>& ptr )
: _data( ptr._data), _count(ptr._count)
{
if (_count !=0) *_count += 1;
}
~RefCountPtr()
{
if (--*_count ==0) {
delete data;
GivaroMM<int>::desallocate(_count);
}
}
RefCountPtr<T>& operator=( const RefCountPtr<T>& ptr )
{
if (--*_count ==0) {
delete data;
GivaroMM<int>::desallocate(_count);
}
_data = ptr._data; _count = ptr._count;
if (_count !=0) *_count += 1;
}
T& operator* () const { return *_data; }
T* operator-> () const { return _data; }
};
#endif
|