Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / tests / AVStreams / Bidirectional_Flows / receiver.h
blobe84bb472b2f9d3d88e02ceb3d94a13d0e0bc04cf
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file receiver.h
7 * This application receives data from a AV sender and writes it to
8 * a file.
10 * @author Yamuna Krishnamurthy <yamuna@cs.wustl.edu>
12 //=============================================================================
15 #include "orbsvcs/Naming/Naming_Client.h"
16 #include "orbsvcs/AV/AVStreams_i.h"
17 #include "orbsvcs/AV/Endpoint_Strategy.h"
18 #include "orbsvcs/AV/Policy.h"
19 #include "orbsvcs/AV/Protocol_Factory.h"
21 /**
22 * @class Receiver_Callback
24 * @brief Application defined callback object.
26 * AVStreams calls this class when data shows up from a sender.
28 class Receiver_Callback : public TAO_AV_Callback
30 public:
31 /// Constructor.
32 Receiver_Callback ();
34 // Method that is called when there is data to be received from a
35 // sender.
36 int receive_frame (ACE_Message_Block *frame,
37 TAO_AV_frame_info *frame_info,
38 const ACE_Addr &peer_address);
40 // Called when the sender is done sending data and wants to close
41 // down the connection.
42 int handle_destroy ();
44 private:
45 /// Keeping a count of the incoming frames.
46 int frame_count_;
48 /// Message block into which data is read from a file and then sent.
49 ACE_Message_Block mb_;
52 /**
53 * @class Receiver_StreamEndPoint
55 * @brief Application defined stream endpoint object.
57 * AVStreams calls this class during connection setup.
59 class Receiver_StreamEndPoint : public TAO_Server_StreamEndPoint
61 public:
62 // Create a receiver application callback.
63 int get_callback (const char *flowname,
64 TAO_AV_Callback *&callback);
66 /// Set protocol object corresponding to the transport protocol
67 /// chosen.
68 int set_protocol_object (const char *flowname,
69 TAO_AV_Protocol_Object *object);
72 private:
73 /// Receiver application callback.
74 Receiver_Callback callback_;
77 /**
78 * @class Receiver
80 * @brief Receiver application class.
82 * This class receives data from a AV sender and writes it to
83 * a file.
85 class Receiver
87 public:
88 /// Constructor
89 Receiver ();
91 /// Destructor.
92 ~Receiver ();
94 /// Initialize data components.
95 int init (int argc,
96 ACE_TCHAR *argv[]);
98 /// Set the protocol object corresponding to the transport protocol chosen.
99 void protocol_object (TAO_AV_Protocol_Object *protocol_object);
101 /// Set the protocol object corresponding to the transport protocol chosen.
102 TAO_AV_Protocol_Object * protocol_object ();
104 FILE * input_file ();
106 protected:
107 /// The Naming Service Client.
108 TAO_Naming_Client naming_client_;
110 /// The endpoint reactive strategy.
111 TAO_AV_Endpoint_Reactive_Strategy_B
112 <Receiver_StreamEndPoint,TAO_VDev,AV_Null_MediaCtrl> reactive_strategy_;
114 /// Receiver MMDevice.
115 TAO_MMDevice *mmdevice_;
117 /// Rate at which the data will be sent.
118 int frame_rate_;
120 /// Protocol object corresponding to the transport protocol selected.
121 TAO_AV_Protocol_Object *protocol_object_;
123 /// File handle of the file read from.
124 FILE *input_file_;
126 /// Number of frames sent.
127 int frame_count_;
129 /// File from which data is read.
130 ACE_CString filename_;
132 /// Method to parse the command line arguments.
133 int parse_args (int argc, ACE_TCHAR *argv[]);
135 /// Message block into which data is read from a file and then sent.
136 ACE_Message_Block mb_;