ACE+TAO-7_0_8
[ACE_TAO.git] / ACE / tests / Bound_Ptr_Test.h
blobcad392822367ea2b3f5fd1e2346fd7b3fd19c65d
2 //=============================================================================
3 /**
4 * @file Bound_Ptr_Test.h
6 * Define class needed for generating templates. IBM C++ requires this to
7 * be in its own file for auto template instantiation.
9 * @author @author Christopher Kohlhoff <chris@kohlhoff.com>
11 //=============================================================================
14 #ifndef ACE_TESTS_BOUND_PTR_TEST_H
15 #define ACE_TESTS_BOUND_PTR_TEST_H
17 #include "ace/Activation_Queue.h"
18 #include "ace/Bound_Ptr.h"
19 #include "ace/Task.h"
20 #include "ace/Thread_Mutex.h"
22 struct Printer
24 Printer (const char *message);
25 ~Printer () ;
27 void print ();
29 const char *message_;
30 static size_t instance_count_;
33 #if defined (ACE_HAS_THREADS)
35 typedef ACE_Strong_Bound_Ptr<Printer, ACE_Thread_Mutex> Printer_var;
37 /**
38 * @class Scheduler
40 * @brief The scheduler for the Active Object.
42 * This class also plays the role of the Proxy and the Servant
43 * in the Active Object pattern. Naturally, these roles could
44 * be split apart from the Scheduler.
46 class Scheduler : public ACE_Task<ACE_SYNCH>
48 friend class Method_Request_print;
49 friend class Method_Request_end;
50 public:
51 /// Constructor.
52 Scheduler (void);
54 /// Initializer.
55 virtual int open (void *args = 0);
57 /// Terminator.
58 virtual int close (u_long flags = 0);
60 /// Destructor.
61 virtual ~Scheduler (void);
63 // = These methods are part of the Active Object Proxy interface.
64 void print (Printer_var &printer);
65 void end (void);
67 protected:
68 /// Runs the Scheduler's event loop, which dequeues <Method_Requests>
69 /// and dispatches them.
70 virtual int svc ();
72 private:
73 // = These are the <Scheduler> implementation details.
74 ACE_Activation_Queue activation_queue_;
77 #endif /* ACE_HAS_THREADS */
78 #endif /* ACE_TESTS_BOUND_PTR_TEST_H */