Endpoint_Strategy.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   Endpoint_Strategy.h
00006  *
00007  *  Endpoint_Strategy.h,v 5.22 2006/03/14 06:14:24 jtc Exp
00008  *
00009  *  @author Sumedh Mungee <sumedh@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 
00014 #ifndef TAO_AV_ENDPOINT_STRATEGY_H
00015 #define TAO_AV_ENDPOINT_STRATEGY_H
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "orbsvcs/AV/AVStreams_i.h"
00019 #include "ace/os_include/os_netdb.h"
00020 
00021 // This is to remove "inherits via dominance" warnings from MSVC.
00022 // MSVC is being a little too paranoid.
00023 #if defined (_MSC_VER)
00024 # pragma warning(push)
00025 # pragma warning (disable : 4250)
00026 #endif /* _MSC_VER */
00027 
00028 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00029 class ACE_Process_Options;
00030 ACE_END_VERSIONED_NAMESPACE_DECL
00031 
00032 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00033 
00034 /**
00035  * @class TAO_AV_Endpoint_Strategy
00036  *
00037  * Base class to define various endpoint strategies
00038  * used by the MMDevice to create the Endpoint and Vdev
00039  */
00040 class TAO_AV_Export TAO_AV_Endpoint_Strategy
00041 {
00042 
00043 public:
00044   /// Constructor
00045   TAO_AV_Endpoint_Strategy (void);
00046 
00047   /// Destructor
00048   virtual ~TAO_AV_Endpoint_Strategy (void);
00049 
00050   /// Called by the MMDevice, when it needs to create an A type endpoint
00051   virtual int create_A (AVStreams::StreamEndPoint_A_ptr &stream_endpoint,
00052                         AVStreams::VDev_ptr &vdev
00053                         ACE_ENV_ARG_DECL);
00054 
00055   /// Called by the MMDevice, when it needs to create an B type endpoint
00056   virtual int create_B (AVStreams::StreamEndPoint_B_ptr &stream_endpoint,
00057                         AVStreams::VDev_ptr &vdev
00058                         ACE_ENV_ARG_DECL);
00059 
00060 protected:
00061   /// The "A" stream endpoint
00062   AVStreams::StreamEndPoint_A_var stream_endpoint_a_;
00063 
00064   /// The "B" stream endpoint
00065   AVStreams::StreamEndPoint_B_var stream_endpoint_b_;
00066 
00067   /// The vdev
00068   AVStreams::VDev_var vdev_;
00069 
00070 };
00071 
00072 // ----------------------------------------------------------------------
00073 /**
00074  * @class TAO_AV_Endpoint_Process_Strategy
00075  * @brief Process-based strategy for creating endpoints.
00076  *        Abstract base class.
00077  */
00078 class TAO_AV_Export TAO_AV_Endpoint_Process_Strategy
00079   : public TAO_AV_Endpoint_Strategy
00080 {
00081 
00082 public:
00083   /// Constructor. The process_options contain the name and arguments
00084   /// for the process to be created
00085   TAO_AV_Endpoint_Process_Strategy (ACE_Process_Options *process_options);
00086 
00087   /// Destructor.
00088   virtual ~TAO_AV_Endpoint_Process_Strategy (void);
00089 
00090   /// creates a new child process, and waits on a semaphore
00091   /// until the child process has finished creating the endpoints
00092   virtual int activate (void);
00093 
00094 protected:
00095   /// Bind to the naming service
00096   virtual int bind_to_naming_service (ACE_ENV_SINGLE_ARG_DECL);
00097 
00098   /**
00099    * Get the object reference for the newly created stream
00100    * endpoint (which will be in the child process)
00101    * Subclasses will define the functionality for this
00102    */
00103   virtual int get_stream_endpoint (ACE_ENV_SINGLE_ARG_DECL) = 0;
00104 
00105   /// Get the Vdev object reference for the newly created
00106   /// endpoint
00107   virtual int get_vdev (ACE_ENV_SINGLE_ARG_DECL);
00108 
00109   /// Naming context
00110   CosNaming::NamingContext_var naming_context_;
00111 
00112   /// Name and arguments for the process to be created
00113   ACE_Process_Options *process_options_;
00114 
00115   /// name of this host used for resolving unique names.
00116   char host_[MAXHOSTNAMELEN];
00117 
00118   /// My child's process id.
00119   pid_t pid_;
00120 };
00121 
00122 
00123 // ----------------------------------------------------------------------
00124 
00125 /**
00126  * @class TAO_AV_Endpoint_Process_Strategy_A
00127  * @brief Process-based strategy to create "A" type endpoints
00128  */
00129 class TAO_AV_Export TAO_AV_Endpoint_Process_Strategy_A
00130   : public TAO_AV_Endpoint_Process_Strategy
00131 {
00132 
00133 public:
00134   /// Constructor
00135   TAO_AV_Endpoint_Process_Strategy_A (ACE_Process_Options *process_options);
00136 
00137   /// Destructor.
00138   virtual ~TAO_AV_Endpoint_Process_Strategy_A (void);
00139 
00140 protected:
00141   /// Creates an "A" type stream endpoint, and a vdev
00142   virtual int create_A (AVStreams::StreamEndPoint_A_ptr &stream_endpoint,
00143                         AVStreams::VDev_ptr &vdev
00144                         ACE_ENV_ARG_DECL);
00145 
00146   /// Gets the "A" type stream endpoint from the child process
00147   virtual int get_stream_endpoint (ACE_ENV_SINGLE_ARG_DECL);
00148 
00149 };
00150 
00151 // ----------------------------------------------------------------------
00152 
00153 /**
00154  * @class TAO_AV_Endpoint_Process_Strategy_B
00155  * @brief Process-based strategy to create "B" type endpoints
00156  */
00157 class TAO_AV_Export TAO_AV_Endpoint_Process_Strategy_B
00158   : public TAO_AV_Endpoint_Process_Strategy
00159 {
00160 
00161 public:
00162   /// Constructor
00163   TAO_AV_Endpoint_Process_Strategy_B (ACE_Process_Options *process_options);
00164 
00165   /// Destructor.
00166   virtual ~TAO_AV_Endpoint_Process_Strategy_B (void);
00167 
00168 protected:
00169   /// Creates a "B" type stream endpoint, and a vdev
00170   virtual int create_B (AVStreams::StreamEndPoint_B_ptr &stream_endpoint,
00171                         AVStreams::VDev_ptr &vdev
00172                         ACE_ENV_ARG_DECL);
00173 
00174 
00175   /// Gets the object reference of the "B" type streamendpoint.
00176   virtual int get_stream_endpoint (ACE_ENV_SINGLE_ARG_DECL);
00177 
00178 };
00179 
00180 TAO_END_VERSIONED_NAMESPACE_DECL
00181 
00182 // Include the templates here.
00183 #include "orbsvcs/AV/Endpoint_Strategy_T.h"
00184 
00185 #if defined(_MSC_VER)
00186 #pragma warning(pop)
00187 #endif /* _MSC_VER */
00188 
00189 #include /**/ "ace/post.h"
00190 #endif /* TAO_AV_ENDPOINT_STRATEGY_H */

Generated on Thu Nov 9 13:44:41 2006 for TAO_AV by doxygen 1.3.6