Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / tests / AVStreams / Multiple_Flows / receiver.h
blob0f5cdd0207e7d401c2ae5562247ffd5af66e051a
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 void flowname (const char*);
46 private:
47 /// Keeping a count of the incoming frames.
48 int frame_count_;
50 /// Message block into which data is read from a file and then sent.
51 ACE_Message_Block mb_;
53 ACE_CString flowname_;
55 /// File handle of the file into which received data is written.
56 FILE *output_file_;
59 /**
60 * @class Receiver_StreamEndPoint
62 * @brief Application defined stream endpoint object.
64 * AVStreams calls this class during connection setup.
66 class Receiver_StreamEndPoint : public TAO_Server_StreamEndPoint
68 public:
69 // Create a receiver application callback.
70 int get_callback (const char *flowname,
71 TAO_AV_Callback *&callback);
73 /// Set protocol object corresponding to the transport protocol
74 /// chosen.
75 int set_protocol_object (const char *flowname,
76 TAO_AV_Protocol_Object *object);
79 /**
80 * @class Receiver
82 * @brief Receiver application class.
84 * This class receives data from a AV sender and writes it to
85 * a file.
87 class Receiver
89 public:
90 /// Constructor
91 Receiver ();
93 /// Destructor.
94 ~Receiver ();
96 /// Initialize data components.
97 int init (int argc,
98 ACE_TCHAR *argv[]);
100 /// Set the protocol object corresponding to the transport protocol chosen.
101 void protocol_object (TAO_AV_Protocol_Object *protocol_object);
103 /// Set the protocol object corresponding to the transport protocol chosen.
104 TAO_AV_Protocol_Object * protocol_object ();
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 /// Number of frames sent.
124 int frame_count_;
126 /// File from which data is read.
127 ACE_CString filename_;
129 /// Method to parse the command line arguments.
130 int parse_args (int argc, ACE_TCHAR *argv[]);
132 /// Message block into which data is read from a file and then sent.
133 ACE_Message_Block mb_;