1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-  */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #ifndef _ORKINHEAP_
7 #define _ORKINHEAP_ 1
8 
9 #ifndef _MDB_
10 #  include "mdb.h"
11 #endif
12 
13 #ifndef _MORK_
14 #  include "mork.h"
15 #endif
16 
17 // 456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
18 
19 #define orkinHeap_kTag 0x68456150 /* ascii 'hEaP' */
20 
21 /*| orkinHeap:
22 |*/
23 class orkinHeap : public nsIMdbHeap {  //
24  protected:
25   size_t mUsedSize;
26 
27  public:
28   orkinHeap();           // does nothing
29   virtual ~orkinHeap();  // does nothing
30 
31  private:  // copying is not allowed
32   orkinHeap(const orkinHeap& other);
33   orkinHeap& operator=(const orkinHeap& other);
34 
35  public:
36   // { ===== begin nsIMdbHeap methods =====
37   NS_IMETHOD Alloc(nsIMdbEnv* ev,     // allocate a piece of memory
38                    mdb_size inSize,   // requested size of new memory block
39                    void** outBlock);  // memory block of inSize bytes, or nil
40 
41   NS_IMETHOD Free(nsIMdbEnv* ev,  // free block allocated earlier by Alloc()
42                   void* inBlock);
43 
44   virtual size_t GetUsedSize();
45   // } ===== end nsIMdbHeap methods =====
46 };
47 
48 // 456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789
49 
50 #endif /* _ORKINHEAP_ */
51