Compile fixes
[ACE_TAO.git] / ACE / Kokyu / Kokyu.h
blob8d579dd9e8a62a6823e073400227ed649ce42c6e
1 /* -*- C++ -*- */
2 /**
3 * @file Kokyu.h
5 * @author Venkita Subramonian (venkita@cs.wustl.edu)
7 * Based on previous work by Tim Harrison Chris Gill,
8 * Carlos O'Ryan and other members of the DOC group.
9 */
11 #ifndef KOKYU_H
12 #define KOKYU_H
13 #include /**/ "ace/pre.h"
14 #include "ace/Copy_Disabled.h"
16 #if !defined (ACE_LACKS_PRAGMA_ONCE)
17 # pragma once
18 #endif /* ACE_LACKS_PRAGMA_ONCE */
20 #include <utility>
21 #include <memory>
22 #include "kokyu_export.h"
23 #include "Kokyu_defs.h"
25 //Currently I am not seeing a way to avoid including these here. The
26 //whole purpose of the pImpl idiom is to avoid this dependency. But
27 //using the auto_ptr<> to store the implementation causes a compile
28 //error (in the destructor) that the implementation definition is not
29 //found. Note that the auto-ptr<T>::~auto_ptr() calls delete on the
30 //internal pointer and at this point the class definition needs to be
31 //visible. Need to revisit this and see whether there is a work
32 //around.
33 #include "Dispatcher_Impl.h"
35 //#################################################################
36 //Beware that this interface will be subject to change in the future
37 //since this is the very initial release. We will be working on
38 //trying to merge the DSRT and EC mechanisms in the future. If you
39 //are a user of this interface, kindly let us know so that we can
40 //coordinate with you when we refactor this interface.
41 //##################################################################
43 namespace Kokyu
45 //class Dispatcher_Impl;
47 /**
48 * @class Dispatcher
50 * @brief Interface class for dynamic scheduling of events
52 * The responsibility of this class is to forward all methods to
53 * its delegation/implementation class, e.g.,
54 * @c Default_Dispatcher_Impl. This class follows the pImpl idiom
55 * or the bridge pattern to separate the implementation from the interface.
56 * Dispatcher is the class that users will be using to achieve
57 * dynamic dispatching of events in an event channel.
59 class Kokyu_Export Dispatcher : private ACE_Copy_Disabled
61 public:
62 /// Dispatch a command object based on the qos info supplied.
63 int dispatch (const Dispatch_Command*, const QoSDescriptor&);
65 /// Shut down the dispatcher. The dispatcher will stop processing requests.
66 int shutdown ();
68 /// Supply this interface with an appripriate implementation.
69 void implementation (Dispatcher_Impl*);
71 int activate ();
73 /// Non virtual destructor. Read as <b><i>this class not available
74 /// for inheritance<i></b>.
75 ~Dispatcher ();
76 private:
77 /// Auto ptr to the implementation. Implementation will be created on the
78 /// heap and deleted automatically when the dispatcher object is destructed.
79 std::unique_ptr<Dispatcher_Impl> dispatcher_impl_;
82 typedef std::unique_ptr<Dispatcher> Dispatcher_Auto_Ptr;
84 /**
85 * @class Dispatcher_Factory
87 * @brief Factory class to create one of the dispatcher interface
88 * objects - for events.
90 * Factory class creates a dispatcher for EC and configures the
91 * interface object with the appropriate implementation.
93 class Kokyu_Export Dispatcher_Factory : private ACE_Copy_Disabled
95 public:
96 /**
97 * Create a dispatcher for dynamic dispatching of commands
98 * (eg. events). The caller is responsible for freeing the
99 * returned dynamically allocated memory.
101 * @param config Configuration information for the dispatcher.
103 * @return pointer to the dispatcher.
105 static Dispatcher*
106 create_dispatcher (const Dispatcher_Attributes& attr);
108 } //end of namespace
110 #if defined (__ACE_INLINE__)
111 #include "Kokyu.inl"
112 #endif /* __ACE_INLINE__ */
114 #include /**/ "ace/post.h"
115 #endif /* KOKYU_H */