aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ode-0.9/ode/src/obstack.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libraries/ode-0.9/ode/src/obstack.h68
1 files changed, 0 insertions, 68 deletions
diff --git a/libraries/ode-0.9/ode/src/obstack.h b/libraries/ode-0.9/ode/src/obstack.h
deleted file mode 100644
index b5f715b..0000000
--- a/libraries/ode-0.9/ode/src/obstack.h
+++ /dev/null
@@ -1,68 +0,0 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23#ifndef _ODE_OBSTACK_H_
24#define _ODE_OBSTACK_H_
25
26#include "objects.h"
27
28// each obstack Arena pointer points to a block of this many bytes
29#define dOBSTACK_ARENA_SIZE 16384
30
31
32struct dObStack : public dBase {
33 struct Arena {
34 Arena *next; // next arena in linked list
35 size_t used; // total number of bytes used in this arena, counting
36 }; // this header
37
38 Arena *first; // head of the arena linked list. 0 if no arenas yet
39 Arena *last; // arena where blocks are currently being allocated
40
41 // used for iterator
42 Arena *current_arena;
43 size_t current_ofs;
44
45 dObStack();
46 ~dObStack();
47
48 void *alloc (int num_bytes);
49 // allocate a block in the last arena, allocating a new arena if necessary.
50 // it is a runtime error if num_bytes is larger than the arena size.
51
52 void freeAll();
53 // free all blocks in all arenas. this does not deallocate the arenas
54 // themselves, so future alloc()s will reuse them.
55
56 void *rewind();
57 // rewind the obstack iterator, and return the address of the first
58 // allocated block. return 0 if there are no allocated blocks.
59
60 void *next (int num_bytes);
61 // return the address of the next allocated block. 'num_bytes' is the size
62 // of the previous block. this returns null if there are no more arenas.
63 // the sequence of 'num_bytes' parameters passed to next() during a
64 // traversal of the list must exactly match the parameters passed to alloc().
65};
66
67
68#endif