[7297] Fixed profession spells sorting in trainer spell list at client.
[getmangos.git] / dep / ACE_wrappers / ace / Shared_Memory_MM.h
blobe02b21249accfa03250c830dc92066406c6a7a1d
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file Shared_Memory_MM.h
7 * $Id: Shared_Memory_MM.h 80826 2008-03-04 14:51:23Z wotte $
9 * @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
11 //=============================================================================
14 #ifndef ACE_SHARED_MALLOC_MM_H
15 #define ACE_SHARED_MALLOC_MM_H
16 #include /**/ "ace/pre.h"
18 #include "ace/Shared_Memory.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 # pragma once
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "ace/Mem_Map.h"
26 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
28 /**
29 * @class ACE_Shared_Memory_MM
31 * @brief Shared memory wrapper based on MMAP.
33 * This class provides a very simple-minded shared memory manager. We
34 * strongly recommend that you do NOT use this class. Instead, please
35 * use @c ACE_Malloc, which has much more powerful capabilities.
37 class ACE_Export ACE_Shared_Memory_MM : public ACE_Shared_Memory
39 public:
40 // = Initialization and termination methods.
41 /// Default constructor.
42 ACE_Shared_Memory_MM (void);
44 /// Constructor.
45 ACE_Shared_Memory_MM (ACE_HANDLE handle,
46 size_t length = static_cast<size_t> (-1),
47 int prot = PROT_RDWR,
48 int share = ACE_MAP_PRIVATE,
49 char *addr = 0,
50 ACE_OFF_T pos = 0);
52 /// Constructor.
53 ACE_Shared_Memory_MM (const ACE_TCHAR *file_name,
54 size_t length = static_cast<size_t> (-1),
55 int flags = O_RDWR | O_CREAT,
56 int mode = ACE_DEFAULT_FILE_PERMS,
57 int prot = PROT_RDWR,
58 int share = ACE_MAP_SHARED,
59 char *addr = 0, ACE_OFF_T pos = 0);
61 /// Open method.
62 int open (ACE_HANDLE handle,
63 size_t length = static_cast<size_t> (-1),
64 int prot = PROT_RDWR,
65 int share = ACE_MAP_PRIVATE,
66 char *addr = 0,
67 ACE_OFF_T pos = 0);
69 /// Open method.
70 int open (const ACE_TCHAR *file_name,
71 size_t length = static_cast<size_t> (-1),
72 int flags = O_RDWR | O_CREAT,
73 int mode = ACE_DEFAULT_FILE_PERMS,
74 int prot = PROT_RDWR,
75 int share = ACE_MAP_SHARED,
76 char *addr = 0,
77 ACE_OFF_T pos = 0);
79 /// Return the name of file that is mapped (if any).
80 const ACE_TCHAR *filename (void) const;
82 /// Close down the shared memory segment.
83 virtual int close (void);
85 /// Remove the shared memory segment and the underlying file.
86 virtual int remove (void);
88 // = Allocation and deallocation methods.
89 /// Create a new chuck of memory containing @a size bytes.
90 virtual void *malloc (size_t size = 0);
92 /// Free a chuck of memory allocated by
93 /// <ACE_Shared_Memory_MM::malloc>.
94 virtual int free (void *p);
96 /// Return the size of the shared memory segment.
97 virtual size_t get_segment_size (void) const;
99 /// Return the ID of the shared memory segment (i.e., an ACE_HANDLE).
100 virtual ACE_HANDLE get_id (void) const;
102 /// Dump the state of an object.
103 void dump (void) const;
105 /// Declare the dynamic allocation hooks.
106 ACE_ALLOC_HOOK_DECLARE;
108 private:
109 /// This version is implemented with memory-mapped files.
110 ACE_Mem_Map shared_memory_;
113 ACE_END_VERSIONED_NAMESPACE_DECL
115 #if defined (__ACE_INLINE__)
116 #include "ace/Shared_Memory_MM.inl"
117 #endif /* __ACE_INLINE__ */
119 #include /**/ "ace/post.h"
120 #endif /* ACE_SHARED_MALLOC_MM_H */