00001 /* -*- C++ -*- */ 00002 /** 00003 * @file ID_Factory.h 00004 * 00005 * ID_Factory.h,v 1.11 2006/03/14 06:14:34 jtc Exp 00006 * 00007 * @author Pradeep Gore <pradeep@oomworks.com> 00008 * 00009 * 00010 */ 00011 00012 #ifndef TAO_Notify_ID_FACTORY_H 00013 #define TAO_Notify_ID_FACTORY_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 "ace/Atomic_Op.h" 00024 00025 #include "orbsvcs/Notify/Object.h" 00026 00027 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00028 00029 /** 00030 * @class TAO_Notify_ID_Factory 00031 * 00032 * @brief A simple factory for generating ID's for objects created by Notify. 00033 * 00034 */ 00035 class TAO_Notify_Serv_Export TAO_Notify_ID_Factory 00036 { 00037 public: 00038 /// Constuctor 00039 TAO_Notify_ID_Factory (void); 00040 00041 /// Destructor 00042 ~TAO_Notify_ID_Factory (); 00043 00044 TAO_Notify_Object::ID id (void); 00045 00046 void set_last_used (const TAO_Notify_Object::ID id); 00047 00048 private: 00049 // Can't use atomic op, because we added the set_last_used() method. 00050 TAO_Notify_Object::ID seed_; 00051 TAO_SYNCH_MUTEX mtx_; 00052 }; 00053 00054 TAO_END_VERSIONED_NAMESPACE_DECL 00055 00056 #if defined (__ACE_INLINE__) 00057 #include "orbsvcs/Notify/ID_Factory.inl" 00058 #endif /* __ACE_INLINE__ */ 00059 00060 #include /**/ "ace/post.h" 00061 00062 #endif /* TAO_Notify_ID_FACTORY_H */