dispatchable.h
Go to the documentation of this file.00001 #ifndef _SIGX_DISPATCHABLE_HPP_
00002 #define _SIGX_DISPATCHABLE_HPP_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <utility>
00024 #include <sigc++/trackable.h>
00025 #include <sigxconfig.h>
00026 #include <sigx/fwddecl.h>
00027 #include <sigx/noncopyable.h>
00028 #include <sigx/glib_lockables.h>
00029
00030
00031 namespace sigx
00032 {
00033
00034 namespace internal
00035 {
00036
00037 typedef rw_lockable<dispatcher_ptr> rwlockable_dispatcher_ptr;
00038
00039
00040 }
00041
00042
00043
00051 class SIGX_API dispatchable: noncopyable
00052 {
00053
00054 friend class shared_dispatchable;
00055
00056 protected:
00060 dispatchable();
00061
00062 ~dispatchable() throw();
00063
00064 private:
00067 dispatchable(const dispatchable& other) throw();
00068
00071 dispatchable& operator =(const dispatchable& other) throw();
00072
00075 void release() throw();
00076
00077 protected:
00082 void invalidate_tunnels();
00083
00086 dispatcher_ptr dispatcher() const throw()
00087 {
00088 return m_disp_ptr->access_nonvolatile();
00089 }
00090
00091 public:
00092 typedef void (*func_dispatcher_change_notify)(void* );
00093
00100 void add_dispatcher_change_notify_callback(void* data, func_dispatcher_change_notify func) const;
00101
00106 void remove_dispatcher_change_notify_callback(void* data) const;
00107
00108
00109 private:
00111 volatile int* m_shared_count;
00112
00117 typedef std::list<std::pair<void*, func_dispatcher_change_notify> > callback_list_type;
00118 typedef callback_list_type* callback_list_ptr_type;
00119 callback_list_ptr_type* m_dispatcher_change_callback_list;
00120
00121 protected:
00122 internal::rwlockable_dispatcher_ptr* m_disp_ptr;
00123 };
00124
00125
00126 }
00127
00128
00129 #endif // end file guard