2 /* Do not edit! -- generated file */
5 #ifndef _SIGC_LIMIT_REFERENCE_H_
6 #define _SIGC_LIMIT_REFERENCE_H_
8 #include <sigc++/visit_each.h>
9 #include <sigc++/type_traits.h>
10 #include <sigc++/trackable.h>
14 /** A limit_reference<Foo> object stores a reference (Foo&), but make sure that,
15 * if Foo inherits from sigc::trackable, then visit_each<>() will "limit" itself to the
16 * sigc::trackable reference instead of the derived reference. This avoids use of
17 * a reference to the derived type when the derived destructor has run. That can be
18 * a problem when using virtual inheritance.
20 * If Foo inherits from trackable then both the derived reference and the
21 * sigc::trackable reference are stored, so we can later retrieve the sigc::trackable
22 * reference without doing an implicit conversion. To retrieve the derived reference
23 * (so that you invoke methods or members of it), use invoke(). To retrieve the trackable
24 * reference (so that you can call visit_each() on it), you use visit().
26 * If Foo does not inherit from sigc::trackable then invoke() and visit() just return the
29 * This is used for bound (sigc::bind) slot parameters (via bound_argument), bound return values,
30 * and, with mem_fun(), the reference to the handling object.
32 * - @e T_type The type of the reference.
34 template <class T_type,
35 bool I_derives_trackable =
36 std::is_base_of<trackable, T_type>::value>
41 * @param _A_target The reference to limit.
43 limit_reference(T_type& _A_target)
47 /** Retrieve the entity to visit for visit_each().
48 * Depending on the template specialization, this is either a derived reference, or sigc::trackable& if T_type derives from sigc::trackable.
49 * @return The reference.
51 inline const T_type& visit() const
54 /** Retrieve the reference.
55 * This is always a reference to the derived instance.
56 * @return The reference.
58 inline T_type& invoke() const
67 /** limit_reference object for a class that derives from trackable.
68 * - @e T_type The type of the reference.
70 template <class T_type>
71 class limit_reference<T_type, true>
75 * @param _A_target The reference to limit.
77 limit_reference(T_type& _A_target)
82 /** Retrieve the entity to visit for visit_each().
83 * Depending on the template specialization, this is either a derived reference, or sigc::trackable& if T_type derives from sigc::trackable.
84 * @return The reference.
86 inline const trackable& visit() const
89 /** Retrieve the reference.
90 * This is always a reference to the derived instance.
91 * @return The reference.
93 inline T_type& invoke() const
97 /** The trackable reference.
106 #ifndef DOXYGEN_SHOULD_SKIP_THIS
107 /** Implementation of visitor specialized for the limit_reference
108 * class, to call visit_each() on the entity returned by the limit_reference's
110 * @tparam T_type The type of the reference.
111 * @tparam T_action The type of functor to invoke.
112 * @param _A_action The functor to invoke.
113 * @param _A_target The visited instance.
115 template <class T_type, bool I_derives_trackable>
116 struct visitor<limit_reference<T_type, I_derives_trackable> >
118 template <class T_action>
119 static void do_visit_each(const T_action& _A_action,
120 const limit_reference<T_type, I_derives_trackable>& _A_target)
122 sigc::visit_each(_A_action, _A_target.visit());
125 #endif // DOXYGEN_SHOULD_SKIP_THIS
128 /** A const_limit_reference<Foo> object stores a reference (Foo&), but make sure that,
129 * if Foo inherits from sigc::trackable, then visit_each<>() will "limit" itself to the
130 * sigc::trackable reference instead of the derived reference. This avoids use of
131 * a reference to the derived type when the derived destructor has run. That can be
132 * a problem when using virtual inheritance.
134 * If Foo inherits from trackable then both the derived reference and the
135 * sigc::trackable reference are stored, so we can later retrieve the sigc::trackable
136 * reference without doing an implicit conversion. To retrieve the derived reference
137 * (so that you invoke methods or members of it), use invoke(). To retrieve the trackable
138 * reference (so that you can call visit_each() on it), you use visit().
140 * If Foo does not inherit from sigc::trackable then invoke() and visit() just return the
143 * This is used for bound (sigc::bind) slot parameters (via bound_argument), bound return values,
144 * and, with mem_fun(), the reference to the handling object.
146 * - @e T_type The type of the reference.
148 template <class T_type,
149 bool I_derives_trackable =
150 std::is_base_of<trackable, T_type>::value>
151 class const_limit_reference
155 * @param _A_target The reference to limit.
157 const_limit_reference(const T_type& _A_target)
161 /** Retrieve the entity to visit for visit_each().
162 * Depending on the template specialization, this is either a derived reference, or sigc::trackable& if T_type derives from sigc::trackable.
163 * @return The reference.
165 inline const T_type& visit() const
168 /** Retrieve the reference.
169 * This is always a reference to the derived instance.
170 * @return The reference.
172 inline const T_type& invoke() const
178 const T_type& visited;
181 /** const_limit_reference object for a class that derives from trackable.
182 * - @e T_type The type of the reference.
184 template <class T_type>
185 class const_limit_reference<T_type, true>
189 * @param _A_target The reference to limit.
191 const_limit_reference(const T_type& _A_target)
192 : visited(_A_target),
196 /** Retrieve the entity to visit for visit_each().
197 * Depending on the template specialization, this is either a derived reference, or sigc::trackable& if T_type derives from sigc::trackable.
198 * @return The reference.
200 inline const trackable& visit() const
203 /** Retrieve the reference.
204 * This is always a reference to the derived instance.
205 * @return The reference.
207 inline const T_type& invoke() const
211 /** The trackable reference.
213 const trackable& visited;
217 const T_type& invoked;
220 #ifndef DOXYGEN_SHOULD_SKIP_THIS
221 /** Implementation of visitor specialized for the const_limit_reference
222 * class, to call visit_each() on the entity returned by the const_limit_reference's
224 * @tparam T_type The type of the reference.
225 * @tparam T_action The type of functor to invoke.
226 * @param _A_action The functor to invoke.
227 * @param _A_target The visited instance.
229 template <class T_type, bool I_derives_trackable>
230 struct visitor<const_limit_reference<T_type, I_derives_trackable> >
232 template <class T_action>
233 static void do_visit_each(const T_action& _A_action,
234 const const_limit_reference<T_type, I_derives_trackable>& _A_target)
236 sigc::visit_each(_A_action, _A_target.visit());
239 #endif // DOXYGEN_SHOULD_SKIP_THIS
242 /** A volatile_limit_reference<Foo> object stores a reference (Foo&), but make sure that,
243 * if Foo inherits from sigc::trackable, then visit_each<>() will "limit" itself to the
244 * sigc::trackable reference instead of the derived reference. This avoids use of
245 * a reference to the derived type when the derived destructor has run. That can be
246 * a problem when using virtual inheritance.
248 * If Foo inherits from trackable then both the derived reference and the
249 * sigc::trackable reference are stored, so we can later retrieve the sigc::trackable
250 * reference without doing an implicit conversion. To retrieve the derived reference
251 * (so that you invoke methods or members of it), use invoke(). To retrieve the trackable
252 * reference (so that you can call visit_each() on it), you use visit().
254 * If Foo does not inherit from sigc::trackable then invoke() and visit() just return the
257 * This is used for bound (sigc::bind) slot parameters (via bound_argument), bound return values,
258 * and, with mem_fun(), the reference to the handling object.
260 * - @e T_type The type of the reference.
262 template <class T_type,
263 bool I_derives_trackable =
264 std::is_base_of<trackable, T_type>::value>
265 class volatile_limit_reference
269 * @param _A_target The reference to limit.
271 volatile_limit_reference(T_type& _A_target)
275 /** Retrieve the entity to visit for visit_each().
276 * Depending on the template specialization, this is either a derived reference, or sigc::trackable& if T_type derives from sigc::trackable.
277 * @return The reference.
279 inline const T_type& visit() const
282 /** Retrieve the reference.
283 * This is always a reference to the derived instance.
284 * @return The reference.
286 inline volatile T_type& invoke() const
295 /** volatile_limit_reference object for a class that derives from trackable.
296 * - @e T_type The type of the reference.
298 template <class T_type>
299 class volatile_limit_reference<T_type, true>
303 * @param _A_target The reference to limit.
305 volatile_limit_reference(T_type& _A_target)
306 : visited(_A_target),
310 /** Retrieve the entity to visit for visit_each().
311 * Depending on the template specialization, this is either a derived reference, or sigc::trackable& if T_type derives from sigc::trackable.
312 * @return The reference.
314 inline const trackable& visit() const
317 /** Retrieve the reference.
318 * This is always a reference to the derived instance.
319 * @return The reference.
321 inline volatile T_type& invoke() const
325 /** The trackable reference.
334 #ifndef DOXYGEN_SHOULD_SKIP_THIS
335 /** Implementation of visitor specialized for the volatile_limit_reference
336 * class, to call visit_each() on the entity returned by the volatile_limit_reference's
338 * @tparam T_type The type of the reference.
339 * @tparam T_action The type of functor to invoke.
340 * @param _A_action The functor to invoke.
341 * @param _A_target The visited instance.
343 template <class T_type, bool I_derives_trackable>
344 struct visitor<volatile_limit_reference<T_type, I_derives_trackable> >
346 template <class T_action>
347 static void do_visit_each(const T_action& _A_action,
348 const volatile_limit_reference<T_type, I_derives_trackable>& _A_target)
350 sigc::visit_each(_A_action, _A_target.visit());
353 #endif // DOXYGEN_SHOULD_SKIP_THIS
356 /** A const_volatile_limit_reference<Foo> object stores a reference (Foo&), but make sure that,
357 * if Foo inherits from sigc::trackable, then visit_each<>() will "limit" itself to the
358 * sigc::trackable reference instead of the derived reference. This avoids use of
359 * a reference to the derived type when the derived destructor has run. That can be
360 * a problem when using virtual inheritance.
362 * If Foo inherits from trackable then both the derived reference and the
363 * sigc::trackable reference are stored, so we can later retrieve the sigc::trackable
364 * reference without doing an implicit conversion. To retrieve the derived reference
365 * (so that you invoke methods or members of it), use invoke(). To retrieve the trackable
366 * reference (so that you can call visit_each() on it), you use visit().
368 * If Foo does not inherit from sigc::trackable then invoke() and visit() just return the
371 * This is used for bound (sigc::bind) slot parameters (via bound_argument), bound return values,
372 * and, with mem_fun(), the reference to the handling object.
374 * - @e T_type The type of the reference.
376 template <class T_type,
377 bool I_derives_trackable =
378 std::is_base_of<trackable, T_type>::value>
379 class const_volatile_limit_reference
383 * @param _A_target The reference to limit.
385 const_volatile_limit_reference(const T_type& _A_target)
389 /** Retrieve the entity to visit for visit_each().
390 * Depending on the template specialization, this is either a derived reference, or sigc::trackable& if T_type derives from sigc::trackable.
391 * @return The reference.
393 inline const T_type& visit() const
396 /** Retrieve the reference.
397 * This is always a reference to the derived instance.
398 * @return The reference.
400 inline const volatile T_type& invoke() const
406 const T_type& visited;
409 /** const_volatile_limit_reference object for a class that derives from trackable.
410 * - @e T_type The type of the reference.
412 template <class T_type>
413 class const_volatile_limit_reference<T_type, true>
417 * @param _A_target The reference to limit.
419 const_volatile_limit_reference(const T_type& _A_target)
420 : visited(_A_target),
424 /** Retrieve the entity to visit for visit_each().
425 * Depending on the template specialization, this is either a derived reference, or sigc::trackable& if T_type derives from sigc::trackable.
426 * @return The reference.
428 inline const trackable& visit() const
431 /** Retrieve the reference.
432 * This is always a reference to the derived instance.
433 * @return The reference.
435 inline const volatile T_type& invoke() const
439 /** The trackable reference.
441 const trackable& visited;
445 const T_type& invoked;
448 #ifndef DOXYGEN_SHOULD_SKIP_THIS
449 /** Implementation of visitor specialized for the const_volatile_limit_reference
450 * class, to call visit_each() on the entity returned by the const_volatile_limit_reference's
452 * @tparam T_type The type of the reference.
453 * @tparam T_action The type of functor to invoke.
454 * @param _A_action The functor to invoke.
455 * @param _A_target The visited instance.
457 template <class T_type, bool I_derives_trackable>
458 struct visitor<const_volatile_limit_reference<T_type, I_derives_trackable> >
460 template <class T_action>
461 static void do_visit_each(const T_action& _A_action,
462 const const_volatile_limit_reference<T_type, I_derives_trackable>& _A_target)
464 sigc::visit_each(_A_action, _A_target.visit());
467 #endif // DOXYGEN_SHOULD_SKIP_THIS
469 } /* namespace sigc */
471 #endif /* _SIGC_LIMIT_REFERENCE_H_ */