Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / tests / AVStreams / Multiple_Flows / sender.h
blob1d1c5311c025fc07e10be38eb2cf05970cd2dac7
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file sender.h
7 * This application reads data from a file and sends it to s
8 * receiver.
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/Protocol_Factory.h"
20 typedef ACE_Unbounded_Set<TAO_AV_Protocol_Object*> ProtocolObject_Set;
21 typedef ACE_Unbounded_Set_Iterator<TAO_AV_Protocol_Object*> ProtocolObject_SetItor;
23 /**
24 * @class Sender_StreamEndPoint
26 * @brief Defines a sender stream endpoint.
28 class Sender_StreamEndPoint : public TAO_Client_StreamEndPoint
30 public:
31 /// Create the application callback and return its handle to
32 /// AVStreams for further application callbacks.
33 int get_callback (const char *flowname,
34 TAO_AV_Callback *&callback);
36 /// Set protocol object corresponding to the transport protocol
37 /// chosen.
38 int set_protocol_object (const char *flowname,
39 TAO_AV_Protocol_Object *object);
41 protected:
42 /// Application callback.
43 TAO_AV_Callback callback_;
46 typedef TAO_AV_Endpoint_Reactive_Strategy_A
47 <Sender_StreamEndPoint,
48 TAO_VDev,
49 AV_Null_MediaCtrl>
50 SENDER_ENDPOINT_STRATEGY;
52 /**
53 * @class Sender
55 * @brief Sender Application.
57 * Class is responsible for streaming (and pacing) data to a
58 * receiver.
60 class Sender
62 public:
63 /// Constructor
64 Sender ();
66 /// Method to initialize the various data components.
67 int init (int argc,
68 ACE_TCHAR *argv[]);
70 /// Method to pace and send data from a file.
71 int pace_data ();
73 /// Set the protocol object corresponding to the transport protocol chosen.
74 void protocol_object (TAO_AV_Protocol_Object *protocol_object);
76 void shutdown ();
78 private:
79 /// Method to parse the command line arguments.
80 int parse_args (int argc, ACE_TCHAR *argv[]);
82 /// Method that binds the sender to the receiver.
83 int bind_to_receiver ();
85 /// The endpoint strategy used by the sender.
86 SENDER_ENDPOINT_STRATEGY endpoint_strategy_;
88 /// The receiver MMDevice that the sender connects to.
89 AVStreams::MMDevice_var receiver_mmdevice_;
91 /// The sender MMDevice.
92 TAO_MMDevice *sender_mmdevice_;
94 /// Stream controller
95 TAO_StreamCtrl *streamctrl_;
97 /// Number of frames sent.
98 int frame_count_;
100 /// File from which data is read.
101 ACE_CString filename_;
103 /// The Naming Service client.
104 TAO_Naming_Client naming_client_;
106 /// File handle of the file read from.
107 FILE *input_file_;
109 /// Selected protocol - default is UDP
110 ACE_CString protocol_;
112 /// Rate at which the data will be sent.
113 int frame_rate_;
115 /// Message block into which data is read from a file and then sent.
116 ACE_Message_Block mb_;
118 /// Protocol object corresponding to the transport protocol selected.
119 ProtocolObject_Set protocol_object_;