00001 /* -*- C++ -*- */ 00002 //============================================================================= 00003 /** 00004 * @file Framework_Component_T.h 00005 * 00006 * $Id: Framework_Component_T.h,v 1.1.1.1 2003/02/21 18:36:32 chad Exp $ 00007 * 00008 * @author Don Hinton <dhinton@ieee.org> 00009 */ 00010 //============================================================================= 00011 00012 #ifndef ACE_FRAMEWORK_COMPONENT_T_H 00013 #define ACE_FRAMEWORK_COMPONENT_T_H 00014 #include "ace/pre.h" 00015 #include "ace/Framework_Component.h" 00016 00017 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00018 # pragma once 00019 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00020 00021 /** 00022 * @class ACE_Framework_Component_T 00023 * 00024 * @brief This class inherits the interface of the abstract 00025 * ACE_Framework_Component class and is instantiated with the 00026 * implementation of the concrete component class <class Concrete>. 00027 * 00028 * This design is similar to the Adapter and Decorator patterns 00029 * from the ``Gang of Four'' book. Note that <class Concrete> 00030 * need not inherit from a common class since ACE_Framework_Component 00031 * provides the uniform virtual interface! (implementation based on 00032 * ACE_Dumpable_Adapter in <ace/Dump_T.h>. 00033 */ 00034 template <class Concrete> 00035 class ACE_Framework_Component_T : public ACE_Framework_Component 00036 { 00037 public: 00038 // = Initialization and termination methods. 00039 00040 /// Constructor. 00041 ACE_Framework_Component_T (Concrete *concrete); 00042 00043 /// Destructor. 00044 ~ACE_Framework_Component_T (void); 00045 00046 /// Close the contained singleton. 00047 void close_singleton (void); 00048 }; 00049 00050 // This macro should be called in the instance() method 00051 // of the Concrete class that will be managed. Along 00052 // with the appropriate template instantiation. 00053 #define ACE_REGISTER_FRAMEWORK_COMPONENT(CLASS, INSTANCE) \ 00054 ACE_Framework_Repository::instance ()->register_component \ 00055 (new ACE_Framework_Component_T<CLASS> (INSTANCE)); 00056 00057 #if defined (__ACE_INLINE__) 00058 #include "ace/Framework_Component_T.inl" 00059 #endif /* __ACE_INLINE__ */ 00060 00061 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00062 #include "ace/Framework_Component_T.cpp" 00063 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00064 00065 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00066 #pragma implementation ("Framework_Component_T.cpp") 00067 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00068 00069 #include "ace/post.h" 00070 #endif /* ACE_FRAMEWORK_COMPONENT_T_H */
1.2.14 written by Dimitri van Heesch,
© 1997-2002