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

Active_Map_Manager.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Active_Map_Manager.h
00006  *
00007  *  $Id: Active_Map_Manager.h,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  @author Irfan Pyarali
00010  */
00011 //=============================================================================
00012 
00013 
00014 #ifndef ACE_ACTIVE_MAP_MANAGER_H
00015 #define ACE_ACTIVE_MAP_MANAGER_H
00016 #include "ace/pre.h"
00017 
00018 #include "ace/OS_String.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 /**
00025  * @class ACE_Active_Map_Manager_Key
00026  *
00027  * @brief Key used in the Active Object Map.
00028  *
00029  * This key keeps information of the index and the generation
00030  * count of the slot it represents.  Since the index information
00031  * is part of the key, lookups are super fast and predictable,
00032  */
00033 class ACE_Export ACE_Active_Map_Manager_Key
00034 {
00035 public:
00036   /// Default constructor.
00037   ACE_Active_Map_Manager_Key (void);
00038 
00039   /**
00040    * Constructor given the <slot_index> and <slot_generation> number.
00041    * This is useful once the user has somehow recovered the
00042    * <slot_index> and <slot_generation> number from the client.
00043    */
00044   ACE_Active_Map_Manager_Key (ACE_UINT32 slot_index,
00045                               ACE_UINT32 slot_generation);
00046 
00047   /// Get the <slot_index>.
00048   ACE_UINT32 slot_index (void) const;
00049 
00050   /// Set the <slot_index>.
00051   void slot_index (ACE_UINT32 i);
00052 
00053   /// Get the <slot_generation> number.
00054   ACE_UINT32 slot_generation (void) const;
00055 
00056   /// Set the <slot_generation> number.
00057   void slot_generation (ACE_UINT32 g);
00058 
00059   /// Size required to store information about active key.
00060   static size_t size (void);
00061 
00062   /// Recover state of active key from <data>.  User must make sure
00063   /// that <data> encoded using the <encode> method.
00064   void decode (const void *data);
00065 
00066   /// Encode state of the active key into <data>.  <data> must be as
00067   /// big as the value returned from <size>.
00068   void encode (void *data) const;
00069 
00070   /// Compare keys.
00071   int operator== (const ACE_Active_Map_Manager_Key &rhs) const;
00072   int operator!= (const ACE_Active_Map_Manager_Key &rhs) const;
00073 
00074   // = This really should be protected but because of template
00075   // friends, they are not.
00076 
00077   /// Increment the <slot_generation> number.
00078   void increment_slot_generation_count (void);
00079 
00080 private:
00081 
00082   /**
00083    * @brief Data for the Active Object Map Key.
00084    *
00085    * This separate structure makes it easier to manage copying
00086    *  the index and the generation to and from the user buffer.
00087    *
00088    */
00089   struct key_data
00090   {
00091     /// Slot index in the active map.
00092     ACE_UINT32 slot_index_;
00093 
00094     /// Slot generation number of <slot_index_> slot in the active map.
00095     ACE_UINT32 slot_generation_;
00096   };
00097 
00098   /// Data for the Active Object Map Key.
00099   key_data key_data_;
00100 };
00101 
00102 #if defined (__ACE_INLINE__)
00103 #include "ace/Active_Map_Manager.i"
00104 #endif /* __ACE_INLINE__ */
00105 
00106 // Include the templates here.
00107 #include "ace/Active_Map_Manager_T.h"
00108 
00109 #include "ace/post.h"
00110 #endif /* ACE_ACTIVE_MAP_MANAGER_H */

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