28 #ifndef _util_render_stack_h 29 #define _util_render_stack_h 35 #define STACK_MAX_STACK_SIZE 20 39 T objects[STACK_MAX_STACK_SIZE];
42 Stack(): nobjects(0) {}
43 void push(
const T&a) {
44 if (nobjects >= STACK_MAX_STACK_SIZE) {
48 objects[nobjects++] = a;
56 return objects[nobjects];
63 return objects[nobjects - 1];
65 int n()
const {
return nobjects; }
66 T operator[](
int i) {
return objects[i]; }
68 os <<
"Stack (depth = " << nobjects <<
"):" << std::endl;
69 for (
int i=0; i<nobjects; i++) {
70 os <<
" object " << i <<
":" << std::endl;
71 objects[i]->print(os);
static std::ostream & errn()
Return an ostream for error messages that writes from all nodes.
Definition: exenv.h:80
static std::ostream & out0()
Return an ostream that writes from node 0.