SystemC  Recoding Infrastructure for SystemC v0.6.2 derived from Accellera SystemC 2.3.1
Accellera SystemC proof-of-concept library
sc_mempool.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  The following code is derived, directly or indirectly, from the SystemC
4  source code Copyright (c) 1996-2014 by all Contributors.
5  All Rights reserved.
6 
7  The contents of this file are subject to the restrictions and limitations
8  set forth in the SystemC Open Source License (the "License");
9  You may not use this file except in compliance with such restrictions and
10  limitations. You may obtain instructions on how to receive a copy of the
11  License at http://www.accellera.org/. Software distributed by Contributors
12  under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
13  ANY KIND, either express or implied. See the License for the specific
14  language governing rights and limitations under the License.
15 
16  *****************************************************************************/
17 
18 /*****************************************************************************
19 
20  sc_mempool.h - Memory pools for small objects.
21 
22  Original Author: Stan Y. Liao, Synopsys, Inc.
23 
24  CHANGE LOG AT END OF FILE
25  *****************************************************************************/
26 
27 #ifndef SC_MEMPOOL_H
28 #define SC_MEMPOOL_H
29 
30 
31 #include "sysc/utils/sc_iostream.h"
32 
33 namespace sc_core {
34 
35 // ----------------------------------------------------------------------------
36 // CLASS : sc_mempool
37 //
38 // ...
39 // ----------------------------------------------------------------------------
40 
42 {
43 public:
44 
45  static void* allocate( std::size_t sz );
46  static void release( void* p, std::size_t sz );
47  static void display_statistics();
48 };
49 
50 
51 // ----------------------------------------------------------------------------
52 // CLASS : sc_mpobject
53 //
54 // ...
55 // ----------------------------------------------------------------------------
56 
58 {
59 public:
60 
61  static void* operator new( std::size_t sz )
62  { return sc_mempool::allocate( sz ); }
63 
64  static void operator delete( void* p, std::size_t sz )
65  { sc_mempool::release( p, sz ); }
66 
67  static void* operator new[]( std::size_t sz )
68  { return sc_mempool::allocate( sz ); }
69 
70  static void operator delete[]( void* p, std::size_t sz )
71  { sc_mempool::release( p, sz ); }
72 };
73 
74 } // namespace sc_core
75 
76 // $Log: sc_mempool.h,v $
77 // Revision 1.3 2011/08/26 20:46:18 acg
78 // Andy Goodrich: moved the modification log to the end of the file to
79 // eliminate source line number skew when check-ins are done.
80 //
81 // Revision 1.2 2011/02/18 20:38:44 acg
82 // Andy Goodrich: Updated Copyright notice.
83 //
84 // Revision 1.1.1.1 2006/12/15 20:20:06 acg
85 // SystemC 2.3
86 //
87 // Revision 1.3 2006/01/13 18:53:11 acg
88 // Andy Goodrich: Added $Log command so that CVS comments are reproduced in
89 // the source.
90 
91 #endif
static void display_statistics()
static void * allocate(std::size_t sz)
static void release(void *p, std::size_t sz)