00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Endpoint_Strategy.h 00006 * 00007 * $Id: Endpoint_Strategy.h 76589 2007-01-25 18:04:11Z elliott_c $ 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 00054 /// Called by the MMDevice, when it needs to create an B type endpoint 00055 virtual int create_B (AVStreams::StreamEndPoint_B_ptr &stream_endpoint, 00056 AVStreams::VDev_ptr &vdev); 00057 00058 protected: 00059 /// The "A" stream endpoint 00060 AVStreams::StreamEndPoint_A_var stream_endpoint_a_; 00061 00062 /// The "B" stream endpoint 00063 AVStreams::StreamEndPoint_B_var stream_endpoint_b_; 00064 00065 /// The vdev 00066 AVStreams::VDev_var vdev_; 00067 00068 }; 00069 00070 // ---------------------------------------------------------------------- 00071 /** 00072 * @class TAO_AV_Endpoint_Process_Strategy 00073 * @brief Process-based strategy for creating endpoints. 00074 * Abstract base class. 00075 */ 00076 class TAO_AV_Export TAO_AV_Endpoint_Process_Strategy 00077 : public TAO_AV_Endpoint_Strategy 00078 { 00079 00080 public: 00081 /// Constructor. The process_options contain the name and arguments 00082 /// for the process to be created 00083 TAO_AV_Endpoint_Process_Strategy (ACE_Process_Options *process_options); 00084 00085 /// Destructor. 00086 virtual ~TAO_AV_Endpoint_Process_Strategy (void); 00087 00088 /// creates a new child process, and waits on a semaphore 00089 /// until the child process has finished creating the endpoints 00090 virtual int activate (void); 00091 00092 protected: 00093 /// Bind to the naming service 00094 virtual int bind_to_naming_service (void); 00095 00096 /** 00097 * Get the object reference for the newly created stream 00098 * endpoint (which will be in the child process) 00099 * Subclasses will define the functionality for this 00100 */ 00101 virtual int get_stream_endpoint (void) = 0; 00102 00103 /// Get the Vdev object reference for the newly created 00104 /// endpoint 00105 virtual int get_vdev (void); 00106 00107 /// Naming context 00108 CosNaming::NamingContext_var naming_context_; 00109 00110 /// Name and arguments for the process to be created 00111 ACE_Process_Options *process_options_; 00112 00113 /// name of this host used for resolving unique names. 00114 char host_[MAXHOSTNAMELEN]; 00115 00116 /// My child's process id. 00117 pid_t pid_; 00118 }; 00119 00120 00121 // ---------------------------------------------------------------------- 00122 00123 /** 00124 * @class TAO_AV_Endpoint_Process_Strategy_A 00125 * @brief Process-based strategy to create "A" type endpoints 00126 */ 00127 class TAO_AV_Export TAO_AV_Endpoint_Process_Strategy_A 00128 : public TAO_AV_Endpoint_Process_Strategy 00129 { 00130 00131 public: 00132 /// Constructor 00133 TAO_AV_Endpoint_Process_Strategy_A (ACE_Process_Options *process_options); 00134 00135 /// Destructor. 00136 virtual ~TAO_AV_Endpoint_Process_Strategy_A (void); 00137 00138 protected: 00139 /// Creates an "A" type stream endpoint, and a vdev 00140 virtual int create_A (AVStreams::StreamEndPoint_A_ptr &stream_endpoint, 00141 AVStreams::VDev_ptr &vdev); 00142 00143 /// Gets the "A" type stream endpoint from the child process 00144 virtual int get_stream_endpoint (void); 00145 00146 }; 00147 00148 // ---------------------------------------------------------------------- 00149 00150 /** 00151 * @class TAO_AV_Endpoint_Process_Strategy_B 00152 * @brief Process-based strategy to create "B" type endpoints 00153 */ 00154 class TAO_AV_Export TAO_AV_Endpoint_Process_Strategy_B 00155 : public TAO_AV_Endpoint_Process_Strategy 00156 { 00157 00158 public: 00159 /// Constructor 00160 TAO_AV_Endpoint_Process_Strategy_B (ACE_Process_Options *process_options); 00161 00162 /// Destructor. 00163 virtual ~TAO_AV_Endpoint_Process_Strategy_B (void); 00164 00165 protected: 00166 /// Creates a "B" type stream endpoint, and a vdev 00167 virtual int create_B (AVStreams::StreamEndPoint_B_ptr &stream_endpoint, 00168 AVStreams::VDev_ptr &vdev); 00169 00170 00171 /// Gets the object reference of the "B" type streamendpoint. 00172 virtual int get_stream_endpoint (void); 00173 00174 }; 00175 00176 TAO_END_VERSIONED_NAMESPACE_DECL 00177 00178 // Include the templates here. 00179 #include "orbsvcs/AV/Endpoint_Strategy_T.h" 00180 00181 #if defined(_MSC_VER) 00182 #pragma warning(pop) 00183 #endif /* _MSC_VER */ 00184 00185 #include /**/ "ace/post.h" 00186 #endif /* TAO_AV_ENDPOINT_STRATEGY_H */