3 //=============================================================================
5 * @file Shared_Memory_SV.h
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
9 //=============================================================================
11 #ifndef ACE_SHARED_MALLOC_SV_H
12 #define ACE_SHARED_MALLOC_SV_H
13 #include /**/ "ace/pre.h"
15 #include "ace/Shared_Memory.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "ace/SV_Shared_Memory.h"
23 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
26 * @class ACE_Shared_Memory_SV
28 * @brief Shared memory wrapper based on System V shared memory.
30 * This class provides a very simple-minded shared memory manager. We
31 * strongly recommend that you do NOT use this class. Instead, please
32 * use @c ACE_Malloc, which has much more powerful capabilities.
34 class ACE_Export ACE_Shared_Memory_SV
: public ACE_Shared_Memory
39 ACE_CREATE
= IPC_CREAT
,
43 ACE_Shared_Memory_SV ();
44 ACE_Shared_Memory_SV (key_t id
,
46 int create
= ACE_Shared_Memory_SV::ACE_OPEN
,
47 int perms
= ACE_DEFAULT_FILE_PERMS
,
53 int create
= ACE_Shared_Memory_SV::ACE_OPEN
,
54 int perms
= ACE_DEFAULT_FILE_PERMS
,
58 /// Close down the shared memory segment.
61 /// Remove the underlying shared memory segment.
62 virtual int remove ();
64 // = Allocation and deallocation methods.
65 /// Create a new chuck of memory containing @a size bytes.
66 virtual void *malloc (size_t = 0);
68 /// Free a chuck of memory allocated by <ACE_Shared_Memory_SV::malloc>.
69 virtual int free (void *p
);
71 /// Return the size of the shared memory segment.
72 virtual size_t get_segment_size () const;
74 /// Return the ID of the shared memory segment (i.e., a System V
75 /// shared memory internal id).
76 virtual ACE_HANDLE
get_id () const;
78 /// Dump the state of an object.
81 /// Declare the dynamic allocation hooks.
82 ACE_ALLOC_HOOK_DECLARE
;
85 /// This version is implemented with System V shared memory
87 ACE_SV_Shared_Memory shared_memory_
;
90 ACE_END_VERSIONED_NAMESPACE_DECL
92 #if defined (__ACE_INLINE__)
93 #include "ace/Shared_Memory_SV.inl"
94 #endif /* __ACE_INLINE__ */
96 #include /**/ "ace/post.h"
97 #endif /* ACE_SHARED_MALLOC_SV_H */