sigx++  2.0.1
shared_dispatchable.h
Go to the documentation of this file.
1 #ifndef _SIGX_SHARED_DISPATCHABLE_HPP_
2 #define _SIGX_SHARED_DISPATCHABLE_HPP_
3 
4 /*
5  * Copyright 2008 Klaus Triendl
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the Free
19  * Software Foundation, 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21 */
22 
23 #include <sigc++/reference_wrapper.h>
24 #include <sigxconfig.h>
25 #include <sigx/fwddecl.h>
26 #include <sigx/dispatchable.h>
27 
28 
29 namespace sigx
30 {
31 
50 class SIGX_API shared_dispatchable: public dispatchable
51 {
52  friend struct DispatcherPtr;
53  // must get the dispatcher ptr over dispatcher() for assertions
55 
56 
57 public:
59  // *
60  // * A DispatcherPtr is constructed from a dispatchable and references the
61  // * dispatcher of the dispatchable. A read lock ensures threadsafe access to
62  // * the reference (the owner thread sets a read/write lock when it sets
63  // * the reference to 0).
64  // * After you have constructed a DispatcherPtr, you *must* test for null.
65  // */
66  //class DispatcherPtr
67  //{
68  //public:
69  // explicit DispatcherPtr(shared_dispatchable& _A_disp):
70  // m_locker(*_A_disp.m_disp_ptr)
71  // {}
72  //
73  // /** @short Returns a plain dispatcher*
74  // */
75  // dispatcher_ptr operator ->()
76  // { return access_acquiree(m_locker); }
77  // operator bool()
78  // { return access_acquiree(m_locker); }
79  // bool operator !()
80  // { return !access_acquiree(m_locker); }
81  // bool operator !=(dispatcher_ptr other)
82  // { return other != access_acquiree(m_locker); }
83  //
84  //private:
85  // readlock_acquirer<internal::rwlockable_dispatcher_ptr> m_locker;
86  //};
87  class DispatcherPtr;
88 
89 
90 public:
95 
98  shared_dispatchable(const dispatchable& d) throw();
101  shared_dispatchable& operator =(const dispatchable& d) throw();
102 };
103 
104 
105 } // namespace sigx
106 
107 
108 #endif // end file guard