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

Shared_Memory_SV.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Shared_Memory_SV.h
00006  *
00007  *  $Id: Shared_Memory_SV.h,v 1.1.1.3 2001/12/04 14:33:09 chad Exp $
00008  *
00009  *  @author Doug Schmidt
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 /**
00027  * @class ACE_Shared_Memory_SV
00028  *
00029  * @brief Shared memory wrapper based on System V shared memory.
00030  *
00031  * This class provides a very simple-minded shared memory
00032  * manager.  For more a powerful memory allocator please see
00033  * <ACE_Malloc>.
00034  */
00035 class ACE_Export ACE_Shared_Memory_SV : public ACE_Shared_Memory
00036 {
00037 public:
00038   enum
00039     {
00040       ACE_CREATE = IPC_CREAT,
00041       ACE_OPEN = 0
00042     };
00043 
00044   // = Initialization and termination methods.
00045   ACE_Shared_Memory_SV (void);
00046   ACE_Shared_Memory_SV (key_t id,
00047                         int length,
00048                         int create = ACE_Shared_Memory_SV::ACE_OPEN,
00049                         int perms = ACE_DEFAULT_FILE_PERMS,
00050                         void *addr = 0,
00051                         int flags = 0);
00052 
00053   int open (key_t id,
00054             int length,
00055             int create = ACE_Shared_Memory_SV::ACE_OPEN,
00056             int perms = ACE_DEFAULT_FILE_PERMS,
00057             void *addr = 0,
00058             int flags = 0);
00059 
00060   /// Close down the shared memory segment.
00061   virtual int close (void);
00062 
00063   /// Remove the underlying shared memory segment.
00064   virtual int remove (void);
00065 
00066   // = Allocation and deallocation methods.
00067   /// Create a new chuck of memory containing <size> bytes.
00068   virtual void *malloc (size_t = 0);
00069 
00070   /// Free a chuck of memory allocated by <ACE_Shared_Memory_SV::malloc>.
00071   virtual int free (void *p);
00072 
00073   /// Return the size of the shared memory segment.
00074   virtual int get_segment_size (void) const;
00075 
00076   /// Return the ID of the shared memory segment (i.e., a System V
00077   /// shared memory internal id).
00078   virtual ACE_HANDLE get_id (void) const;
00079 
00080   /// Dump the state of an object.
00081   void dump (void) const;
00082 
00083   /// Declare the dynamic allocation hooks.
00084   ACE_ALLOC_HOOK_DECLARE;
00085 
00086 private:
00087    /// This version is implemented with System V shared memory
00088    /// segments.
00089    ACE_SV_Shared_Memory shared_memory_;
00090 };
00091 
00092 #if defined (__ACE_INLINE__)
00093 #include "ace/Shared_Memory_SV.i"
00094 #endif /* __ACE_INLINE__ */
00095 
00096 #include "ace/post.h"
00097 #endif /* ACE_SHARED_MALLOC_SV_H */

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