/usr/share/netgen/libsrc/general/stack.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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | #ifndef FILE_STACK
#define FILE_STACK
/*****************************************************************************/
/* File: stack.hh */
/* Author: Wolfram Muehlhuber */
/* Date: September 98 */
/*****************************************************************************/
/*
Stack class, based on a resizable array
*/
// #include "array.hpp"
namespace netgen
{
///
template <class T> class STACK
{
public:
///
inline STACK (INDEX asize = 0, INDEX ainc = 0);
///
inline ~STACK ();
///
inline void Push (const T & el);
///
inline T & Pop ();
///
const inline T & Top () const;
///
inline int IsEmpty () const;
///
inline void MakeEmpty ();
private:
///
Array<T> elems;
///
INDEX size;
};
/*
Stack class, based on a resizable array
*/
template <class T>
inline STACK<T> :: STACK (INDEX asize, INDEX ainc)
: elems(asize, ainc)
{
size = 0;
}
template <class T>
inline STACK<T> :: ~STACK ()
{
;
}
template <class T>
inline void STACK<T> :: Push (const T & el)
{
if (size < elems.Size())
elems.Elem(++size) = el;
else
{
elems.Append(el);
size++;
}
}
template <class T>
inline T & STACK<T> :: Pop ()
{
return elems.Elem(size--);
}
template <class T>
const inline T & STACK<T> :: Top () const
{
return elems.Get(size);
}
template <class T>
inline int STACK<T> :: IsEmpty () const
{
return (size == 0);
}
template <class T>
inline void STACK<T> :: MakeEmpty ()
{
size = 0;
}
}
#endif
|