Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / examples / APG / Proactor / HA_Proactive_Status.h
blob9626b710b8a5a73763c7ede9182838aa050a6657
1 /* -*- C++ -*- */
2 /*
3 ** Example program from The ACE Programmer's Guide, Chapter 8.
4 ** Copyright 2003 Addison-Wesley. All Rights Reserved.
5 */
7 #ifndef __HA_PROACTIVE_STATUS_H
8 #define __HA_PROACTIVE_STATUS_H
10 #include "ace/OS_NS_sys_socket.h"
11 #include "ace/Asynch_IO.h"
12 #include "ace/Service_Object.h"
13 // Listing 1 code/ch08
14 #include "ace/Asynch_IO.h"
16 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
18 class HA_Proactive_Service : public ACE_Service_Handler
20 public:
21 ~HA_Proactive_Service ()
23 if (this->handle () != ACE_INVALID_HANDLE)
24 ACE_OS::closesocket (this->handle ());
27 virtual void open (ACE_HANDLE h, ACE_Message_Block&);
29 // This method will be called when an asynchronous read
30 // completes on a stream.
31 virtual void handle_read_stream
32 (const ACE_Asynch_Read_Stream::Result &result);
34 // This method will be called when an asynchronous write
35 // completes on a stream.
36 virtual void handle_write_stream
37 (const ACE_Asynch_Write_Stream::Result &result);
39 private:
40 ACE_Asynch_Read_Stream reader_;
41 ACE_Asynch_Write_Stream writer_;
43 // Listing 1
45 // Listing 2 code/ch08
46 #include "ace/Asynch_Acceptor.h"
47 #include "ace/INET_Addr.h"
49 class HA_Proactive_Acceptor :
50 public ACE_Asynch_Acceptor<HA_Proactive_Service>
52 public:
53 virtual int validate_connection
54 (const ACE_Asynch_Accept::Result& result,
55 const ACE_INET_Addr &remote,
56 const ACE_INET_Addr &local);
58 // Listing 2
60 #endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */
62 #if 0
63 // Listing 3 code/ch08
64 template <class HANDLER>
65 class ACE_Asynch_Acceptor : public ACE_Handler
66 ...
67 protected:
68 virtual HANDLER *make_handler ()
70 return new HANDLER;
72 // Listing 3
73 #endif
75 class HA_Proactive_Status : public ACE_Service_Object
77 public:
78 // Initializes object when dynamic linking occurs.
79 virtual int init (int argc, ACE_TCHAR *argv[]);
81 // Terminates object when dynamic unlinking occurs.
82 virtual int fini ();
85 #endif /* __HA_PROACTIVE_STATUS_H */