[asterisk-commits] pcadach: branch pcadach/chan_h323-live r42285 - /team/pcadach/chan_h323-live/...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Sep 7 10:48:22 MST 2006


Author: pcadach
Date: Thu Sep  7 12:48:21 2006
New Revision: 42285

URL: http://svn.digium.com/view/asterisk?rev=42285&view=rev
Log:
Workaround for unmodified PWLib to successfully unregister capabilities from its factory

Modified:
    team/pcadach/chan_h323-live/channels/h323/compat_h323.h

Modified: team/pcadach/chan_h323-live/channels/h323/compat_h323.h
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channels/h323/compat_h323.h?rev=42285&r1=42284&r2=42285&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/h323/compat_h323.h (original)
+++ team/pcadach/chan_h323-live/channels/h323/compat_h323.h Thu Sep  7 12:48:21 2006
@@ -24,4 +24,31 @@
 #define MyH323TransportTCP H323TransportTCP
 #endif /* <VERSION(1,17,3) */
 
+template <class _Abstract_T, typename _Key_T = PString>
+class MyPFactory: public PFactory<_Abstract_T, _Key_T>
+{
+	public:
+	template <class _Contrete_T> class Worker: WorkerBase
+	{
+		public:
+		Worker(const _Key_T &_key, bool singleton = false)
+			:WorkerBase(singleton), key(_key)
+		{
+			PFactory<_Abstract_T, _Key_T>::Register(key, this);
+		}
+		~Worker()
+		{
+			PFactory<_Abstract_T, _Key_T>::Unregister(key);
+		}
+
+		private:
+		PString key;
+    };
+};
+
+#ifdef H323_REGISTER_CAPABILITY
+#undef H323_REGISTER_CAPABILITY
+#endif
+#define H323_REGISTER_CAPABILITY(cls, capName) static MyPFactory<H323Capability>::Worker<cls> cls##Factory(capName, true)
+
 #endif /* !defined AST_H323_H */



More information about the asterisk-commits mailing list