ImR_Activator_i.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //=============================================================================
00003 /**
00004 *  @file   ImR_Activator_i.h
00005 *
00006 *  $Id: ImR_Activator_i.h 78066 2007-04-17 12:03:07Z elliott_c $
00007 *
00008 *  @author Priyanka Gontla <gontla_p@ociweb.com>
00009 *  @author Darrell Brunsch <brunsch@cs.wustl.edu>
00010 */
00011 //=============================================================================
00012 
00013 #ifndef IMR_ACTIVATOR_I_H
00014 #define IMR_ACTIVATOR_I_H
00015 
00016 #include "activator_export.h"
00017 
00018 #include "ImR_ActivatorS.h"
00019 #include "ImR_LocatorC.h"
00020 
00021 #include "ace/Process_Manager.h"
00022 #include "ace/Hash_Map_Manager.h"
00023 #include "ace/Null_Mutex.h"
00024 #include "ace/SString.h"
00025 
00026 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00027 # pragma once
00028 #endif /* ACE_LACKS_PRAGMA_ONCE */
00029 
00030 class Activator_Options;
00031 
00032 // ace/Functor.h doesn't provide functors for every built in integer type.
00033 // Depending on the platform and what pid_t maps to, the functors may be missing.
00034 struct ACE_Hash_pid_t
00035 {
00036   unsigned long operator () (pid_t t) const
00037   {
00038     return t;
00039   }
00040 };
00041 
00042 struct ACE_Equal_To_pid_t
00043 {
00044   int operator () (const pid_t lhs, const pid_t rhs) const
00045   {
00046     return lhs == rhs;
00047   }
00048 };
00049 
00050 
00051 /**
00052 * @class ImR_Activator_i
00053 *
00054 * @brief IMR Activator Interface.
00055 *
00056 * This class provides the interface for the various activities
00057 * that can be done by the ImR_Activator.
00058 *
00059 */
00060 class Activator_Export ImR_Activator_i : public POA_ImplementationRepository::Activator,
00061                                          public ACE_Event_Handler
00062 {
00063 public:
00064   ImR_Activator_i (void);
00065 
00066  void start_server (
00067    const char* name,
00068    const char* cmdline,
00069    const char* dir,
00070    const ImplementationRepository::EnvironmentList & env);
00071 
00072   void shutdown(void);
00073 
00074   /// Initialize the Server state - parsing arguments and waiting.
00075   int init (Activator_Options& opts);
00076 
00077   /// Cleans up any state created by init*.
00078   int fini (void);
00079 
00080   /// Runs the orb.
00081   int run (void);
00082 
00083   /// Shutdown the orb.
00084   void shutdown (bool wait_for_completion);
00085 
00086 private:
00087 
00088   int init_with_orb (CORBA::ORB_ptr orb, const Activator_Options& opts);
00089 
00090   void register_with_imr(ImplementationRepository::Activator_ptr activator);
00091 
00092   // Handles the death of the child processes of the ImR_Activator.
00093   // Informs the ImR_Locator too.
00094   int handle_exit (ACE_Process * process);
00095 
00096 private:
00097 
00098   typedef ACE_Hash_Map_Manager_Ex<pid_t,
00099                                   ACE_CString,
00100                                   ACE_Hash_pid_t,
00101                                   ACE_Equal_To_pid_t,
00102                                   ACE_Null_Mutex> ProcessMap;
00103 
00104   ACE_Process_Manager process_mgr_;
00105 
00106   PortableServer::POA_var root_poa_;
00107   PortableServer::POA_var imr_poa_;
00108 
00109   ImplementationRepository::Locator_var locator_;
00110 
00111   /// We're given a token when registering with the locator, which
00112   /// we must use when unregistering.
00113   CORBA::Long registration_token_;
00114 
00115   CORBA::ORB_var orb_;
00116 
00117   unsigned int debug_;
00118 
00119   bool notify_imr_;
00120 
00121   ACE_CString name_;
00122 
00123   ProcessMap process_map_;
00124 
00125   /// The default environment buffer length
00126   int env_buf_len_;
00127 };
00128 
00129 #endif /* IMR_ACTIVATOR_I_H */

Generated on Sun Jan 27 15:54:50 2008 for TAO_Implementation_Repository by doxygen 1.3.6