1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
|
.TH ACE_Static_Allocator_Base 3 "1 Dec 2001" "ACE" \" -*- nroff -*-
.ad l
.nh
.SH NAME
ACE_Static_Allocator_Base \- Defines a class that provided a highly optimized memory management scheme for allocating memory statically.
.SH SYNOPSIS
.br
.PP
\fC#include <Malloc_Allocator.h>\fR
.PP
Inherits \fBACE_Allocator\fR.
.PP
Inherited by \fBACE_Static_Allocator\fR.
.PP
.SS Public Methods
.in +1c
.ti -1c
.RI "\fBACE_Static_Allocator_Base\fR (char *buffer, size_t size)"
.br
.ti -1c
.RI "virtual void* \fBmalloc\fR (size_t nbytes)"
.br
.RI "\fIAllocate <nbytes>, but don't give them any initial value.\fR"
.ti -1c
.RI "virtual void* \fBcalloc\fR (size_t nbytes, char initial_value = '\\0')"
.br
.RI "\fIAllocate <nbytes>, giving them <initial_value>.\fR"
.ti -1c
.RI "virtual void* \fBcalloc\fR (size_t n_elem, size_t elem_size, char initial_value = '\\0')"
.br
.RI "\fIAllocate <n_elem> each of size <elem_size>, giving them <initial_value>.\fR"
.ti -1c
.RI "virtual void \fBfree\fR (void *ptr)"
.br
.RI "\fIFree <ptr> (must have been allocated by ).\fR"
.ti -1c
.RI "virtual int \fBremove\fR (void)"
.br
.RI "\fIRemove any resources associated with this memory manager.\fR"
.ti -1c
.RI "virtual int \fBbind\fR (const char *name, void *pointer, int duplicates = 0)"
.br
.ti -1c
.RI "virtual int \fBtrybind\fR (const char *name, void *&pointer)"
.br
.ti -1c
.RI "virtual int \fBfind\fR (const char *name, void *&pointer)"
.br
.RI "\fILocate <name> and pass out parameter via pointer. If found, return 0, Returns -1 if failure occurs.\fR"
.ti -1c
.RI "virtual int \fBfind\fR (const char *name)"
.br
.RI "\fIreturns 0 if the name is in the mapping. -1, otherwise.\fR"
.ti -1c
.RI "virtual int \fBunbind\fR (const char *name)"
.br
.RI "\fIUnbind (remove) the name from the map. Don't return the pointer to the caller.\fR"
.ti -1c
.RI "virtual int \fBunbind\fR (const char *name, void *&pointer)"
.br
.RI "\fIBreak any association of name. Returns the value of pointer in case the caller needs to deallocate memory.\fR"
.ti -1c
.RI "virtual int \fBsync\fR (\fBssize_t\fR len = -1, int flags = MS_SYNC)"
.br
.ti -1c
.RI "virtual int \fBsync\fR (void *addr, size_t len, int flags = MS_SYNC)"
.br
.RI "\fISync <len> bytes of the memory region to the backing store starting at .\fR"
.ti -1c
.RI "virtual int \fBprotect\fR (\fBssize_t\fR len = -1, int prot = PROT_RDWR)"
.br
.ti -1c
.RI "virtual int \fBprotect\fR (void *addr, size_t len, int prot = PROT_RDWR)"
.br
.RI "\fIChange the protection of the pages of the mapped region to <prot> starting at up to <len> bytes.\fR"
.ti -1c
.RI "virtual void \fBdump\fR (void) const"
.br
.RI "\fIDump the state of the object.\fR"
.in -1c
.SS Protected Methods
.in +1c
.ti -1c
.RI "\fBACE_Static_Allocator_Base\fR (void)"
.br
.RI "\fIDon't allow direct instantiations of this class.\fR"
.in -1c
.SS Protected Attributes
.in +1c
.ti -1c
.RI "char* \fBbuffer_\fR"
.br
.RI "\fIPointer to the buffer.\fR"
.ti -1c
.RI "size_t \fBsize_\fR"
.br
.RI "\fISize of the buffer.\fR"
.ti -1c
.RI "size_t \fBoffset_\fR"
.br
.RI "\fIPointer to the current offset in the <buffer_>.\fR"
.in -1c
.SH DETAILED DESCRIPTION
.PP
Defines a class that provided a highly optimized memory management scheme for allocating memory statically.
.PP
.PP
This class manages a fixed-size <POOL_SIZE> of memory. Every time <malloc>/<calloc> is called, it simply moves an internal index forward and returns a pointer to the requested chunk. All memory is allocated statically (typically via the template) and <free> is a no-op. This behavior is useful for use-cases where all the memory allocation needs are known in advance and no deletions ever occur.
.PP
.SH CONSTRUCTOR & DESTRUCTOR DOCUMENTATION
.PP
.SS ACE_Static_Allocator_Base::ACE_Static_Allocator_Base (char * buffer, size_t size)
.PP
.SS ACE_Static_Allocator_Base::ACE_Static_Allocator_Base (void)\fC [protected]\fR
.PP
Don't allow direct instantiations of this class.
.PP
.SH MEMBER FUNCTION DOCUMENTATION
.PP
.SS virtual int ACE_Static_Allocator_Base::bind (const char * name, void * pointer, int duplicates = 0)\fC [virtual]\fR
.PP
Associate <name> with <pointer>. If <duplicates> == 0 then do not allow duplicate <name>/<pointer> associations, else if <duplicates> != 0 then allow duplicate <name>/<pointer> assocations. Returns 0 if successfully binds (1) a previously unbound <name> or (2) <duplicates> != 0, returns 1 if trying to bind a previously bound <name> and <duplicates> == 0, else returns -1 if a resource failure occurs.
.PP
Reimplemented from \fBACE_Allocator\fR.
.SS virtual void* ACE_Static_Allocator_Base::calloc (size_t n_elem, size_t elem_size, char initial_value = '\\0')\fC [virtual]\fR
.PP
Allocate <n_elem> each of size <elem_size>, giving them <initial_value>.
.PP
Reimplemented from \fBACE_Allocator\fR.
.SS virtual void* ACE_Static_Allocator_Base::calloc (size_t nbytes, char initial_value = '\\0')\fC [virtual]\fR
.PP
Allocate <nbytes>, giving them <initial_value>.
.PP
Reimplemented from \fBACE_Allocator\fR.
.SS virtual void ACE_Static_Allocator_Base::dump (void) const\fC [virtual]\fR
.PP
Dump the state of the object.
.PP
Reimplemented from \fBACE_Allocator\fR.
.SS virtual int ACE_Static_Allocator_Base::find (const char * name)\fC [virtual]\fR
.PP
returns 0 if the name is in the mapping. -1, otherwise.
.PP
Reimplemented from \fBACE_Allocator\fR.
.SS virtual int ACE_Static_Allocator_Base::find (const char * name, void *& pointer)\fC [virtual]\fR
.PP
Locate <name> and pass out parameter via pointer. If found, return 0, Returns -1 if failure occurs.
.PP
Reimplemented from \fBACE_Allocator\fR.
.SS virtual void ACE_Static_Allocator_Base::free (void * ptr)\fC [virtual]\fR
.PP
Free <ptr> (must have been allocated by ).
.PP
Reimplemented from \fBACE_Allocator\fR.
.SS virtual void* ACE_Static_Allocator_Base::malloc (size_t nbytes)\fC [virtual]\fR
.PP
Allocate <nbytes>, but don't give them any initial value.
.PP
Reimplemented from \fBACE_Allocator\fR.
.SS virtual int ACE_Static_Allocator_Base::protect (void * addr, size_t len, int prot = PROT_RDWR)\fC [virtual]\fR
.PP
Change the protection of the pages of the mapped region to <prot> starting at up to <len> bytes.
.PP
Reimplemented from \fBACE_Allocator\fR.
.SS virtual int ACE_Static_Allocator_Base::protect (\fBssize_t\fR len = -1, int prot = PROT_RDWR)\fC [virtual]\fR
.PP
Change the protection of the pages of the mapped region to <prot> starting at <this->base_addr_> up to <len> bytes. If <len> == -1 then change protection of all pages in the mapped region.
.PP
Reimplemented from \fBACE_Allocator\fR.
.SS virtual int ACE_Static_Allocator_Base::remove (void)\fC [virtual]\fR
.PP
Remove any resources associated with this memory manager.
.PP
Reimplemented from \fBACE_Allocator\fR.
.SS virtual int ACE_Static_Allocator_Base::sync (void * addr, size_t len, int flags = MS_SYNC)\fC [virtual]\fR
.PP
Sync <len> bytes of the memory region to the backing store starting at .
.PP
Reimplemented from \fBACE_Allocator\fR.
.SS virtual int ACE_Static_Allocator_Base::sync (\fBssize_t\fR len = -1, int flags = MS_SYNC)\fC [virtual]\fR
.PP
Sync <len> bytes of the memory region to the backing store starting at <this->base_addr_>. If <len> == -1 then sync the whole region.
.PP
Reimplemented from \fBACE_Allocator\fR.
.SS virtual int ACE_Static_Allocator_Base::trybind (const char * name, void *& pointer)\fC [virtual]\fR
.PP
Associate <name> with <pointer>. Does not allow duplicate <name>/<pointer> associations. Returns 0 if successfully binds (1) a previously unbound <name>, 1 if trying to bind a previously bound <name>, or returns -1 if a resource failure occurs. When this call returns <pointer>'s value will always reference the void * that <name> is associated with. Thus, if the caller needs to use <pointer> (e.g., to free it) a copy must be maintained by the caller.
.PP
Reimplemented from \fBACE_Allocator\fR.
.SS virtual int ACE_Static_Allocator_Base::unbind (const char * name, void *& pointer)\fC [virtual]\fR
.PP
Break any association of name. Returns the value of pointer in case the caller needs to deallocate memory.
.PP
Reimplemented from \fBACE_Allocator\fR.
.SS virtual int ACE_Static_Allocator_Base::unbind (const char * name)\fC [virtual]\fR
.PP
Unbind (remove) the name from the map. Don't return the pointer to the caller.
.PP
Reimplemented from \fBACE_Allocator\fR.
.SH MEMBER DATA DOCUMENTATION
.PP
.SS char * ACE_Static_Allocator_Base::buffer_\fC [protected]\fR
.PP
Pointer to the buffer.
.PP
.SS size_t ACE_Static_Allocator_Base::offset_\fC [protected]\fR
.PP
Pointer to the current offset in the <buffer_>.
.PP
.SS size_t ACE_Static_Allocator_Base::size_\fC [protected]\fR
.PP
Size of the buffer.
.PP
.SH AUTHOR
.PP
Generated automatically by Doxygen for ACE from the source code.
|