Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / examples / Service_Configurator / Misc / Timer_Service.h
blobe886818cf96394eb0914771d05c2e53ad201c574
1 // -*- C++ -*-
2 #include "ace/svc_export.h"
4 #if !defined (ACE_LACKS_PRAGMA_ONCE)
5 # pragma once
6 #endif /* ACE_LACKS_PRAGMA_ONCE */
8 #include "ace/Service_Config.h"
9 #include "ace/Reactor.h"
10 #include "ace/Service_Object.h"
13 class ACE_Svc_Export Timer_Service_1 : public ACE_Service_Object
15 // = TITLE
16 // Demonstrates a simple timer service that can be configured
17 // statically.
18 public:
19 Timer_Service_1 ();
20 // Default constructor.
22 virtual int init (int argc, ACE_TCHAR *argv[]);
23 // Initialization hook.
25 virtual int handle_timeout (const ACE_Time_Value &,
26 const void *);
27 // Timeout hook.
29 virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask);
30 // Close hook.
32 protected:
33 ACE_TCHAR name_[BUFSIZ];
34 // Keep track of which service this is!
36 private:
37 enum
39 TIMEOUT = 4, // Wait 4 seconds between timeouts
40 MAX_TIMEOUTS = 10 // Don't timeout for more than 10 times.
43 int max_timeouts_;
44 // Maximum number of timeouts before shutting down the test.
46 int cur_timeouts_;
47 // Current number of timeouts.
50 class ACE_Svc_Export Timer_Service_2 : public Timer_Service_1
52 public:
53 Timer_Service_2 ();
54 // Default constructor.
57 class ACE_Svc_Export Timer_Service_3 : public Timer_Service_1
59 public:
60 Timer_Service_3 ();
61 // Default constructor.
64 // Declare both static and dynamic services.
65 ACE_STATIC_SVC_DECLARE_EXPORT (ACE_Svc, Timer_Service_1)
66 ACE_SVC_FACTORY_DECLARE (Timer_Service_1)
67 ACE_SVC_FACTORY_DECLARE (Timer_Service_2)
68 ACE_SVC_FACTORY_DECLARE (Timer_Service_3)