Shared_Memory_SV.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Shared_Memory_SV.h
00006  *
00007  *  Shared_Memory_SV.h,v 4.17 2006/04/08 23:34:53 schmidt Exp
00008  *
00009  *  @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 
00014 #ifndef ACE_SHARED_MALLOC_SV_H
00015 #define ACE_SHARED_MALLOC_SV_H
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "ace/Shared_Memory.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "ace/SV_Shared_Memory.h"
00025 
00026 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00027 
00028 /**
00029  * @class ACE_Shared_Memory_SV
00030  *
00031  * @brief Shared memory wrapper based on System V shared memory.
00032  *
00033  * This class provides a very simple-minded shared memory manager.  We
00034  * strongly recommend that you do NOT use this class.  Instead, please
00035  * use @c ACE_Malloc, which has much more powerful capabilities.
00036  */
00037 class ACE_Export ACE_Shared_Memory_SV : public ACE_Shared_Memory
00038 {
00039 public:
00040   enum
00041     {
00042       ACE_CREATE = IPC_CREAT,
00043       ACE_OPEN = 0
00044     };
00045 
00046   // = Initialization and termination methods.
00047   ACE_Shared_Memory_SV (void);
00048   ACE_Shared_Memory_SV (key_t id,
00049                         int length,
00050                         int create = ACE_Shared_Memory_SV::ACE_OPEN,
00051                         int perms = ACE_DEFAULT_FILE_PERMS,
00052                         void *addr = 0,
00053                         int flags = 0);
00054 
00055   int open (key_t id,
00056             int length,
00057             int create = ACE_Shared_Memory_SV::ACE_OPEN,
00058             int perms = ACE_DEFAULT_FILE_PERMS,
00059             void *addr = 0,
00060             int flags = 0);
00061 
00062   /// Close down the shared memory segment.
00063   virtual int close (void);
00064 
00065   /// Remove the underlying shared memory segment.
00066   virtual int remove (void);
00067 
00068   // = Allocation and deallocation methods.
00069   /// Create a new chuck of memory containing <size> bytes.
00070   virtual void *malloc (size_t = 0);
00071 
00072   /// Free a chuck of memory allocated by <ACE_Shared_Memory_SV::malloc>.
00073   virtual int free (void *p);
00074 
00075   /// Return the size of the shared memory segment.
00076   virtual int get_segment_size (void) const;
00077 
00078   /// Return the ID of the shared memory segment (i.e., a System V
00079   /// shared memory internal id).
00080   virtual ACE_HANDLE get_id (void) const;
00081 
00082   /// Dump the state of an object.
00083   void dump (void) const;
00084 
00085   /// Declare the dynamic allocation hooks.
00086   ACE_ALLOC_HOOK_DECLARE;
00087 
00088 private:
00089    /// This version is implemented with System V shared memory
00090    /// segments.
00091    ACE_SV_Shared_Memory shared_memory_;
00092 };
00093 
00094 ACE_END_VERSIONED_NAMESPACE_DECL
00095 
00096 #if defined (__ACE_INLINE__)
00097 #include "ace/Shared_Memory_SV.inl"
00098 #endif /* __ACE_INLINE__ */
00099 
00100 #include /**/ "ace/post.h"
00101 #endif /* ACE_SHARED_MALLOC_SV_H */

Generated on Thu Nov 9 09:42:03 2006 for ACE by doxygen 1.3.6