RT_ORB.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 //=============================================================================
00003 /**
00004  *  @file   RT_ORB.h
00005  *
00006  *  $Id: RT_ORB.h 78627 2007-06-28 08:50:01Z johnnyw $
00007  *
00008  *  @author Marina Spivak <marina@cs.wustl.edu>
00009  */
00010 //=============================================================================
00011 
00012 #ifndef TAO_RT_ORB_H
00013 #define TAO_RT_ORB_H
00014 #include /**/ "ace/pre.h"
00015 
00016 #include "tao/orbconf.h"
00017 
00018 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "tao/RTCORBA/RTCORBA_includeC.h"
00025 #include "tao/LocalObject.h"
00026 #include "ace/Hash_Map_Manager_T.h"
00027 
00028 #if (TAO_HAS_NAMED_RT_MUTEXES == 1)
00029 # include "ace/Null_Mutex.h"
00030 #endif
00031 
00032 #if defined(_MSC_VER)
00033 #pragma warning(push)
00034 #pragma warning(disable:4250)
00035 #endif /* _MSC_VER */
00036 
00037 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00038 
00039 // Forward reference for TAO_Named_RT_Mutex_Manager
00040 class TAO_RT_Mutex;
00041 class TAO_Thread_Pool_Manager;
00042 
00043 /**
00044  * @class TAO_Named_RT_Mutex_Manager
00045  *
00046  * @brief Manages the names of named and unnamed RT Mutexes
00047  *
00048  */
00049 
00050 class TAO_RTCORBA_Export TAO_Named_RT_Mutex_Manager
00051 {
00052 
00053 public:
00054   /// Constructor.
00055   TAO_Named_RT_Mutex_Manager (void);
00056 
00057   /// Destructor.
00058   ~TAO_Named_RT_Mutex_Manager (void);
00059 
00060   RTCORBA::Mutex_ptr create_mutex (void);
00061 
00062   void destroy_mutex (RTCORBA::Mutex_ptr the_mutex);
00063 
00064   RTCORBA::Mutex_ptr create_named_mutex (const char *name,
00065                                          CORBA::Boolean_out created_flag);
00066 
00067   RTCORBA::Mutex_ptr open_named_mutex (const char * name);
00068 
00069 private:
00070 
00071 #if (TAO_HAS_NAMED_RT_MUTEXES == 1)
00072   /// Hash map for named RT Mutexes
00073   ACE_Hash_Map_Manager_Ex<
00074     ACE_CString,
00075     RTCORBA::Mutex_var,
00076     ACE_Hash<ACE_CString>,
00077     ACE_Equal_To<ACE_CString>,
00078     ACE_Null_Mutex> map_;
00079 
00080   TAO_SYNCH_MUTEX lock_;
00081 #endif /* TAO_HAS_NAMED_RT_MUTEXES == 1 */
00082 };
00083 
00084 
00085 /**
00086  * @class TAO_RT_ORB
00087  *
00088  * @brief RTCORBA::RTORB implementation
00089  *
00090  * Creates and destroys RT CORBA objects, i.e., policies,
00091  * threadpools, mutexes.
00092  */
00093 class TAO_RTCORBA_Export TAO_RT_ORB
00094   : public RTCORBA::RTORB,
00095     public TAO_Local_RefCounted_Object
00096 {
00097 public:
00098 
00099   /// Constructor.
00100   TAO_RT_ORB (TAO_ORB_Core *orb_core, ACE_Time_Value const &dynamic_thread_idle_timeout);
00101 
00102   /**
00103    * Create a new mutex.  Mutexes returned by this method
00104    * are the same as those used internally by the ORB, so that
00105    * consistant priority inheritance/piority ceiling semantics
00106    * can be guaranteed.
00107    */
00108   virtual RTCORBA::Mutex_ptr create_mutex (void);
00109 
00110   /**
00111    * Destroy a mutex.  Currently this is a no-op since RTCORBA::Mutex
00112    * instances are destroyed as soon as their reference counts go to
00113    * 0.
00114    */
00115   virtual void destroy_mutex (RTCORBA::Mutex_ptr the_mutex);
00116 
00117   /**
00118    * Create a mutex and assign a name to it.  If the
00119    * mutex already exists, it is returned and the created_flag
00120    * is set to 0.
00121    */
00122   virtual RTCORBA::Mutex_ptr create_named_mutex (const char *name,
00123                                                  CORBA::Boolean_out created_flag);
00124 
00125   /// Retrieve a previously created mutex.
00126   virtual RTCORBA::Mutex_ptr open_named_mutex (const char * name);
00127 
00128   /**
00129    * Create and return a TCPProtocolProperties instance with the specified
00130    * parameters.
00131    */
00132   RTCORBA::TCPProtocolProperties_ptr
00133   create_tcp_protocol_properties (CORBA::Long send_buffer_size,
00134                                   CORBA::Long recv_buffer_size,
00135                                   CORBA::Boolean keep_alive,
00136                                   CORBA::Boolean dont_route,
00137                                   CORBA::Boolean no_delay,
00138                                   CORBA::Boolean enable_network_priority);
00139 
00140   RTCORBA::UnixDomainProtocolProperties_ptr
00141   create_unix_domain_protocol_properties (CORBA::Long send_buffer_size,
00142                                           CORBA::Long recv_buffer_size);
00143 
00144   RTCORBA::SharedMemoryProtocolProperties_ptr
00145   create_shared_memory_protocol_properties (CORBA::Long send_buffer_size,
00146                                             CORBA::Long recv_buffer_size,
00147                                             CORBA::Boolean keep_alive,
00148                                             CORBA::Boolean dont_route,
00149                                             CORBA::Boolean no_delay,
00150                                             CORBA::Long preallocate_buffer_size,
00151                                             const char *mmap_filename,
00152                                             const char *mmap_lockname);
00153 
00154   RTCORBA::UserDatagramProtocolProperties_ptr
00155   create_user_datagram_protocol_properties (CORBA::Long send_buffer_size,
00156                                             CORBA::Long recv_buffer_size,
00157                                             CORBA::Boolean enable_network_priority);
00158 
00159   RTCORBA::StreamControlProtocolProperties_ptr
00160   create_stream_control_protocol_properties (CORBA::Long send_buffer_size,
00161                                              CORBA::Long recv_buffer_size,
00162                                              CORBA::Boolean keep_alive,
00163                                              CORBA::Boolean dont_route,
00164                                              CORBA::Boolean no_delay,
00165                                              CORBA::Boolean enable_network_priority);
00166 
00167   /// Create a RTCORBA threadpool to manage a set of threads without lanes.
00168   virtual RTCORBA::ThreadpoolId
00169   create_threadpool (CORBA::ULong stacksize,
00170                      CORBA::ULong static_threads,
00171                      CORBA::ULong dynamic_threads,
00172                      RTCORBA::Priority default_priority,
00173                      CORBA::Boolean allow_request_buffering,
00174                      CORBA::ULong max_buffered_requests,
00175                      CORBA::ULong max_request_buffer_size);
00176 
00177   /**
00178    * Create a threadpool and separate it into subsets based on
00179    * priorities.
00180    */
00181   virtual RTCORBA::ThreadpoolId
00182   create_threadpool_with_lanes (CORBA::ULong stacksize,
00183                                 const RTCORBA::ThreadpoolLanes & lanes,
00184                                 CORBA::Boolean allow_borrowing,
00185                                 CORBA::Boolean allow_request_buffering,
00186                                 CORBA::ULong max_buffered_requests,
00187                                 CORBA::ULong max_request_buffer_size);
00188 
00189   /// Free the resources associated with the specified threadpool.
00190   virtual void destroy_threadpool (RTCORBA::ThreadpoolId threadpool);
00191 
00192   /// Create a priority model policy for use when configuring a POA.
00193   virtual RTCORBA::PriorityModelPolicy_ptr
00194   create_priority_model_policy (RTCORBA::PriorityModel priority_model,
00195                                 RTCORBA::Priority server_priority);
00196 
00197   /// Create a ThreadpoolPolicy instance for POA creation
00198   virtual RTCORBA::ThreadpoolPolicy_ptr
00199   create_threadpool_policy (RTCORBA::ThreadpoolId threadpool);
00200 
00201   /**
00202    * Create a PriorityBandedConnectionPolicy instance
00203    * for use on either the client or server side
00204    */
00205   virtual RTCORBA::PriorityBandedConnectionPolicy_ptr
00206   create_priority_banded_connection_policy (const RTCORBA::PriorityBands &
00207                                             priority_bands);
00208 
00209   /**
00210    * Create a PrivateConnectionPolicy instance to use on client
00211    * to request a private (non-multiplexed) transport connection
00212    * to the server.
00213    */
00214   virtual RTCORBA::PrivateConnectionPolicy_ptr
00215   create_private_connection_policy (void);
00216 
00217   /**
00218    * Create a ServerProtocolPolicy instance to select and configure
00219    * communication protocols on the server side.
00220    */
00221   virtual RTCORBA::ServerProtocolPolicy_ptr
00222   create_server_protocol_policy (const RTCORBA::ProtocolList & protocols);
00223 
00224   /**
00225    * Create a ClientProtocolPolicy instance to select and configure
00226    * communication protocols on the client side.
00227    */
00228   virtual RTCORBA::ClientProtocolPolicy_ptr
00229   create_client_protocol_policy (const RTCORBA::ProtocolList & protocols);
00230 
00231   /// Reference to our creating ORB Core.
00232   TAO_ORB_Core *orb_core (void) const;
00233 
00234   /// Get the Thread Pool Manager.
00235   TAO_Thread_Pool_Manager &tp_manager (void) const;
00236 
00237   /**
00238    * This method changes the scheduling policy of the calling thread
00239    * to match the scheduling policy specified in the svc.conf file.
00240    * The priority of the calling thread will be set to the minimum
00241    * priority supported by that scheduling policy.
00242    *
00243    * This method make sense on those platform (e.g., Linux) where
00244    * PTHREAD_SCOPE_SYSTEM is the only scheduling scope supported.  On
00245    * other platforms, this method is a no-op since the only way to get
00246    * the real-time threading behavior is to setup the
00247    * PTHREAD_SCOPE_SYSTEM scheduling scope when a thread is being
00248    * created.  On such platforms, one can set the correct scheduling
00249    * scope and policy when creating the thread, thus not needing to
00250    * use this method.
00251    */
00252   static int modify_thread_scheduling_policy (CORBA::ORB_ptr orb);
00253 
00254 protected:
00255 
00256   /// Protected destructor to enforce proper memory management of this
00257   /// reference counted object.
00258   virtual ~TAO_RT_ORB (void);
00259 
00260 protected:
00261 
00262   /// Reference to our creating ORB Core.
00263   TAO_ORB_Core * const orb_core_;
00264 
00265   /// mutex_mgr_ manages the names associated with named mutexes.
00266   TAO_Named_RT_Mutex_Manager mutex_mgr_;
00267 
00268   /// Thread Pool Manager
00269   TAO_Thread_Pool_Manager *tp_manager_;
00270 
00271   /// Dynamic thread idle timeout
00272   ACE_Time_Value const dynamic_thread_idle_timeout_;
00273 };
00274 
00275 TAO_END_VERSIONED_NAMESPACE_DECL
00276 
00277 #if defined(_MSC_VER)
00278 #pragma warning(pop)
00279 #endif /* _MSC_VER */
00280 
00281 #endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
00282 
00283 #include /**/ "ace/post.h"
00284 #endif /* TAO_RT_ORB_H */

Generated on Sun Jan 27 13:33:22 2008 for TAO_RTCORBA by doxygen 1.3.6