CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
CLHEP::HepPile< T > Class Template Reference

#include <Pile.h>

Public Member Functions

 ~HepPile ()
 
 HepPile (void(*f)(T)=0)
 
void set_destroy (void(*f)(T))
 
void push (T item)
 
bool is_empty () const
 
pop ()
 

Detailed Description

template<class T>
class CLHEP::HepPile< T >

Definition at line 53 of file Pile.h.

Constructor & Destructor Documentation

◆ ~HepPile()

template<class T >
CLHEP::HepPile< T >::~HepPile ( )
inline

Definition at line 58 of file Pile.h.

59 {
60 while(bottom != top)
61 {
62#if 1
63 destroy(stack[bottom]);
64#else
65 delete [] stack[bottom];
66#endif
67 next(&bottom);
68 }
69 }

◆ HepPile()

template<class T >
CLHEP::HepPile< T >::HepPile ( void(*)(T)  f = 0)
inline

Definition at line 71 of file Pile.h.

71: top(0), bottom(0) { destroy_fun = f;}
void f(void g())
Definition: excDblThrow.cc:38

Member Function Documentation

◆ is_empty()

template<class T >
bool CLHEP::HepPile< T >::is_empty ( ) const
inline

Definition at line 88 of file Pile.h.

88{ return top == bottom ?true :false;}

Referenced by CLHEP::HepPile< T >::pop().

◆ pop()

template<class T >
T CLHEP::HepPile< T >::pop ( )
inline

Definition at line 89 of file Pile.h.

90 {
91 if (is_empty())
92 {
93 std::cerr << "Attempt to pop empty pile.\n--- Exiting to system."
94 << std::endl;
95 exit(1);
96 }
97 previous(&top);
98 return stack[top];
99 }
bool is_empty() const
Definition: Pile.h:88
#define exit(x)

◆ push()

template<class T >
void CLHEP::HepPile< T >::push ( item)
inline

Definition at line 74 of file Pile.h.

75 {
76 stack[top]=item;
77 next(&top);
78 if (top==bottom)
79 {
80#if 1
81 destroy(stack[bottom]);
82#else
83 delete [] stack[bottom];
84#endif
85 next(&bottom);
86 }
87 }

◆ set_destroy()

template<class T >
void CLHEP::HepPile< T >::set_destroy ( void(*)(T)  f)
inline

Definition at line 73 of file Pile.h.

73{ destroy_fun = f;}

The documentation for this class was generated from the following file: