• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

kcachegrind

  • sources
  • kde-4.12
  • kdesdk
  • kcachegrind
  • libcore
pool.h
Go to the documentation of this file.
1 /* This file is part of KCachegrind.
2  Copyright (C) 2002-2004 Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
3 
4  KCachegrind is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public
6  License as published by the Free Software Foundation, version 2.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; see the file COPYING. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 #ifndef POOL_H
20 #define POOL_H
21 
26 struct SpaceChunk;
27 
34 class FixPool
35 {
36  public:
37  FixPool();
38  ~FixPool();
39 
43  void* allocate(unsigned int size);
44 
50  void* reserve(unsigned int size);
51 
56  bool allocateReserved(unsigned int size);
57 
58  private:
59  /* Checks that there is enough space in the last chunk.
60  * Returns false if this is not possible.
61  */
62  bool ensureSpace(unsigned int);
63 
64  struct SpaceChunk *_first, *_last;
65  unsigned int _reservation;
66  int _count, _size;
67 };
68 
77 class DynPool
78 {
79  public:
80  DynPool();
81  ~DynPool();
82 
89  bool allocate(char** ptr, unsigned int size);
90 
95  void free(char** ptr);
96 
97  private:
98  /* Checks that there is enough space. If not,
99  * it compactifies, possibly moving objects.
100  */
101  bool ensureSpace(unsigned int);
102 
103  char* _data;
104  unsigned int _used, _size;
105 };
106 
107 #endif // POOL_H
DynPool
DynPool.
Definition: pool.h:77
FixPool
FixPool.
Definition: pool.h:34
FixPool::allocateReserved
bool allocateReserved(unsigned int size)
Before calling this, you have to reserve at least bytes with reserveSpace().
Definition: pool.cpp:80
FixPool::reserve
void * reserve(unsigned int size)
Reserve space.
Definition: pool.cpp:71
DynPool::allocate
bool allocate(char **ptr, unsigned int size)
Take bytes from the pool, changing <*ptr> to point to this allocated space.
Definition: pool.cpp:143
DynPool::free
void free(char **ptr)
To resize, first allocate new space, and free old afterwards.
Definition: pool.cpp:166
DynPool::DynPool
DynPool()
Definition: pool.cpp:126
FixPool::FixPool
FixPool()
Definition: pool.cpp:35
FixPool::allocate
void * allocate(unsigned int size)
Take bytes from the pool.
Definition: pool.cpp:57
DynPool::~DynPool
~DynPool()
Definition: pool.cpp:136
FixPool::~FixPool
~FixPool()
Definition: pool.cpp:43
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:03:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kcachegrind

Skip menu "kcachegrind"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal