Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Dump_T.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Dump_T.h
00006  *
00007  *  $Id: Dump_T.h,v 1.1.1.3 2001/12/04 14:33:00 chad 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 /**
00025  * @class ACE_Dumpable_Adapter
00026  *
00027  * @brief This class inherits the interface of the abstract ACE_Dumpable
00028  * class and is instantiated with the implementation of the
00029  * concrete component class <class Concrete>.
00030  *
00031  * This design is similar to the Adapter and Decorator patterns
00032  * from the ``Gang of Four'' book.  Note that <class Concrete>
00033  * need not inherit from a common class since ACE_Dumpable
00034  * provides the uniform virtual interface!
00035  */
00036 template <class Concrete>
00037 class ACE_Dumpable_Adapter : public ACE_Dumpable
00038 {
00039 public:
00040   // = Initialization and termination methods.
00041   ACE_Dumpable_Adapter (const Concrete *t);
00042   ~ACE_Dumpable_Adapter (void);
00043 
00044   /// Concrete dump method (simply delegates to the <dump> method of
00045   /// <class Concrete>).
00046   virtual void dump (void) const;
00047 
00048   /// Delegate to methods in the Concrete class.
00049   Concrete *operator->() const;
00050 
00051 private:
00052   /// Pointer to <this> of <class Concrete>.
00053   const Concrete *this_;
00054 };
00055 
00056 // Some useful macros for conditionally compiling this feature...
00057 #if defined (ACE_NDEBUG)
00058 #define ACE_REGISTER_OBJECT(CLASS)
00059 #define ACE_REMOVE_OBJECT
00060 #else
00061 #define ACE_REGISTER_OBJECT(CLASS) \
00062         ACE_ODB::instance ()->register_object \
00063           (new ACE_Dumpable_Adapter<CLASS> (this));
00064 #define ACE_REMOVE_OBJECT \
00065         ACE_ODB::instance ()->remove_object    \
00066           ((void *) this);
00067 #endif /* ACE_NDEBUG */
00068 
00069 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00070 #include "ace/Dump_T.cpp"
00071 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
00072 
00073 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00074 #pragma implementation ("Dump_T.cpp")
00075 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
00076 
00077 #include "ace/post.h"
00078 #endif /* ACE_DUMP_T_H */

Generated on Mon Jun 16 11:19:37 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002