diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:30 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:30 +0000 |
commit | c44379cc7d9c7aa113989237ab0f56db12aa5219 (patch) | |
tree | 66a84b20d47f2269d8bdc6e0323f338763424d3a /ACE/Kokyu/Kokyu.h | |
parent | 3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c (diff) | |
download | ATCD-c44379cc7d9c7aa113989237ab0f56db12aa5219.tar.gz |
Repo restructuring
Diffstat (limited to 'ACE/Kokyu/Kokyu.h')
-rw-r--r-- | ACE/Kokyu/Kokyu.h | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/ACE/Kokyu/Kokyu.h b/ACE/Kokyu/Kokyu.h new file mode 100644 index 00000000000..9414b9bfbe0 --- /dev/null +++ b/ACE/Kokyu/Kokyu.h @@ -0,0 +1,115 @@ +/* -*- C++ -*- */ +/** + * @file Kokyu.h + * + * $Id$ + * + * @author Venkita Subramonian (venkita@cs.wustl.edu) + * + * Based on previous work by Tim Harrison Chris Gill, + * Carlos O'Ryan and other members of the DOC group. + */ + +#ifndef KOKYU_H +#define KOKYU_H +#include /**/ "ace/pre.h" +#include "ace/Copy_Disabled.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "kokyu_export.h" +#include "Kokyu_defs.h" + +//Currently I am not seeing a way to avoid including these here. The +//whole purpose of the pImpl idiom is to avoid this dependency. But +//using the auto_ptr<> to store the implementation causes a compile +//error (in the destructor) that the implementation definition is not +//found. Note that the auto-ptr<T>::~auto_ptr() calls delete on the +//internal pointer and at this point the class definition needs to be +//visible. Need to revisit this and see whether there is a work +//around. +#include "Dispatcher_Impl.h" + +//################################################################# +//Beware that this interface will be subject to change in the future +//since this is the very initial release. We will be working on +//trying to merge the DSRT and EC mechanisms in the future. If you +//are a user of this interface, kindly let us know so that we can +//coordinate with you when we refactor this interface. +//################################################################## + +namespace Kokyu +{ + //class Dispatcher_Impl; + + /** + * @class Dispatcher + * + * @brief Interface class for dynamic scheduling of events + * + * The responsibility of this class is to forward all methods to + * its delegation/implementation class, e.g., + * @c Default_Dispatcher_Impl. This class follows the pImpl idiom + * or the bridge pattern to separate the implementation from the interface. + * Dispatcher is the class that users will be using to achieve + * dynamic dispatching of events in an event channel. + */ + class Kokyu_Export Dispatcher : private ACE_Copy_Disabled + { + public: + /// Dispatch a command object based on the qos info supplied. + int dispatch (const Dispatch_Command*, const QoSDescriptor&); + + /// Shut down the dispatcher. The dispatcher will stop processing requests. + int shutdown (); + + /// Supply this interface with an appripriate implementation. + void implementation (Dispatcher_Impl*); + + int activate (); + + /// Non virtual destructor. Read as <b><i>this class not available + /// for inheritance<i></b>. + ~Dispatcher (); + private: + /// Auto ptr to the implementation. Implementation will be created on the + /// heap and deleted automatically when the dispatcher object is destructed. + auto_ptr<Dispatcher_Impl> dispatcher_impl_; + }; + + typedef auto_ptr<Dispatcher> Dispatcher_Auto_Ptr; + + /** + * @class Dispatcher_Factory + * + * @brief Factory class to create one of the dispatcher interface + * objects - for events. + * + * Factory class creates a dispatcher for EC and configures the + * interface object with the appropriate implementation. + */ + class Kokyu_Export Dispatcher_Factory : private ACE_Copy_Disabled + { + public: + /** + * Create a dispatcher for dynamic dispatching of commands + * (eg. events). The caller is responsible for freeing the + * returned dynamically allocated memory. + * + * @param config Configuration information for the dispatcher. + * + * @return pointer to the dispatcher. + */ + static Dispatcher* + create_dispatcher (const Dispatcher_Attributes& attr); + }; +} //end of namespace + +#if defined (__ACE_INLINE__) +#include "Kokyu.i" +#endif /* __ACE_INLINE__ */ + +#include /**/ "ace/post.h" +#endif /* KOKYU_H */ |