diff options
author | cdgill <cdgill@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-07 14:28:32 +0000 |
---|---|---|
committer | cdgill <cdgill@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-07 14:28:32 +0000 |
commit | 046cdb59ca429e55ac2a09500b0a471be35a96c9 (patch) | |
tree | 52bd8018782fe78f31837d97009d6462775c2866 /ace/Functor_T.h | |
parent | a989c05e953ddd084f84341f1f3ffa1279c2f096 (diff) | |
download | ATCD-046cdb59ca429e55ac2a09500b0a471be35a96c9.tar.gz |
Added ACE_Command_Base and ACE_Command_Callback, added deferred callbacks to ACE_Thread_Timer_Queue_Adapter
Diffstat (limited to 'ace/Functor_T.h')
-rw-r--r-- | ace/Functor_T.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/ace/Functor_T.h b/ace/Functor_T.h new file mode 100644 index 00000000000..9b879e5ab75 --- /dev/null +++ b/ace/Functor_T.h @@ -0,0 +1,81 @@ +/* -*- C++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// ace +// +// = FILENAME +// Functor_T.h +// +// = DESCRIPTION +// Templatized classes for implementing the GOF Command Pattern, +// also known as functors or function objects. +// +// = AUTHOR +// Chris Gill <cdgill@cs.wustl.edu> +// +// Based on Command Pattern implementations originally done by +// +// Carlos O'Ryan <coryan@cs.wustl.edu> and +// Douglas C. Schmidt <schmidt@cs.wustl.edu> and +// Sergio Flores-Gaitan <sergio@cs.wustl.edu> +// +// ============================================================================ + +#if !defined (ACE_FUNCTOR_T_H) +#define ACE_FUNCTOR_T_H + +#include "ace/Functor.h" + +template <class RECEIVER, class ACTION> +class ACE_Command_Callback : public ACE_Command_Base +{ + // = TITLE + // Defines a class template that allows us to invoke a callback to an + // object without knowing anything about the object except its type. + // + // = DESCRIPTION + // This class declares an interface to execute operations, + // binding a RECEIVER object with an ACTION. The RECEIVER knows + // how to implement the operation. A class can invoke operations + // without knowing anything about it, or how it was implemented. +public: + + ACE_Command_Callback (RECEIVER &recvr, ACTION action); + // Constructor: sets the <receiver_> of the Command to recvr, and the + // <action_> of the Command to <action>. + + virtual ~ACE_Command_Callback (void) {} + // Virtual destructor. + + virtual int execute (void *arg = 0); + // Invokes the method <action_> from the object <receiver_>. + +private: + + RECEIVER &receiver_; + // Object where the method resides. + + ACTION action_; + // Method that is going to be invoked. +}; + + +#if defined (__ACE_INLINE__) +#include "ace/Functor_T.i" +#endif /* __ACE_INLINE__ */ + + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Functor_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Functor_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#endif /* ACE_FUNCTOR_T_H */ + +// EOF |