Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / examples / APG / Streams / RecordingDevice_Text.h
blobdcd6e1dc664cba043a2c062621b0ca0e69fd7ee1
1 /* -*- C++ -*- */
2 /*
3 * A RecordingDevice that listens to a socket and collects text.
4 */
6 #ifndef RECORDING_DEVICE_TEXT_H
7 #define RECORDING_DEVICE_TEXT_H
9 #include "ace/FILE_IO.h"
10 #include "ace/FILE_Connector.h"
11 #include "ace/SOCK_Stream.h"
12 #include "ace/SOCK_Acceptor.h"
14 #include "CommandStream.h"
15 #include "MessageInfo.h"
16 #include "RecordingDevice.h"
18 class TextListenerAcceptor :
19 public ACE_Event_Handler,
20 public RecordingDevice
22 public:
23 TextListenerAcceptor ();
25 // ACE_Event_Handler interface
27 int open (ACE_INET_Addr &addr);
29 ACE_HANDLE get_handle () const;
31 int handle_input (ACE_HANDLE);
33 int accept (ACE_SOCK_Stream &peer);
35 // RecordingDevice interface
37 // Open a listening socket on the port specified by argv.
38 int init (int argc, ACE_TCHAR *argv[]);
40 ACE_Event_Handler *get_handler () const;
42 virtual RecordingDevice *wait_for_activity ();
44 virtual int answer_call ();
46 virtual CallerId *retrieve_callerId ();
48 virtual int play_message (ACE_FILE_Addr &addr);
50 virtual MessageType *record_message (ACE_FILE_Addr &addr);
52 private:
53 ACE_SOCK_Acceptor acceptor_;
56 // Listing 01 code/ch18
57 class TextListener : public RecordingDevice
59 public:
60 TextListener (TextListenerAcceptor *acceptor);
62 virtual const ACE_TCHAR *get_name () const;
64 int answer_call ();
66 CallerId *retrieve_callerId ();
68 int play_message (ACE_FILE_Addr &addr);
70 MessageType *record_message (ACE_FILE_Addr &addr);
72 virtual void release ();
73 // Listing 01
74 // Listing 02 code/ch18
75 private:
76 CommandStream *command_stream_;
77 TextListenerAcceptor *acceptor_;
78 ACE_SOCK_Stream peer_;
80 // Listing 02
82 #endif /* RECORDING_DEVICE_TEXT_H */