Dump_T.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Dump_T.h
00006  *
00007  *  Dump_T.h,v 4.14 2005/10/28 16:14:52 ossama Exp
00008  *
00009  *  @author Doug Schmidt
00010  */
00011 //=============================================================================
00012 
00013 
00014 #ifndef ACE_DUMP_T_H
00015 #define ACE_DUMP_T_H
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "ace/Dump.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00025 
00026 /**
00027  * @class ACE_Dumpable_Adapter
00028  *
00029  * @brief This class inherits the interface of the abstract ACE_Dumpable
00030  * class and is instantiated with the implementation of the
00031  * concrete component class <class Concrete>.
00032  *
00033  * This design is similar to the Adapter and Decorator patterns
00034  * from the ``Gang of Four'' book.  Note that <class Concrete>
00035  * need not inherit from a common class since ACE_Dumpable
00036  * provides the uniform virtual interface!
00037  */
00038 template <class Concrete>
00039 class ACE_Dumpable_Adapter : public ACE_Dumpable
00040 {
00041 public:
00042   // = Initialization and termination methods.
00043   ACE_Dumpable_Adapter (const Concrete *t);
00044   ~ACE_Dumpable_Adapter (void);
00045 
00046   /// Concrete dump method (simply delegates to the <dump> method of
00047   /// <class Concrete>).
00048   virtual void dump (void) const;
00049 
00050   /// Delegate to methods in the Concrete class.
00051   Concrete *operator->() const;
00052 
00053 private:
00054   /// Pointer to <this> of <class Concrete>.
00055   const Concrete *this_;
00056 };
00057 
00058 ACE_END_VERSIONED_NAMESPACE_DECL
00059 
00060 // Some useful macros for conditionally compiling this feature...
00061 #if defined (ACE_NDEBUG)
00062 #define ACE_REGISTER_OBJECT(CLASS)
00063 #define ACE_REMOVE_OBJECT
00064 #else
00065 #define ACE_REGISTER_OBJECT(CLASS) \
00066         ACE_ODB::instance ()->register_object \
00067           (new ACE_Dumpable_Adapter<CLASS> (this));
00068 #define ACE_REMOVE_OBJECT \
00069         ACE_ODB::instance ()->remove_object    \
00070           ((void *) this);
00071 #endif /* ACE_NDEBUG */
00072 
00073 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00074 #include "ace/Dump_T.cpp"
00075 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
00076 
00077 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00078 #pragma implementation ("Dump_T.cpp")
00079 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
00080 
00081 #include /**/ "ace/post.h"
00082 #endif /* ACE_DUMP_T_H */

Generated on Thu Nov 9 09:41:50 2006 for ACE by doxygen 1.3.6