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

ORB_Table.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file     ORB_Table.h
00006  *
00007  *  $Id: ORB_Table.h,v 1.1.1.2.2.1 2003/03/11 23:53:15 pgontla Exp $
00008  *
00009  *  @author Ossama Othman <ossama@uci.edu>
00010  *  @author Carlos O'Ryan <coryan@uci.edu>
00011  */
00012 //=============================================================================
00013 
00014 
00015 #ifndef TAO_ORB_TABLE_H
00016 #define TAO_ORB_TABLE_H
00017 
00018 #include "ace/pre.h"
00019 
00020 #include "tao/TAO_Export.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 #include "tao/corbafwd.h"
00027 
00028 #include "ace/Synch.h"
00029 #include "ace/Hash_Map_Manager_T.h"
00030 #include "ace/Functor.h"
00031 
00032 // Forward declarations.
00033 class TAO_ORB_Core;
00034 
00035 /**
00036  * @class TAO_ORB_Table
00037  *
00038  * @brief Keep a table with all the ORBs in the system.
00039  *
00040  * CORBA::ORB_init() is supposed to return the same ORB if the
00041  * user specifies the same ORBid, either in the ORB_init()
00042  * parameter or in the -ORBid option.
00043  * This class is used to implement that feature.
00044  * It is also useful when trying to determine if an object
00045  * reference is collocated or not.
00046  *
00047  * @note This class should be instantiated via its instance() method.
00048  *       Normally this would be enforced by making the constructor
00049  *       protected but that forces a friend declaration containing a
00050  *       template type (TAO_Singleton) with a static member to be
00051  *       introduced.  In turn, this potentially introduces problems in
00052  *       MS Windows DLL environments due to the occurance of multiple
00053  *       singleton instances.  There should only be one!
00054  */
00055 class TAO_Export TAO_ORB_Table
00056 {
00057 public:
00058 
00059   /// Constructor
00060   /**
00061    * @note See the note in the class description for an explanation of
00062    *       why this constructor is not protected.
00063    */
00064   TAO_ORB_Table (void);
00065 
00066   /// destructor
00067   ~TAO_ORB_Table (void);
00068 
00069   typedef ACE_Hash_Map_Manager_Ex<const char *, TAO_ORB_Core *, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex> Table;
00070   typedef Table::iterator Iterator;
00071 
00072   /// The canonical ACE_Map methods.
00073   //@{
00074   Iterator begin (void);
00075   Iterator end (void);
00076   int bind (const char *orb_id, TAO_ORB_Core *orb_core);
00077   TAO_ORB_Core* find (const char *orb_id);
00078   int unbind (const char *orb_id);
00079   TAO_ORB_Core* const * get_orbs( size_t& num_orbs );
00080   //@}
00081 
00082   /// Obtain the first ORB for the ORB_Core_instance() implementation
00083   TAO_ORB_Core *first_orb (void);
00084 
00085   /// Return a unique instance
00086   static TAO_ORB_Table *instance (void);
00087 
00088   /// Set the ORB related to the orb_id as the default ORB and not the
00089   /// ORB that is first binded.
00090   void set_default (const char *orb_id);
00091 
00092   /// Method the ORB invokes to specify that it doesnt want to be the
00093   /// default ORB if there are more than one ORB registered.
00094   void not_default (const char *orb_id);
00095 
00096   /// Accessor to the underlying table_ 
00097   Table * table (void);
00098 
00099 private:
00100 
00101   /// Prevent copying
00102   ACE_UNIMPLEMENTED_FUNC (TAO_ORB_Table (const TAO_ORB_Table &))
00103   ACE_UNIMPLEMENTED_FUNC (void operator= (const TAO_ORB_Table &))
00104 
00105 private:
00106 
00107   /// Update our list of orbs
00108   void update_orbs();
00109 
00110   /// Variable to check if the first ORB decides not to be the default
00111   CORBA::Boolean first_orb_not_default_;
00112 
00113   /// The implementation.
00114   Table table_;
00115 
00116   /// The first ORB created by the user
00117   TAO_ORB_Core *first_orb_;
00118 
00119   /// List of orbs for get_orbs call
00120   TAO_ORB_Core **orbs_;
00121   size_t       num_orbs_;
00122 
00123 };
00124 
00125 #if defined (__ACE_INLINE__)
00126 # include "tao/ORB_Table.inl"
00127 #endif /* __ACE_INLINE__ */
00128 
00129 #include "ace/post.h"
00130 
00131 #endif  /* TAO_ORB_TABLE_H */

Generated on Mon Jun 16 13:49:12 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002