Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Memory_Pool.i

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 // $Id: Memory_Pool.i,v 1.1.1.3 2003/02/21 18:36:32 chad Exp $
00003 
00004 ACE_INLINE
00005 ACE_Local_Memory_Pool::~ACE_Local_Memory_Pool (void)
00006 {
00007   // Free up all memory allocated by this pool.
00008   this->release ();
00009 }
00010 
00011 ACE_INLINE int
00012 ACE_Local_Memory_Pool::sync (ssize_t, int)
00013 {
00014   ACE_TRACE ("ACE_Local_Memory_Pool::sync");
00015   return 0;
00016 }
00017 
00018 ACE_INLINE int
00019 ACE_Local_Memory_Pool::sync (void *, size_t, int)
00020 {
00021   ACE_TRACE ("ACE_Local_Memory_Pool::sync");
00022   return 0;
00023 }
00024 
00025 ACE_INLINE int
00026 ACE_Local_Memory_Pool::protect (ssize_t, int)
00027 {
00028   ACE_TRACE ("ACE_Local_Memory_Pool::protect");
00029   return 0;
00030 }
00031 
00032 ACE_INLINE int
00033 ACE_Local_Memory_Pool::protect (void *, size_t, int)
00034 {
00035   ACE_TRACE ("ACE_Local_Memory_Pool::protect");
00036   return 0;
00037 }
00038 
00039 ACE_INLINE void *
00040 ACE_Local_Memory_Pool::base_addr (void) const
00041 {
00042   return 0;
00043 }
00044 
00045 ACE_INLINE
00046 ACE_MMAP_Memory_Pool::~ACE_MMAP_Memory_Pool (void)
00047 {
00048 }
00049 
00050 ACE_INLINE
00051 ACE_Lite_MMAP_Memory_Pool::~ACE_Lite_MMAP_Memory_Pool (void)
00052 {
00053 }
00054 
00055 ACE_INLINE size_t
00056 ACE_MMAP_Memory_Pool::round_up (size_t nbytes)
00057 {
00058   ACE_TRACE ("ACE_MMAP_Memory_Pool::round_up");
00059   return ACE::round_to_pagesize (ACE_static_cast (off_t, nbytes));
00060 }
00061 
00062 ACE_INLINE void *
00063 ACE_MMAP_Memory_Pool::base_addr (void) const
00064 {
00065   ACE_TRACE ("ACE_MMAP_Memory_Pool::base_addr");
00066   return this->base_addr_;
00067 }
00068 
00069 // Ask system for initial chunk of local memory.
00070 
00071 ACE_INLINE void *
00072 ACE_Local_Memory_Pool::init_acquire (size_t nbytes,
00073                                      size_t &rounded_bytes,
00074                                      int &first_time)
00075 {
00076   ACE_TRACE ("ACE_Local_Memory_Pool::init_acquire");
00077   // Note that we assume that when ACE_Local_Memory_Pool is used,
00078   // ACE_Malloc's constructor will only get called once.  If this
00079   // assumption doesn't hold, we are in deep trouble!
00080 
00081   first_time = 1;
00082   return this->acquire (nbytes, rounded_bytes);
00083 }
00084 
00085 // Let the underlying new operator figure out the alignment...
00086 
00087 ACE_INLINE size_t
00088 ACE_Local_Memory_Pool::round_up (size_t nbytes)
00089 {
00090   ACE_TRACE ("ACE_Local_Memory_Pool::round_up");
00091   return ACE::round_to_pagesize (ACE_static_cast (off_t, nbytes));
00092 }
00093 
00094 #if !defined (ACE_LACKS_SYSV_SHMEM)
00095 // Implement the algorithm for rounding up the request to an
00096 // appropriate chunksize.
00097 
00098 ACE_INLINE
00099 ACE_Shared_Memory_Pool::~ACE_Shared_Memory_Pool (void)
00100 {
00101 }
00102 
00103 ACE_INLINE size_t
00104 ACE_Shared_Memory_Pool::round_up (size_t nbytes)
00105 {
00106   ACE_TRACE ("ACE_Shared_Memory_Pool::round_up");
00107   if (nbytes < this->segment_size_)
00108     nbytes = this->segment_size_;
00109 
00110   return ACE::round_to_pagesize (nbytes);
00111 }
00112 
00113 ACE_INLINE int
00114 ACE_Shared_Memory_Pool::sync (ssize_t, int)
00115 {
00116   ACE_TRACE ("ACE_Shared_Memory_Pool::sync");
00117   return 0;
00118 }
00119 
00120 ACE_INLINE int
00121 ACE_Shared_Memory_Pool::sync (void *, size_t, int)
00122 {
00123   ACE_TRACE ("ACE_Shared_Memory_Pool::sync");
00124   return 0;
00125 }
00126 
00127 ACE_INLINE int
00128 ACE_Shared_Memory_Pool::protect (ssize_t, int)
00129 {
00130   ACE_TRACE ("ACE_Shared_Memory_Pool::protect");
00131   return 0;
00132 }
00133 
00134 ACE_INLINE int
00135 ACE_Shared_Memory_Pool::protect (void *, size_t, int)
00136 {
00137   ACE_TRACE ("ACE_Shared_Memory_Pool::protect");
00138   return 0;
00139 }
00140 
00141 ACE_INLINE void *
00142 ACE_Shared_Memory_Pool::base_addr (void) const
00143 {
00144   ACE_TRACE ("ACE_Shared_Memory_Pool::base_addr");
00145   return this->base_addr_;
00146 }
00147 #endif /* !ACE_LACKS_SYSV_SHMEM */
00148 
00149 #if !defined (ACE_LACKS_SBRK)
00150 
00151 ACE_INLINE
00152 ACE_Sbrk_Memory_Pool::~ACE_Sbrk_Memory_Pool (void)
00153 {
00154 }
00155 
00156 ACE_INLINE void *
00157 ACE_Sbrk_Memory_Pool::base_addr (void) const
00158 {
00159   return 0;
00160 }
00161 
00162 // Ask system for initial chunk of local memory.
00163 
00164 ACE_INLINE void *
00165 ACE_Sbrk_Memory_Pool::init_acquire (size_t nbytes,
00166                                     size_t &rounded_bytes,
00167                                     int &first_time)
00168 {
00169   ACE_TRACE ("ACE_Sbrk_Memory_Pool::init_acquire");
00170   // Note that we assume that when ACE_Sbrk_Memory_Pool is used,
00171   // ACE_Malloc's constructor will only get called once.  If this
00172   // assumption doesn't hold, we are in deep trouble!
00173 
00174   first_time = 1;
00175   return this->acquire (nbytes, rounded_bytes);
00176 }
00177 
00178 // Round up the request to a multiple of the page size.
00179 
00180 ACE_INLINE size_t
00181 ACE_Sbrk_Memory_Pool::round_up (size_t nbytes)
00182 {
00183   ACE_TRACE ("ACE_Sbrk_Memory_Pool::round_up");
00184   return ACE::round_to_pagesize (nbytes);
00185 }
00186 
00187 /* No-op for now... */
00188 
00189 ACE_INLINE int
00190 ACE_Sbrk_Memory_Pool::release (int)
00191 {
00192   ACE_TRACE ("ACE_Sbrk_Memory_Pool::release");
00193   return 0;
00194 }
00195 
00196 ACE_INLINE int
00197 ACE_Sbrk_Memory_Pool::sync (ssize_t, int)
00198 {
00199   ACE_TRACE ("ACE_Sbrk_Memory_Pool::sync");
00200   return 0;
00201 }
00202 
00203 ACE_INLINE int
00204 ACE_Sbrk_Memory_Pool::sync (void *, size_t, int)
00205 {
00206   ACE_TRACE ("ACE_Sbrk_Memory_Pool::sync");
00207   return 0;
00208 }
00209 
00210 ACE_INLINE int
00211 ACE_Sbrk_Memory_Pool::protect (ssize_t, int)
00212 {
00213   ACE_TRACE ("ACE_Sbrk_Memory_Pool::protect");
00214   return 0;
00215 }
00216 
00217 ACE_INLINE int
00218 ACE_Sbrk_Memory_Pool::protect (void *, size_t, int)
00219 {
00220   ACE_TRACE ("ACE_Sbrk_Memory_Pool::protect");
00221   return 0;
00222 }
00223 #endif /* !ACE_LACKS_SBRK */
00224 
00225 #if defined (ACE_WIN32)
00226 
00227 ACE_INLINE size_t
00228 ACE_Pagefile_Memory_Pool::round_to_chunk_size (size_t nbytes)
00229 {
00230   return (nbytes + ACE_DEFAULT_PAGEFILE_POOL_CHUNK - 1)
00231           & (~(ACE_DEFAULT_PAGEFILE_POOL_CHUNK - 1));
00232 }
00233 
00234 ACE_INLINE size_t
00235 ACE_Pagefile_Memory_Pool::round_to_page_size (size_t nbytes)
00236 {
00237   return ACE::round_to_pagesize (ACE_static_cast (off_t, nbytes));
00238 }
00239 
00240 ACE_INLINE int
00241 ACE_Pagefile_Memory_Pool::sync (ssize_t, int)
00242 {
00243   return 0;
00244 }
00245 
00246 ACE_INLINE int
00247 ACE_Pagefile_Memory_Pool::sync (void *, size_t, int)
00248 {
00249   return 0;
00250 }
00251 
00252 ACE_INLINE int
00253 ACE_Pagefile_Memory_Pool::protect (ssize_t, int)
00254 {
00255   return 0;
00256 }
00257 
00258 ACE_INLINE int
00259 ACE_Pagefile_Memory_Pool::protect (void *, size_t, int)
00260 {
00261   return 0;
00262 }
00263 
00264 ACE_INLINE void *
00265 ACE_Pagefile_Memory_Pool::base_addr (void) const
00266 {
00267   return 0;
00268 }
00269 #endif /* ACE_WIN32 */

Generated on Mon Jun 16 11:20:20 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002