Annotation of parser3/src/include/pa_pool.h, revision 1.17
1.1 paf 1: /*
1.17 ! paf 2: $Id: pa_pool.h,v 1.16 2001/01/29 20:46:22 paf Exp $
1.1 paf 3: */
4:
5: #ifndef PA_POOL_H
6: #define PA_POOL_H
7:
8: #include <stddef.h>
9:
1.4 paf 10: #include "pa_string.h"
1.5 paf 11: #include "pa_hash.h"
1.14 paf 12: #include "pa_array.h"
1.13 paf 13: //#include "pa_table.h"
1.17 ! paf 14: #include "pa_exception.h"
1.1 paf 15:
16: class Pool {
17: public:
18: Pool();
19: ~Pool();
1.17 ! paf 20: virtual void *malloc(size_t size)=0;
! 21: virtual void *calloc(size_t size)=0;
1.1 paf 22:
1.15 paf 23: String& make_string() {
24: return *new(*this) String(*this);
1.5 paf 25: }
1.9 paf 26: Hash& make_hash() {
1.15 paf 27: return *new(*this) Hash(*this, false);
1.10 paf 28: }
29: Hash& make_thread_safe_hash() {
1.15 paf 30: return *new(*this) Hash(*this, true);
1.7 paf 31: }
1.14 paf 32: Array& make_array() {
1.15 paf 33: return *new(*this) Array(*this);
1.7 paf 34: }
1.9 paf 35: Array& make_array(int initial_rows) {
1.15 paf 36: return *new(*this) Array(*this, initial_rows);
1.14 paf 37: }
1.13 paf 38: /*Table& make_table(char *afile, uint aline, Array *acolumns, int initial_rows) {
1.12 paf 39: return *new(this) Table(this, afile, aline, acolumns, initial_rows);
1.13 paf 40: }*/
1.8 paf 41:
1.17 ! paf 42: Exception *global_exception() { return fglobal_exception; }
! 43: Exception *set_global_exception(Exception *e);
! 44: void restore_global_exception(Exception *e);
! 45:
! 46: Exception *local_exception() { return flocal_exception; }
! 47: Exception *set_local_exception(Exception *e);
! 48: void restore_local_exception(Exception *e);
! 49:
! 50: protected:
! 51:
! 52: Exception *fglobal_exception;
! 53: Exception *flocal_exception;
! 54:
! 55: // checks whether mem allocated OK. throws exceptions
! 56: void *check(void *ptr);
! 57:
1.8 paf 58: private: //disabled
59:
1.17 ! paf 60: Pool(const Pool&) {}
1.16 paf 61: Pool& operator = (const Pool&) { return *this; }
1.1 paf 62: };
63:
64: #endif
E-mail: