Active_Map_Manager.h

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

Generated on Thu Nov 9 09:41:45 2006 for ACE by doxygen 1.3.6