Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / MMAP_Allocator.h
blob1a7ab2cd1f98f8a6d6a4940fb89e03fee4d2c552
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file MMAP_Allocator.h
7 * @author Ossama Othman <ossama@dre.vanderbilt.edu>
8 */
9 //=============================================================================
11 #ifndef TAO_MMAP_ALLOCATOR_H
12 #define TAO_MMAP_ALLOCATOR_H
14 #include /**/ "ace/pre.h"
16 #include "tao/orbconf.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #if TAO_HAS_SENDFILE == 1
24 #include "ace/Malloc_T.h"
25 #include "ace/MMAP_Memory_Pool.h"
26 #include "ace/Thread_Mutex.h"
29 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
31 // An ACE_Lite_MMAP_Memory_Pool is used since sync()ing is not
32 // needed. All memory allocated by the TAO_MMAP_Allocator is meant
33 // for strictly transient data, not persistent.
34 typedef ACE_Allocator_Adapter <ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, TAO_SYNCH_MUTEX> > TAO_MMAP_Allocator_Base;
36 /**
37 * @class TAO_MMAP_Allocator
39 * @brief mmap-based allocator.
41 * This class utilizes and
43 class TAO_MMAP_Allocator
44 : public TAO_MMAP_Allocator_Base
46 public:
47 /// Constructor
48 TAO_MMAP_Allocator ();
50 /// Destructor.
51 virtual ~TAO_MMAP_Allocator ();
53 /// Return backing store handle.
54 ACE_HANDLE handle ();
56 /// Return offset in backing store file for memory address @a p. If @a p
57 /// is not coming from this allocator -1 is returned.
58 off_t offset (void * p);
60 private:
61 TAO_MMAP_Allocator (TAO_MMAP_Allocator const &) = delete;
62 void operator= (TAO_MMAP_Allocator const &) = delete;
63 TAO_MMAP_Allocator (TAO_MMAP_Allocator &&) = delete;
64 void operator= (TAO_MMAP_Allocator &&) = delete;
67 TAO_END_VERSIONED_NAMESPACE_DECL
69 #endif /* TAO_HAS_SENDFILE==1 */
71 #include /**/ "ace/post.h"
73 #endif /* TAO_MMAP_ALLOCATOR_H */