Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / ACE / tests / Bound_Ptr_Test.h
blob80cefeff78cb257104a0252feb1a3406c0f534d1
2 //=============================================================================
3 /**
4 * @file Bound_Ptr_Test.h
6 * Define class needed for generating templates.
8 * @author @author Christopher Kohlhoff <chris@kohlhoff.com>
9 */
10 //=============================================================================
13 #ifndef ACE_TESTS_BOUND_PTR_TEST_H
14 #define ACE_TESTS_BOUND_PTR_TEST_H
16 #include "ace/Activation_Queue.h"
17 #include "ace/Bound_Ptr.h"
18 #include "ace/Task.h"
19 #include "ace/Thread_Mutex.h"
21 struct Printer
23 Printer (const char *message);
24 ~Printer () ;
26 void print ();
28 const char *message_;
29 static size_t instance_count_;
32 #if defined (ACE_HAS_THREADS)
34 typedef ACE_Strong_Bound_Ptr<Printer, ACE_Thread_Mutex> Printer_var;
36 /**
37 * @class Scheduler
39 * @brief The scheduler for the Active Object.
41 * This class also plays the role of the Proxy and the Servant
42 * in the Active Object pattern. Naturally, these roles could
43 * be split apart from the Scheduler.
45 class Scheduler : public ACE_Task<ACE_SYNCH>
47 friend class Method_Request_print;
48 friend class Method_Request_end;
49 public:
50 /// Constructor.
51 Scheduler ();
53 /// Initializer.
54 virtual int open (void *args = 0);
56 /// Terminator.
57 virtual int close (u_long flags = 0);
59 /// Destructor.
60 virtual ~Scheduler ();
62 // = These methods are part of the Active Object Proxy interface.
63 void print (Printer_var &printer);
64 void end ();
66 protected:
67 /// Runs the Scheduler's event loop, which dequeues <Method_Requests>
68 /// and dispatches them.
69 virtual int svc ();
71 private:
72 // = These are the <Scheduler> implementation details.
73 ACE_Activation_Queue activation_queue_;
76 #endif /* ACE_HAS_THREADS */
77 #endif /* ACE_TESTS_BOUND_PTR_TEST_H */