KaliVeda
1.14/2
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVMemoryChunk.cpp
1
//Created by KVClassFactory on Fri Oct 1 16:50:15 2010
2
//Author: John Frankland,,,,
3
4
#include "KVMemoryChunk.h"
5
#include <cstdlib>
6
7
ClassImp
(
KVMemoryChunk
)
8
9
10
12
13
KVMemoryChunk
::
KVMemoryChunk
()
14
: fMemory(0), fSize(0), fUsed(0), fNext(0)
15
{
16
// Default constructor
17
}
18
19
20
23
24
KVMemoryChunk::KVMemoryChunk
(
size_t
bytes) : fNext(0)
25
{
26
// Allocate new chunk of size 'bytes'
27
fMemory
= (
char
*)
malloc
(
bytes
);
28
fSize
=
bytes
;
29
fUsed
= 0;
30
}
31
32
33
36
37
KVMemoryChunk::~KVMemoryChunk
()
38
{
39
// Destructor
40
if
(
fMemory
)
free
(
fMemory
);
41
fMemory
= 0;
42
}
43
44
45
49
50
void
*
KVMemoryChunk::GetMemory
(
size_t
bytes)
51
{
52
// Return pointer to block of memory of size 'bytes'
53
// If no block of this size is available, returns 0 (test it!!)
54
55
if
(
fUsed
+
bytes
<=
fSize
) {
56
void
*
p
= (
void
*)(
fMemory
+
fUsed
);
57
fUsed
+=
bytes
;
58
return
p
;
59
}
60
return
NULL;
61
}
62
63
65
66
void
KVMemoryChunk::Print
()
67
{
68
printf(
"KVMemoryChunk: %lu bytes (%lu used) at: %p\n"
,
69
fSize
,
fUsed
,
fMemory
);
70
};
71
72
73
p
winID h TVirtualViewer3D TVirtualGLPainter p
bytes
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t bytes
free
#define free
malloc
#define malloc
KVMemoryChunk
Memory handled by KVMemoryPool.
Definition
KVMemoryChunk.h:15
KVMemoryChunk::~KVMemoryChunk
virtual ~KVMemoryChunk()
Destructor.
Definition
KVMemoryChunk.cpp:37
KVMemoryChunk::Print
void Print()
Definition
KVMemoryChunk.cpp:66
KVMemoryChunk::fSize
size_t fSize
size of chunk in bytes
Definition
KVMemoryChunk.h:17
KVMemoryChunk::fMemory
char * fMemory
pointer to start of chunk
Definition
KVMemoryChunk.h:16
KVMemoryChunk::GetMemory
void * GetMemory(size_t)
Definition
KVMemoryChunk.cpp:50
KVMemoryChunk::fUsed
size_t fUsed
memory used in bytes
Definition
KVMemoryChunk.h:18
KVMemoryChunk::KVMemoryChunk
KVMemoryChunk()
Default constructor.
Definition
KVMemoryChunk.cpp:13
ClassImp
ClassImp(TPyArg)
kaliveda.doxygen
KVMultiDet
base
KVMemoryChunk.cpp
Generated on Wed Oct 23 2024 12:45:20 for KaliVeda by
1.9.8