/usr/include/givaro/givpointer.h is in libgivaro-dev 3.7.2-1.
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 | // ==========================================================================
// $Source: /var/lib/cvs/Givaro/src/kernel/memory/givpointer.h,v $
// Copyright(c)'1994-2009 by The Givaro group
// This file is part of Givaro.
// Givaro is governed by the CeCILL-B license under French law
// and abiding by the rules of distribution of free software.
// see the COPYRIGHT file for more details.
// Author: T. Gautier
// $Id: givpointer.h,v 1.3 2011-02-02 16:23:56 bboyer Exp $
// ==========================================================================
/*! @file givpointer.h
* @ingroup memory
* @brief auto ptr management
*/
#ifndef __GIVARO_pointer_H
#define __GIVARO_pointer_H
#include "givaro/givaromm.h"
namespace Givaro {
// ==================================================================== //
//! Refcount Pointer
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; }
};
} // namespace Givaro
#endif // __GIVARO_pointer_H
|