Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / AVStreams / Component_Switching / receiver.h
blob812ab6f7916697ee36a8190dbab82ab4b3fb16ac
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 "Connection_Manager.h"
16 #include "orbsvcs/AV/AVStreams_i.h"
17 #include "orbsvcs/AV/Endpoint_Strategy.h"
18 #include "orbsvcs/AV/Policy.h"
20 /**
21 * @class Signal_Handler
22 TITLE
23 * This class Handles the SIGINT signal through the Reactor.
24 * Useful to gracefully release the process
26 class Signal_Handler : public ACE_Event_Handler
28 public:
29 Signal_Handler ();
31 /// Override this method to implement graceful shutdown.
32 int handle_signal(int signum, siginfo_t*,ucontext_t*);
35 /**
36 * @class Receiver_Callback
38 * @brief Application defined callback object.
40 * AVStreams calls this class when data shows up from a sender.
42 class Receiver_Callback : public TAO_AV_Callback
44 public:
45 //// Constructor.
46 Receiver_Callback ();
48 /// Method that is called when there is data to be received from a
49 /// sender.
50 int receive_frame (ACE_Message_Block *frame,
51 TAO_AV_frame_info *frame_info,
52 const ACE_Addr &peer_address);
54 int handle_destroy ();
56 /// Accessor methods for the flowname of the callback.
57 ACE_CString &flowname ();
58 void flowname (const ACE_CString &flowname);
60 private:
61 //// Keeping a count of the incoming frames.
62 int frame_count_;
64 //// Flowname of the flow.
65 ACE_CString flowname_;
68 /**
69 * @class Receiver_StreamEndPoint
71 * @brief Application defined stream endpoint object.
73 * AVStreams calls this class during connection setup.
75 class Receiver_StreamEndPoint : public TAO_Server_StreamEndPoint
77 public:
78 /// Create a receiver application callback.
79 int get_callback (const char *flowname,
80 TAO_AV_Callback *&callback);
82 //// Called when a distributor tries to connect to the receiver
83 virtual CORBA::Boolean handle_connection_requested (AVStreams::flowSpec &the_spec);
85 private:
86 //// Receiver application callback.
87 Receiver_Callback callback_;
90 /**
91 * @class Receiver
93 * @brief Receiver application class.
95 * This class receives data from a AV sender and writes it to
96 * a file.
98 class Receiver
100 public:
101 //// Constructor
102 Receiver ();
104 //// Destructor.
105 virtual ~Receiver ();
107 //// Initialize data components.
108 int init (int argc,
109 ACE_TCHAR **argv);
111 //// Parse args.
112 int parse_args (int argc,
113 ACE_TCHAR **argv);
115 //// Name of the output file.
116 ACE_CString output_file_name ();
118 ACE_CString sender_name ();
119 ACE_CString receiver_name ();
121 void shut_down ();
123 protected:
124 //// Connection manager.
125 Connection_Manager connection_manager_;
127 //// The endpoint reactive strategy.
128 TAO_AV_Endpoint_Reactive_Strategy_B
129 <Receiver_StreamEndPoint,TAO_VDev,AV_Null_MediaCtrl> reactive_strategy_;
131 //// The receiver MMDevice.
132 AVStreams::MMDevice_var mmdevice_obj_;
134 //// Receiver MMDevice.
135 TAO_MMDevice *mmdevice_;
137 //// The sender MMDevice
138 AVStreams::MMDevice_var sender_mmdevice_;
140 //// File name of the file into which received data is written.
141 ACE_CString output_file_name_;
143 //// Sender name.
144 ACE_CString sender_name_;
146 //// Receiver name.
147 ACE_CString receiver_name_;
149 //// Reference to the signal handler.
150 Signal_Handler signal_handler_;