/usr/share/netgen/libsrc/general/dynamicmem.hpp is in netgen-headers 4.9.13.dfsg-8build2.
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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | #ifndef FILE_DYNAMICMEM
#define FILE_DYNAMICMEM
/**************************************************************************/
/* File: dynamicmem.hpp */
/* Author: Joachim Schoeberl */
/* Date: 12. Feb. 2003 */
/**************************************************************************/
namespace netgen
{
class BaseDynamicMem
{
private:
static BaseDynamicMem *first, *last;
BaseDynamicMem *prev, *next;
size_t size;
char * ptr;
char * name;
protected:
BaseDynamicMem ();
~BaseDynamicMem ();
void Alloc (size_t s);
void ReAlloc (size_t s);
void Free ();
char * Ptr() { return ptr; }
const char * Ptr() const { return ptr; }
void Swap (BaseDynamicMem & m2);
public:
void SetName (const char * aname);
static void Print ();
static void GetUsed (int nr, char * ch);
};
template <typename T>
class DynamicMem : public BaseDynamicMem
{
public:
DynamicMem ()
: BaseDynamicMem ()
{
;
}
DynamicMem (size_t s)
: BaseDynamicMem ()
{
Alloc (s);
}
void Alloc (size_t s)
{
BaseDynamicMem::Alloc (sizeof(T) * s);
}
void ReAlloc (size_t s)
{
BaseDynamicMem::ReAlloc (sizeof(T) * s);
}
void Free ()
{
BaseDynamicMem::Free ();
}
const T * Ptr() const
{
return reinterpret_cast<const T*> (BaseDynamicMem::Ptr());
}
T * Ptr()
{
return reinterpret_cast<T*> (BaseDynamicMem::Ptr());
}
operator const T* () const
{
return reinterpret_cast<const T*> (BaseDynamicMem::Ptr());
}
operator T* ()
{
return reinterpret_cast<T*> (BaseDynamicMem::Ptr());
}
void Swap (DynamicMem<T> & m2)
{
BaseDynamicMem::Swap (m2);
}
protected:
DynamicMem (const DynamicMem & m);
DynamicMem & operator= (const DynamicMem & m);
};
}
#endif
|