shared_dispatchable.h

Go to the documentation of this file.
00001 #ifndef _SIGX_SHARED_DISPATCHABLE_HPP_
00002 #define _SIGX_SHARED_DISPATCHABLE_HPP_
00003 
00004 /*
00005  * Copyright 2008 Klaus Triendl
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Library General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Library General Public
00018  * License along with this library; if not, write to the Free 
00019  * Software Foundation, 51 Franklin Street, Fifth Floor, 
00020  * Boston, MA 02110-1301, USA.
00021 */
00022 
00023 #include <sigc++/reference_wrapper.h>
00024 #include <sigxconfig.h>
00025 #include <sigx/fwddecl.h>
00026 #include <sigx/dispatchable.h>
00027 
00028 
00029 namespace sigx
00030 {
00031     
00050 class SIGX_API shared_dispatchable: public dispatchable
00051 {
00052     friend struct DispatcherPtr;
00053     // must get the dispatcher ptr over dispatcher() for assertions
00054     friend class tunnel_validity_tracker;
00055 
00056 
00057 public:
00059     // *    
00060     // *    A DispatcherPtr is constructed from a dispatchable and references the 
00061     // *    dispatcher of the dispatchable. A read lock ensures threadsafe access to
00062     // *    the reference (the owner thread sets a read/write lock when it sets
00063     // *    the reference to 0). 
00064     // *    After you have constructed a DispatcherPtr, you *must* test for null.
00065     // */
00066     //class DispatcherPtr
00067     //{
00068     //public:
00069     //  explicit DispatcherPtr(shared_dispatchable& _A_disp): 
00070     //      m_locker(*_A_disp.m_disp_ptr)
00071     //  {}
00072     //  
00073     //  /** @short Returns a plain dispatcher*
00074     //   */
00075     //  dispatcher_ptr operator ->()
00076     //      {   return access_acquiree(m_locker); }
00077     //  operator bool()
00078     //      {   return access_acquiree(m_locker); }
00079     //  bool operator !()
00080     //      {   return !access_acquiree(m_locker); }
00081     //  bool operator !=(dispatcher_ptr other)
00082     //      {   return other != access_acquiree(m_locker); }
00083     //  
00084     //private:
00085     //  readlock_acquirer<internal::rwlockable_dispatcher_ptr> m_locker;
00086     //};
00087     class DispatcherPtr;
00088 
00089 
00090 public:
00094     shared_dispatchable();
00095 
00098     shared_dispatchable(const dispatchable& d) throw();
00101     shared_dispatchable& operator =(const dispatchable& d) throw();
00102 };
00103 
00104 
00105 } // namespace sigx
00106 
00107 
00108 #endif // end file guard

Generated on Mon Aug 3 17:35:08 2009 for sigx++ by  doxygen 1.5.9