00001 /* -*- C++ -*- */ 00002 /** 00003 * @file Container_T.h 00004 * 00005 * $Id: Container_T.h 81422 2008-04-24 12:33:29Z johnnyw $ 00006 * 00007 * @author Pradeep Gore <pradeep@oomworks.com> 00008 * 00009 * 00010 */ 00011 00012 #ifndef TAO_Notify_CONTAINER_T_H 00013 #define TAO_Notify_CONTAINER_T_H 00014 00015 #include /**/ "ace/pre.h" 00016 00017 #include "orbsvcs/Notify/notify_serv_export.h" 00018 00019 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00020 # pragma once 00021 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00022 00023 #include "orbsvcs/ESF/ESF_Proxy_Collection.h" 00024 00025 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00026 00027 /** 00028 * @class TAO_Notify_Container_T 00029 * 00030 * @brief A template class that manages a collection. 00031 * TYPE = type of collection 00032 * 00033 */ 00034 template <class TYPE> 00035 class TAO_Notify_Serv_Export TAO_Notify_Container_T 00036 { 00037 typedef TAO_ESF_Proxy_Collection<TYPE> COLLECTION; 00038 public: 00039 00040 /// Constructor 00041 TAO_Notify_Container_T (void); 00042 00043 /// Destructor 00044 virtual ~TAO_Notify_Container_T (); 00045 00046 /// Init this object. 00047 void init (void); 00048 00049 /// Insert object to this container. 00050 virtual void insert (TYPE* type); 00051 00052 /// Remove type from container_ 00053 virtual void remove (TYPE* type); 00054 00055 /// Shutdown 00056 virtual void shutdown (void); 00057 00058 /// Call destroy on each contained object 00059 virtual void destroy (void); 00060 00061 /// Collection 00062 COLLECTION* collection (void); 00063 00064 protected: 00065 /// The collection data structure that we add objects to. 00066 COLLECTION* collection_; 00067 00068 private: 00069 class Destroyer: public TAO_ESF_Worker<TYPE> 00070 { 00071 /// Call destroy on the object 00072 virtual void work (TYPE* type); 00073 }; 00074 }; 00075 00076 TAO_END_VERSIONED_NAMESPACE_DECL 00077 00078 #if defined (__ACE_INLINE__) 00079 #include "orbsvcs/Notify/Container_T.inl" 00080 #endif /* __ACE_INLINE__ */ 00081 00082 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00083 #include "orbsvcs/Notify/Container_T.cpp" 00084 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00085 00086 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00087 #pragma implementation ("Container_T.cpp") 00088 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00089 00090 #include /**/ "ace/post.h" 00091 00092 #endif /* TAO_Notify_CONTAINER_T_H */