Endpoint_Strategy_T.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   Endpoint_Strategy_T.h
00006  *
00007  *  Endpoint_Strategy_T.h,v 5.21 2006/03/14 06:14:24 jtc Exp
00008  *
00009  *  @author Sumedh Mungee <sumedh@cs.wustl.edu>
00010  *  @author Nagarajan Surendran <naga@cs.wustl.edu>
00011  */
00012 //=============================================================================
00013 
00014 #ifndef TAO_AV_ENDPOINT_STRATEGY_T_H
00015 #define TAO_AV_ENDPOINT_STRATEGY_T_H
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "orbsvcs/AV/Endpoint_Strategy.h"
00019 
00020 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00021 
00022 /**
00023  * @class TAO_AV_Endpoint_Reactive_Strategy
00024  * @brief  Reactive strategy base class
00025  */
00026 template <class T_StreamEndpoint, class T_VDev , class T_MediaCtrl>
00027 class TAO_AV_Endpoint_Reactive_Strategy
00028 : public TAO_AV_Endpoint_Strategy
00029 {
00030 
00031 protected:
00032   // Constructor
00033 
00034   /// Constructor
00035   TAO_AV_Endpoint_Reactive_Strategy (void);
00036 
00037   /// Destructor.
00038   virtual ~TAO_AV_Endpoint_Reactive_Strategy (void);
00039 
00040   /// creates and activates the streamendpoint, vdev, and mediacontrol
00041   virtual int activate (void);
00042 
00043   /// activates the stream_endpoint with the POA
00044   virtual int activate_stream_endpoint (ACE_ENV_SINGLE_ARG_DECL) = 0;
00045 
00046   /// activates the vdev with the POA
00047   virtual int activate_vdev (ACE_ENV_SINGLE_ARG_DECL);
00048 
00049   /// activates the media controller with the POA
00050   virtual int activate_mediactrl (ACE_ENV_SINGLE_ARG_DECL);
00051 
00052   /// Bridge method to create a vdev, a la Acceptor. Applications
00053   /// can override this
00054   virtual int make_vdev (T_VDev *&vdev);
00055 
00056   /// Bridge method to create a stream_endpoint, a la Acceptor. Applications
00057   /// can override this
00058   virtual int make_stream_endpoint (T_StreamEndpoint *&stream_endpoint);
00059 
00060   /// Bridge method to create a media_ctrl, a la Acceptor. Applications
00061   /// can override this
00062   virtual int make_mediactrl (T_MediaCtrl *&media_ctrl);
00063 
00064 
00065   char* activate_with_poa (PortableServer::Servant servant ACE_ENV_ARG_DECL);
00066 
00067   CORBA::ORB_var orb_;
00068 
00069   PortableServer::POA_var poa_;
00070 
00071   CORBA::Object_var media_ctrl_obj_;
00072 
00073   T_StreamEndpoint *stream_endpoint_a_servant_;
00074 
00075   T_StreamEndpoint *stream_endpoint_b_servant_;
00076 
00077   T_VDev *vdev_servant_;
00078 
00079   T_MediaCtrl *media_ctrl_servant_;
00080 };
00081 // ----------------------------------------------------------------------
00082 
00083 /**
00084  * @class TAO_AV_Endpoint_Reactive_Strategy_A
00085  * @brief Reactive strategy
00086  */
00087 template <class T_StreamEndpoint, class T_VDev , class T_MediaCtrl>
00088 class TAO_AV_Endpoint_Reactive_Strategy_A
00089   : public TAO_AV_Endpoint_Reactive_Strategy<T_StreamEndpoint, T_VDev , T_MediaCtrl>
00090 {
00091 
00092 public:
00093 
00094   TAO_AV_Endpoint_Reactive_Strategy_A (void);
00095 
00096   /// Constructor
00097   int init (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
00098 
00099   /// Destructor.
00100   virtual ~TAO_AV_Endpoint_Reactive_Strategy_A (void);
00101 
00102   /// Overrides the base class stream_endpoint activator, to activate
00103   /// an "A" type endpoint
00104   virtual int activate_stream_endpoint (ACE_ENV_SINGLE_ARG_DECL);
00105 
00106   /// Called by the MMDevice, when it needs to create an A type endpoint
00107   virtual int create_A (AVStreams::StreamEndPoint_A_ptr &stream_endpoint,
00108                         AVStreams::VDev_ptr &vdev
00109                         ACE_ENV_ARG_DECL);
00110 
00111 };
00112 
00113 // ----------------------------------------------------------------------
00114 /**
00115  * @class TAO_AV_Endpoint_Reactive_Strategy_B
00116  * @brief Reactive strategy
00117  */
00118 template <class T_StreamEndpoint, class T_Vdev , class T_MediaCtrl>
00119 class TAO_AV_Endpoint_Reactive_Strategy_B
00120   : public TAO_AV_Endpoint_Reactive_Strategy <T_StreamEndpoint, T_Vdev, T_MediaCtrl>
00121 {
00122 
00123 public:
00124 
00125   /// Constructor
00126   TAO_AV_Endpoint_Reactive_Strategy_B (void);
00127 
00128   /// Destructor.
00129   virtual ~TAO_AV_Endpoint_Reactive_Strategy_B (void);
00130 
00131   int init (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
00132 
00133   /// Overrides the base class stream_endpoint activator, to activate
00134   /// a "B" type endpoint
00135   virtual int activate_stream_endpoint (ACE_ENV_SINGLE_ARG_DECL);
00136 
00137   /// Called by the MMDevice, when it needs to create a B type endpoint
00138   virtual int create_B (AVStreams::StreamEndPoint_B_ptr &stream_endpoint,
00139                         AVStreams::VDev_ptr &vdev
00140                         ACE_ENV_ARG_DECL);
00141 };
00142 
00143 // ----------------------------------------------------------------------
00144 
00145 /**
00146  * @class TAO_AV_Child_Process
00147  *
00148  * @brief Helper class for the child process created in
00149  *        TAO_AV_Endpoint_Process_Strategy
00150  */
00151 template <class T_StreamEndpoint, class T_VDev , class T_MediaCtrl>
00152 class TAO_AV_Child_Process
00153 {
00154 
00155 public:
00156   /// Constructor
00157   TAO_AV_Child_Process ();
00158 
00159   /// Destructor
00160   virtual ~TAO_AV_Child_Process ();
00161 
00162   /// Initializes the ORB, creates and activates the
00163   /// T_StreamEndpoint, T_VDev, T_MediaCtrl in the POA
00164   int init (int argc, char **argv, CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
00165 
00166   /// runs the ORB event loop
00167   int run (ACE_Time_Value *tv = 0);
00168 
00169 protected:
00170   /**
00171    * Creates the objects and inserts them into the Naming
00172    * Service, so the parent can pick the IOR's and
00173    * return them to the client
00174    */
00175   int activate_objects (int argc,
00176                         char **argv
00177                         ACE_ENV_ARG_DECL);
00178 
00179   ///activate the servant with the poa
00180   char* activate_with_poa (PortableServer::Servant servant ACE_ENV_ARG_DECL);
00181 
00182   /// Removes the vdev and streamendpoint names from the naming service.
00183   int unbind_names (void);
00184 
00185   /// Binds to the naming service
00186   int bind_to_naming_service (ACE_ENV_SINGLE_ARG_DECL);
00187 
00188   /// Registers vdev with the naming service
00189   int register_vdev (ACE_ENV_SINGLE_ARG_DECL);
00190 
00191   /// Registers stream_endpoint with the naming service
00192   int register_stream_endpoint (ACE_ENV_SINGLE_ARG_DECL);
00193 
00194   /// Releases the semaphore on which the parent is waiting on
00195   int release_semaphore ();
00196 
00197   /// Bridge method to create a vdev, a la Acceptor. Applications
00198   /// can override this
00199   virtual int make_vdev (T_VDev *&vdev);
00200 
00201   /// Bridge method to create a stream_endpoint, a la Acceptor. Applications
00202   /// can override this
00203   virtual int make_stream_endpoint (T_StreamEndpoint *&stream_endpoint);
00204 
00205   /// Bridge method to create a media_ctrl, a la Acceptor. Applications
00206   /// can override this
00207   virtual int make_mediactrl (T_MediaCtrl *&media_ctrl);
00208 
00209   /// The root Naming Context of the TAO naming service
00210   CosNaming::NamingContext_var naming_context_;
00211 
00212   /// Name of the vdev
00213   CosNaming::Name vdev_name_;
00214 
00215   /// Name of the stream_endpoint
00216   CosNaming::Name stream_endpoint_name_;
00217 
00218   /// The stream endpoint member
00219   T_StreamEndpoint *stream_endpoint_;
00220 
00221   /// The virtual device
00222   T_VDev *vdev_;
00223 
00224   /// Virtual device CORBA object reference
00225   CORBA::Object_var vdev_obj_;
00226 
00227   /// Media controller
00228   T_MediaCtrl *media_ctrl_;
00229 
00230   // Media controller CORBA object reference
00231   CORBA::Object_var media_ctrl_obj_;
00232 
00233   /// pid of this process
00234   pid_t pid_;
00235 
00236   /// Name of the host.
00237   char host_[MAXHOSTNAMELEN];
00238 
00239   CORBA::ORB_ptr orb_;
00240 
00241   PortableServer::POA_ptr poa_;
00242 
00243 };
00244 
00245 // ----------------------------------------------------------------------
00246 /**
00247  * @class TAO_AV_Child_Process_A
00248  * @brief Helper class for the child process created in TAO_AV_Child_Process
00249  */
00250 template <class T_StreamEndpoint, class T_VDev , class T_MediaCtrl>
00251 class TAO_AV_Child_Process_A
00252   : public TAO_AV_Child_Process <T_StreamEndpoint, T_VDev, T_MediaCtrl>
00253 {
00254 
00255 public:
00256   /// Constructor.
00257   TAO_AV_Child_Process_A (void);
00258 
00259   /// Destructor.
00260   virtual ~TAO_AV_Child_Process_A (void);
00261 };
00262 
00263 // ----------------------------------------------------------------------
00264 
00265 /**
00266  * @class TAO_AV_Child_Process_B
00267  * @brief Helper class for the child process created in TAO_AV_Child_Process
00268  */
00269 template <class T_StreamEndpoint, class T_VDev , class T_MediaCtrl>
00270 class TAO_AV_Child_Process_B
00271   : public TAO_AV_Child_Process <T_StreamEndpoint, T_VDev, T_MediaCtrl>
00272 {
00273 
00274 public:
00275   /// Constructor.
00276   TAO_AV_Child_Process_B (void);
00277 
00278   /// Destructor.
00279   virtual ~TAO_AV_Child_Process_B (void);
00280 };
00281 
00282 TAO_END_VERSIONED_NAMESPACE_DECL
00283 
00284 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00285 #include "orbsvcs/AV/Endpoint_Strategy_T.cpp"
00286 #endif /*ACE_TEMPLATES_REQUIRE_SOURCE */
00287 
00288 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00289 #pragma implementation ("Endpoint_Strategy_T.cpp")
00290 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
00291 
00292 #include /**/ "ace/post.h"
00293 #endif /* TAO_AV_ENDPOINT_STRATEGY_T_H */

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