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

ACE_Based_Pointer_Repository Class Reference

Maps pointers to the base address of the region to which each pointer belongs. More...

#include <Based_Pointer_Repository.h>

Collaboration diagram for ACE_Based_Pointer_Repository:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_Based_Pointer_Repository (void)
 ~ACE_Based_Pointer_Repository (void)
int find (void *addr, void *&base_addr)
int bind (void *addr, size_t size)
 Bind a new entry to the repository or update the size of an existing entry. Returns 0 on success and -1 on failure. More...

int unbind (void *addr)
 Unbind from the repository the <base_addr> that <addr> is contained within. More...


Private Attributes

ACE_Based_Pointer_Repository_Reprep_
 Use the "Cheshire-Cat" technique to hide the implementation in order to avoid circular include dependencies. More...


Detailed Description

Maps pointers to the base address of the region to which each pointer belongs.

Definition at line 36 of file Based_Pointer_Repository.h.


Constructor & Destructor Documentation

ACE_Based_Pointer_Repository::ACE_Based_Pointer_Repository void   
 

Definition at line 32 of file Based_Pointer_Repository.cpp.

References ACE_NEW, and ACE_TRACE.

00033 {
00034   ACE_TRACE ("ACE_Based_Pointer_Repository::ACE_Based_Pointer_Repository");
00035   ACE_NEW (this->rep_,
00036            ACE_Based_Pointer_Repository_Rep);
00037 }

ACE_Based_Pointer_Repository::~ACE_Based_Pointer_Repository void   
 

Definition at line 39 of file Based_Pointer_Repository.cpp.

References ACE_TRACE, and rep_.

00040 {
00041   ACE_TRACE ("ACE_Based_Pointer_Repository::~ACE_Based_Pointer_Repository");
00042   delete this->rep_;
00043 }


Member Function Documentation

int ACE_Based_Pointer_Repository::bind void *    addr,
size_t    size
 

Bind a new entry to the repository or update the size of an existing entry. Returns 0 on success and -1 on failure.

Definition at line 76 of file Based_Pointer_Repository.cpp.

References ACE_GUARD_RETURN, ACE_SYNCH_MUTEX, ACE_TRACE, ACE_Based_Pointer_Repository_Rep::addr_map_, ACE_Hash_Map_Manager_Ex< ACE_NS_String, ACE_NS_Internal, ACE_Hash< ACE_NS_String >, ACE_Equal_To< ACE_NS_String >, ACE_Null_Mutex >::rebind, and rep_.

00078 {
00079   ACE_TRACE ("ACE_Based_Pointer_Repository::bind");
00080   ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1);
00081 
00082   return this->rep_->addr_map_.rebind (addr, size);
00083 }

int ACE_Based_Pointer_Repository::find void *    addr,
void *&    base_addr
 

Return the appropriate <base_addr> region that contains <addr>. Returns 1 on success and 0 if the <addr> isn't contained in any <base_addr> region.

Definition at line 48 of file Based_Pointer_Repository.cpp.

References ACE_GUARD_RETURN, ACE_SYNCH_MUTEX, ACE_TRACE, ACE_Map_Entry< void *, size_t >::ext_id_, ACE_Based_Pointer_Repository_Rep::MAP_ENTRY, and ACE_Based_Pointer_Repository_Rep::MAP_ITERATOR.

00050 {
00051   ACE_TRACE ("ACE_Based_Pointer_Repository::find");
00052   ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1);
00053   ACE_Based_Pointer_Repository_Rep::MAP_ENTRY *ce = 0;
00054 
00055   for (ACE_Based_Pointer_Repository_Rep::MAP_ITERATOR iter (this->rep_->addr_map_);
00056        iter.next (ce) != 0;
00057        iter.advance ())
00058     // Check to see if <addr> is within any of the regions.
00059     if (addr >= ce->ext_id_
00060         && addr < ((char *) ce->ext_id_ + ce->int_id_))
00061       {
00062         // Assign the base address.
00063         base_addr = ce->ext_id_;
00064         return 1;
00065       }
00066 
00067   // Assume base address 0 (e.g., if new'ed).
00068   base_addr = 0;
00069   return 0;
00070 }

int ACE_Based_Pointer_Repository::unbind void *    addr
 

Unbind from the repository the <base_addr> that <addr> is contained within.

Definition at line 88 of file Based_Pointer_Repository.cpp.

References ACE_GUARD_RETURN, ACE_SYNCH_MUTEX, ACE_TRACE, ACE_Based_Pointer_Repository_Rep::addr_map_, ACE_Based_Pointer_Repository_Rep::MAP_ENTRY, ACE_Based_Pointer_Repository_Rep::MAP_ITERATOR, rep_, and ACE_Hash_Map_Manager_Ex< ACE_NS_String, ACE_NS_Internal, ACE_Hash< ACE_NS_String >, ACE_Equal_To< ACE_NS_String >, ACE_Null_Mutex >::unbind.

00089 {
00090   ACE_TRACE ("ACE_Based_Pointer_Repository::unbind");
00091   ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1);
00092   ACE_Based_Pointer_Repository_Rep::MAP_ENTRY *ce = 0;
00093 
00094   // Search for service handlers that requested notification.
00095 
00096   for (ACE_Based_Pointer_Repository_Rep::MAP_ITERATOR iter (this->rep_->addr_map_);
00097        iter.next (ce) != 0;
00098        iter.advance ())
00099     {
00100       // Check to see if <addr> is within any of the regions and if
00101       // so, unbind the key from the map.
00102       if (addr >= ce->ext_id_
00103           && addr < ((char *) ce->ext_id_ + ce->int_id_))
00104         // Unbind base address.
00105         return this->rep_->addr_map_.unbind (ce->ext_id_);
00106     }
00107 
00108   return 0;
00109 }


Member Data Documentation

ACE_Based_Pointer_Repository_Rep* ACE_Based_Pointer_Repository::rep_ [private]
 

Use the "Cheshire-Cat" technique to hide the implementation in order to avoid circular include dependencies.

Definition at line 67 of file Based_Pointer_Repository.h.

Referenced by bind, unbind, and ~ACE_Based_Pointer_Repository.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:46:07 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002