MMAP_Allocator.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    MMAP_Allocator.h
00006  *
00007  *  MMAP_Allocator.h,v 1.2 2006/06/19 19:47:33 jwillemsen Exp
00008  *
00009  *  @author Ossama Othman <ossama@dre.vanderbilt.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_MMAP_ALLOCATOR_H
00014 #define TAO_MMAP_ALLOCATOR_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "tao/orbconf.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #ifdef ACE_HAS_SENDFILE
00025 
00026 #include "ace/Malloc_T.h"
00027 #include "ace/MMAP_Memory_Pool.h"
00028 #include "ace/Thread_Mutex.h"
00029 
00030 
00031 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00032 
00033 // An ACE_Lite_MMAP_Memory_Pool is used since sync()ing is not
00034 // needed.  All memory allocated by the TAO_MMAP_Allocator is meant
00035 // for strictly transient data, not persistent.
00036 typedef ACE_Allocator_Adapter <ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX> > TAO_MMAP_Allocator_Base;
00037 
00038 /**
00039  * @class TAO_MMAP_Allocator
00040  *
00041  * @brief mmap-based allocator.
00042  *
00043  * This class utilizes and
00044  */
00045 class TAO_MMAP_Allocator
00046   : public TAO_MMAP_Allocator_Base
00047 {
00048 public:
00049 
00050   /// Constructor
00051   TAO_MMAP_Allocator (void);
00052 
00053   /// Destructor.
00054   virtual ~TAO_MMAP_Allocator (void);
00055 
00056   /// Return backing store handle.
00057   ACE_HANDLE handle (void);
00058 
00059   /// Return offset in backing store file for memory address @a p. If @a p
00060   /// is not coming from this allocator -1 is returned.
00061   off_t offset (void * p);
00062 
00063 private:
00064 
00065   // Disallow copying.
00066   TAO_MMAP_Allocator (TAO_MMAP_Allocator const &);
00067   void operator= (TAO_MMAP_Allocator const &);
00068 
00069 };
00070 
00071 TAO_END_VERSIONED_NAMESPACE_DECL
00072 
00073 #endif  /* ACE_HAS_SENDFILE */
00074 
00075 #include /**/ "ace/post.h"
00076 
00077 #endif  /* TAO_MMAP_ALLOCATOR_H */

Generated on Thu Nov 9 11:54:16 2006 for TAO by doxygen 1.3.6