Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef ACE_MEM_SAP_H
00014 #define ACE_MEM_SAP_H
00015
00016 #include "ace/pre.h"
00017
00018 #include "ace/ACE_export.h"
00019
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif
00023
00024
00025 #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
00026
00027 #include "ace/PI_Malloc.h"
00028 #include "ace/Malloc_T.h"
00029 #include "ace/MMAP_Memory_Pool.h"
00030 #include "ace/Process_Mutex.h"
00031
00032 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00033
00034 class ACE_MEM_SAP;
00035 class ACE_Reactive_MEM_IO;
00036 class ACE_MT_MEM_IO;
00037 class ACE_MEM_IO;
00038
00039
00040
00041
00042 class ACE_MEM_SAP_Node
00043 {
00044 public:
00045
00046
00047
00048
00049
00050 typedef ACE_Based_Pointer<ACE_MEM_SAP_Node> ACE_MEM_SAP_NODE_PTR;
00051
00052
00053 ACE_MEM_SAP_Node (size_t cap);
00054
00055
00056 size_t size (void) const;
00057
00058
00059 size_t capacity (void) const;
00060
00061
00062 void *data (void);
00063
00064
00065 size_t capacity_;
00066
00067
00068 size_t size_;
00069
00070 ACE_MEM_SAP_NODE_PTR next_;
00071 };
00072
00073
00074
00075
00076
00077
00078
00079 class ACE_Export ACE_MEM_SAP
00080 {
00081 public:
00082
00083
00084 typedef ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_PI_Control_Block> MALLOC_TYPE;
00085 typedef ACE_MMAP_Memory_Pool_Options MALLOC_OPTIONS;
00086
00087
00088 virtual ~ACE_MEM_SAP (void);
00089
00090
00091
00092
00093 virtual int init (ACE_HANDLE handle,
00094 const ACE_TCHAR *name,
00095 MALLOC_OPTIONS *options) = 0;
00096
00097
00098
00099
00100
00101 virtual int fini ();
00102
00103
00104
00105
00106
00107
00108 virtual ssize_t recv_buf (ACE_MEM_SAP_Node *&buf,
00109 int flags,
00110 const ACE_Time_Value *timeout) = 0;
00111
00112
00113
00114
00115
00116 virtual ssize_t send_buf (ACE_MEM_SAP_Node *buf,
00117 int flags,
00118 const ACE_Time_Value *timeout) = 0;
00119
00120
00121
00122 ACE_MEM_SAP_Node *acquire_buffer (const ssize_t size);
00123
00124
00125
00126 int release_buffer (ACE_MEM_SAP_Node *buf);
00127
00128
00129 void dump (void) const;
00130
00131
00132 ACE_ALLOC_HOOK_DECLARE;
00133
00134 protected:
00135
00136
00137
00138
00139
00140
00141
00142
00143 int create_shm_malloc (const ACE_TCHAR *name,
00144 MALLOC_OPTIONS *options);
00145
00146
00147
00148 int close_shm_malloc (void);
00149
00150 ACE_HANDLE handle_;
00151
00152
00153 MALLOC_TYPE *shm_malloc_;
00154
00155
00156 ACE_MEM_SAP (void);
00157 };
00158
00159 ACE_END_VERSIONED_NAMESPACE_DECL
00160
00161 #if defined (__ACE_INLINE__)
00162 #include "ace/MEM_SAP.inl"
00163 #endif
00164
00165 #endif
00166
00167 #include "ace/post.h"
00168
00169 #endif