Endpoint_Strategy_T.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   Endpoint_Strategy_T.h
00006  *
00007  *  $Id: Endpoint_Strategy_T.h 76589 2007-01-25 18:04:11Z elliott_c $
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 (void) = 0;
00045 
00046   /// activates the vdev with the POA
00047   virtual int activate_vdev (void);
00048 
00049   /// activates the media controller with the POA
00050   virtual int activate_mediactrl (void);
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);
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 (void);
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 
00110 };
00111 
00112 // ----------------------------------------------------------------------
00113 /**
00114  * @class TAO_AV_Endpoint_Reactive_Strategy_B
00115  * @brief Reactive strategy
00116  */
00117 template <class T_StreamEndpoint, class T_Vdev , class T_MediaCtrl>
00118 class TAO_AV_Endpoint_Reactive_Strategy_B
00119   : public TAO_AV_Endpoint_Reactive_Strategy <T_StreamEndpoint, T_Vdev, T_MediaCtrl>
00120 {
00121 
00122 public:
00123 
00124   /// Constructor
00125   TAO_AV_Endpoint_Reactive_Strategy_B (void);
00126 
00127   /// Destructor.
00128   virtual ~TAO_AV_Endpoint_Reactive_Strategy_B (void);
00129 
00130   int init (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
00131 
00132   /// Overrides the base class stream_endpoint activator, to activate
00133   /// a "B" type endpoint
00134   virtual int activate_stream_endpoint (void);
00135 
00136   /// Called by the MMDevice, when it needs to create a B type endpoint
00137   virtual int create_B (AVStreams::StreamEndPoint_B_ptr &stream_endpoint,
00138                         AVStreams::VDev_ptr &vdev);
00139 };
00140 
00141 // ----------------------------------------------------------------------
00142 
00143 /**
00144  * @class TAO_AV_Child_Process
00145  *
00146  * @brief Helper class for the child process created in
00147  *        TAO_AV_Endpoint_Process_Strategy
00148  */
00149 template <class T_StreamEndpoint, class T_VDev , class T_MediaCtrl>
00150 class TAO_AV_Child_Process
00151 {
00152 
00153 public:
00154   /// Constructor
00155   TAO_AV_Child_Process ();
00156 
00157   /// Destructor
00158   virtual ~TAO_AV_Child_Process ();
00159 
00160   /// Initializes the ORB, creates and activates the
00161   /// T_StreamEndpoint, T_VDev, T_MediaCtrl in the POA
00162   int init (int argc, char **argv, CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
00163 
00164   /// runs the ORB event loop
00165   int run (ACE_Time_Value *tv = 0);
00166 
00167 protected:
00168   /**
00169    * Creates the objects and inserts them into the Naming
00170    * Service, so the parent can pick the IOR's and
00171    * return them to the client
00172    */
00173   int activate_objects (int argc,
00174                         char **argv);
00175 
00176   ///activate the servant with the poa
00177   char* activate_with_poa (PortableServer::Servant servant);
00178 
00179   /// Removes the vdev and streamendpoint names from the naming service.
00180   int unbind_names (void);
00181 
00182   /// Binds to the naming service
00183   int bind_to_naming_service (void);
00184 
00185   /// Registers vdev with the naming service
00186   int register_vdev (void);
00187 
00188   /// Registers stream_endpoint with the naming service
00189   int register_stream_endpoint (void);
00190 
00191   /// Releases the semaphore on which the parent is waiting on
00192   int release_semaphore ();
00193 
00194   /// Bridge method to create a vdev, a la Acceptor. Applications
00195   /// can override this
00196   virtual int make_vdev (T_VDev *&vdev);
00197 
00198   /// Bridge method to create a stream_endpoint, a la Acceptor. Applications
00199   /// can override this
00200   virtual int make_stream_endpoint (T_StreamEndpoint *&stream_endpoint);
00201 
00202   /// Bridge method to create a media_ctrl, a la Acceptor. Applications
00203   /// can override this
00204   virtual int make_mediactrl (T_MediaCtrl *&media_ctrl);
00205 
00206   /// The root Naming Context of the TAO naming service
00207   CosNaming::NamingContext_var naming_context_;
00208 
00209   /// Name of the vdev
00210   CosNaming::Name vdev_name_;
00211 
00212   /// Name of the stream_endpoint
00213   CosNaming::Name stream_endpoint_name_;
00214 
00215   /// The stream endpoint member
00216   T_StreamEndpoint *stream_endpoint_;
00217 
00218   /// The virtual device
00219   T_VDev *vdev_;
00220 
00221   /// Virtual device CORBA object reference
00222   CORBA::Object_var vdev_obj_;
00223 
00224   /// Media controller
00225   T_MediaCtrl *media_ctrl_;
00226 
00227   // Media controller CORBA object reference
00228   CORBA::Object_var media_ctrl_obj_;
00229 
00230   /// pid of this process
00231   pid_t pid_;
00232 
00233   /// Name of the host.
00234   char host_[MAXHOSTNAMELEN];
00235 
00236   CORBA::ORB_ptr orb_;
00237 
00238   PortableServer::POA_ptr poa_;
00239 
00240 };
00241 
00242 // ----------------------------------------------------------------------
00243 /**
00244  * @class TAO_AV_Child_Process_A
00245  * @brief Helper class for the child process created in TAO_AV_Child_Process
00246  */
00247 template <class T_StreamEndpoint, class T_VDev , class T_MediaCtrl>
00248 class TAO_AV_Child_Process_A
00249   : public TAO_AV_Child_Process <T_StreamEndpoint, T_VDev, T_MediaCtrl>
00250 {
00251 
00252 public:
00253   /// Constructor.
00254   TAO_AV_Child_Process_A (void);
00255 
00256   /// Destructor.
00257   virtual ~TAO_AV_Child_Process_A (void);
00258 };
00259 
00260 // ----------------------------------------------------------------------
00261 
00262 /**
00263  * @class TAO_AV_Child_Process_B
00264  * @brief Helper class for the child process created in TAO_AV_Child_Process
00265  */
00266 template <class T_StreamEndpoint, class T_VDev , class T_MediaCtrl>
00267 class TAO_AV_Child_Process_B
00268   : public TAO_AV_Child_Process <T_StreamEndpoint, T_VDev, T_MediaCtrl>
00269 {
00270 
00271 public:
00272   /// Constructor.
00273   TAO_AV_Child_Process_B (void);
00274 
00275   /// Destructor.
00276   virtual ~TAO_AV_Child_Process_B (void);
00277 };
00278 
00279 TAO_END_VERSIONED_NAMESPACE_DECL
00280 
00281 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00282 #include "orbsvcs/AV/Endpoint_Strategy_T.cpp"
00283 #endif /*ACE_TEMPLATES_REQUIRE_SOURCE */
00284 
00285 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00286 #pragma implementation ("Endpoint_Strategy_T.cpp")
00287 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
00288 
00289 #include /**/ "ace/post.h"
00290 #endif /* TAO_AV_ENDPOINT_STRATEGY_T_H */

Generated on Tue Feb 2 17:47:49 2010 for TAO_AV by  doxygen 1.4.7