Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / examples / C++NPv1 / Logging_Server.h
blob361251c03a225912f65aff98c53ca3dc6f9dc0f6
1 /*
2 ** Copyright 2001 Addison Wesley. All Rights Reserved.
3 */
5 #ifndef _LOGGING_SERVER_H
6 #define _LOGGING_SERVER_H
8 #include "ace/FILE_IO.h"
9 #include "ace/SOCK_Acceptor.h"
11 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
12 class ACE_SOCK_Stream;
13 ACE_END_VERSIONED_NAMESPACE_DECL
15 class Logging_Server
17 public:
18 // Template Method that runs logging server's event loop.
19 virtual int run (int argc, char *argv[]);
21 protected:
22 // The following four methods are ``hooks'' that can be
23 // overridden by subclasses.
24 virtual int open (u_short port = 0);
25 virtual int wait_for_multiple_events () { return 0; }
26 virtual int handle_connections () = 0;
27 virtual int handle_data (ACE_SOCK_Stream * = 0) = 0;
29 // The following helper method can be used by the hook methods.
30 int make_log_file (ACE_FILE_IO &, ACE_SOCK_Stream * = 0);
32 // Close the socket endpoint.
33 virtual ~Logging_Server () { acceptor_.close (); }
35 // Accessor.
36 ACE_SOCK_Acceptor &acceptor () { return acceptor_; }
38 private:
39 ACE_SOCK_Acceptor acceptor_; // Socket acceptor endpoint.
42 #endif /* _LOGGING_SERVER_H */