ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
owner.hpp
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header file is part of the \aliblong. It does not belong to an \alibmod and is
4/// included in any \alibdist.
5///
6/// \emoji :copyright: 2013-2024 A-Worx GmbH, Germany.
7/// Published under \ref mainpage_license "Boost Software License".
8//==================================================================================================
9#ifndef HPP_ALIB_LANG_OWNER
10#define HPP_ALIB_LANG_OWNER 1
11#pragma once
12#if !defined(DOXYGEN)
13# include "alib/alib.hpp"
14#endif
15#include "alib/lang/tmp.hpp"
16#include <cstddef>
17
18namespace alib { namespace lang {
19
20/// Ensures that an object of template type \p{TOwnable} is acquired and properly released when
21/// unwinding the stack.
22/// This class is meant to be allocated only on the stack and not on the heap.
23/// Therefore, the new operators as well as copy and move constructors and assignment operators
24/// are declared private.
25///
26/// With debug-builds, the constructor expects caller source information parameters
27/// of type \b CallerInfo.
28/// Use macro \ref ALIB_CALLER_PRUNED to prune those with release-builds.
29///
30/// \see
31/// - Several sibling types exist.
32/// They are described and listed in chapter \ref alib_threads_locks_auto_owner of the
33/// Programmer's Manual of module \alib_threads.
34/// - Besides generic preprocessor macro \ref ALIB_OWN, several application-specific alias macros
35/// exist.
36/// For example, macros
37/// - \ref ALIB_LOCK,
38/// - \ref ALIB_LOCK_WITH,
39/// - \ref ALIB_DCS, or
40/// - \ref ALIB_DCS_WITH
41///
42/// provide a convenient and "speaking" way to use this class.
43/// - Chapter \ref alib_manual_appendix_callerinfo of the General Programmer's Manual.
44///
45/// @tparam TOwnable The type to own.
46/// Requirements are to have methods \b %Acquire and \b %Release available.
47template <typename TOwnable>
48class Owner
49{
51
52 protected:
53 TOwnable& owned; ///< The resource to acquire and release.
54 #if ALIB_DEBUG
55 CallerInfo dbgCI; ///< Caller information. Available only with debug-builds.
56 #endif
57
58 #if !DOXYGEN
59 // choosing the right release method, with or without caller parameters.
60 #if ALIB_DEBUG
61 template<typename TEnableIf= TOwnable,
62 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, Release, dbgCI))=0>
63 void callRelease() { owned.Release(dbgCI); }
64 #endif
65
66 template<typename TEnableIf= TOwnable,
67 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, Release, ))=0>
68 void callRelease() { owned.Release(); }
69 #endif
70 public:
71
72 /// Constructor. Invokes Acquire() on the owner.
73 /// @param ownable The ownable to acquire.
74 /// @param ci Caller information.
75 #if ALIB_DEBUG
76 Owner( TOwnable& ownable, const CallerInfo& ci)
77 : owned(ownable)
78 , dbgCI(ci) { ownable.Acquire( ci ); }
79 #else
80 Owner( TOwnable& ownable ) : owned(ownable) { ownable.Acquire(); }
81 #endif
82
83
84 /// Destructor. Releases the owner by invoking Release().
85 ~Owner() { callRelease(); }
86}; //class Owner
87
88/// Similar to class \alib{lang;Owner}, but calls method \b TryAcquire instead of \b Acquire.
89/// The result is retrievable with method #IsOwning().
90/// @see Chapter \ref alib_threads_locks_auto_owner of the Programmer's Manual of module
91/// \alib_threads
92/// @tparam TOwnable The type to own.
93/// Requirements are to have methods \b %TryAcquire and \b %Release available.
94template <typename TOwnable>
96{
98
99 protected:
100 TOwnable& owned; ///< The resource to acquire and release.
101 bool isOwning; ///< The result of the call to \b TryAcquire.
102 #if ALIB_DEBUG
103 CallerInfo dbgCI; ///< Caller information. Available only with debug-builds.
104 #endif
105
106 #if !DOXYGEN
107 // choosing the right release method, with or without caller parameters.
108 #if ALIB_DEBUG
109 template<typename TEnableIf= TOwnable,
110 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, Release, dbgCI))=0>
111 void callRelease() { owned.Release(dbgCI); }
112 #endif
113
114 template<typename TEnableIf= TOwnable,
115 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, Release, ))=0>
116 void callRelease() { owned.Release(); }
117
118 #if ALIB_DEBUG
119 template<typename TEnableIf= TOwnable,
120 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, ReleaseRecursive, dbgCI))=0>
121 void callRelease() { owned.ReleaseRecursive(dbgCI); }
122 #endif
123
124 template<typename TEnableIf= TOwnable,
125 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, ReleaseRecursive, ))=0>
126 void callRelease() { owned.ReleaseRecursive(); }
127
128 #endif
129 public:
130
131 /// Constructor. Invokes TryAcquire() on member #owned.
132 /// @param ownable The ownable to acquire.
133 /// @param ci Caller information.
134 #if ALIB_DEBUG
135 OwnerTry( TOwnable& ownable, const CallerInfo& ci)
136 : owned(ownable)
137 , dbgCI(ci) { isOwning= ownable.TryAcquire(ci); }
138 #else
139 OwnerTry( TOwnable& ownable )
140 : owned(ownable) { isOwning= ownable.TryAcquire(); }
141 #endif
142
143
144 /// Destructor. Invokes Release() on member #owned.
145 ~OwnerTry() { if (isOwning) callRelease(); }
146
147 /// @return \c true if the try to acquire the #owned with construction of this type was
148 /// successful, \c false otherwise.
149 bool IsOwning() const noexcept { return isOwning; }
150}; //class OwnerTry
151
152/// Similar to class \alib{lang;Owner}, but calls method \b TryAcquireTimed instead of \b Acquire.
153/// The result is retrievable with method #IsOwning().
154/// @see Chapter \ref alib_threads_locks_auto_owner of the Programmer's Manual of module
155/// \alib_threads
156/// @tparam TOwnable The type to own.
157/// Requirements are to have methods \b %TryAcquireTimed and \b %Release available.
158template <typename TOwnable>
160{
162
163 protected:
164 TOwnable& owned; ///< The resource to acquire and release.
165 bool isOwning; ///< The result of the call to \b TryAcquire.
166 #if ALIB_DEBUG
167 CallerInfo dbgCI; ///< Caller information. Available only with debug-builds.
168 #endif
169
170 #if !DOXYGEN
171 // choosing the right release method, with or without caller parameters.
172 #if ALIB_DEBUG
173 template<typename TEnableIf= TOwnable,
174 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, Release, dbgCI))=0>
175 void callRelease() { owned.Release(dbgCI); }
176 #endif
177
178 template<typename TEnableIf= TOwnable,
179 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, Release, ))=0>
180 void callRelease() { owned.Release(); }
181
182 // choosing the right release method, with or without caller parameters.
183 #if ALIB_DEBUG
184 template<typename TEnableIf= TOwnable,
185 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, ReleaseRecursive, dbgCI))=0>
186 void callRelease() { owned.ReleaseRecursive(dbgCI); }
187 #endif
188
189 template<typename TEnableIf= TOwnable,
190 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, ReleaseRecursive, ))=0>
191 void callRelease() { owned.ReleaseRecursive(); }
192
193 #endif
194 public:
195
196 /// Constructor. Invokes TryAcquire() on member #owned.
197 /// @tparam TTimeValue Type of time parameter accepted with construction and passed to
198 /// method <b>TOwnable::TryAcquireTimed</b>.<br>
199 /// Usually this is type \alib{time;Ticks} or
200 /// \alib{time;TimePointBase::Duration;Ticks::Duration}.
201 /// @param ownable The ownable to acquire.
202 /// @param time The duration to wait for, or point in time to wait until.
203 /// @param ci Caller information.
204 #if ALIB_DEBUG
205 template<typename TTimeValue>
206 OwnerTimed( TOwnable& ownable, const TTimeValue& time, const CallerInfo& ci)
207 : owned(ownable)
208 , dbgCI(ci) { isOwning= ownable.TryAcquireTimed( time,ci); }
209 #else
210 template<typename TTimeValue>
211 OwnerTimed( TOwnable& ownable, const TTimeValue& time )
212 : owned(ownable) { isOwning= ownable.TryAcquireTimed( time ); }
213 #endif
214
215
216 /// Destructor. Invokes Release() on member #owned.
217 ~OwnerTimed() { if (isOwning) callRelease(); }
218
219 /// @return \c true if the try to acquire the #owned with construction of this type was
220 /// successful, \c false otherwise.
221 bool IsOwning() const noexcept { return isOwning; }
222}; //class OwnerTimed
223
224
225/// Similar to class \alib{lang;Owner}, but calls methods \b AcquireRecursive and
226/// \b ReleaseRecursive.
227/// @see Chapter \ref alib_threads_locks_auto_owner of the Programmer's Manual of module
228/// \alib_threads
229/// @tparam TOwnable The type to own.
230/// Requirements are to have methods \b %AcquireRecursive and \b %ReleaseRecursive
231/// available.
232template <typename TOwnable>
234{
236
237 protected:
238 TOwnable& owned; ///< The resource to acquire and release.
239 #if ALIB_DEBUG
240 CallerInfo dbgCI; ///< Caller information. Available only with debug-builds.
241 #endif
242
243 #if !DOXYGEN
244 // choosing the right release method, with or without caller parameters.
245 #if ALIB_DEBUG
246 template<typename TEnableIf= TOwnable,
247 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, ReleaseRecursive,dbgCI))=0>
248 void callRelease() { owned.ReleaseRecursive(dbgCI); }
249 #endif
250
251 template<typename TEnableIf= TOwnable,
252 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, ReleaseRecursive, ))=0>
253 void callRelease() { owned.ReleaseRecursive(); }
254 #endif
255 public:
256
257 /// Constructor. Invokes AcquireRecursive() on member #owned.
258 /// @param ownable The ownable to acquire.
259 /// @param ci Caller information.
260 #if ALIB_DEBUG
261 OwnerRecursive( TOwnable& ownable, const CallerInfo& ci)
262 : owned(ownable)
263 , dbgCI(ci) { ownable.AcquireRecursive(ci); }
264 #else
265 OwnerRecursive( TOwnable& ownable ) : owned(ownable) { ownable.AcquireRecursive(); }
266 #endif
267
268
269 /// Destructor. Invokes ReleaseRecursive() on member #owned.
270 ~OwnerRecursive() { callRelease(); }
271}; //class OwnerRecursive
272
273/// Similar to class \alib{lang;Owner}, but calls methods \b AcquireShared and
274/// \b ReleaseShared.
275/// @see Chapter \ref alib_threads_locks_auto_owner of the Programmer's Manual of module
276/// \alib_threads
277/// @tparam TOwnable The type to own.
278/// Requirements are to have methods \b %AcquireShared and \b %ReleaseShared
279/// available.
280template <typename TOwnable>
282{
284
285 protected:
286 TOwnable& owned; ///< The resource to acquire and release.
287 #if ALIB_DEBUG
288 CallerInfo dbgCI; ///< Caller information. Available only with debug-builds.
289 #endif
290
291 #if !DOXYGEN
292 // choosing the right release method, with or without caller parameters.
293 #if ALIB_DEBUG
294 template<typename TEnableIf= TOwnable,
295 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, ReleaseShared, dbgCI))=0>
296 void callRelease() const { owned.ReleaseShared(dbgCI); }
297 #endif
298
299 template<typename TEnableIf= TOwnable,
300 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, ReleaseShared, ))=0>
301 void callRelease() const { owned.ReleaseShared(); }
302 #endif
303 public:
304
305 /// Constructor. Invokes AcquireShared() on member #owned.
306 /// @param ownable The ownable to acquire.
307 /// @param ci Caller information.
308 #if ALIB_DEBUG
309 OwnerShared( TOwnable& ownable, const CallerInfo& ci)
310 : owned(ownable)
311 , dbgCI(ci) { ownable.AcquireShared(ci); }
312 #else
313 OwnerShared( TOwnable& ownable ) : owned(ownable) { ownable.AcquireShared(); }
314 #endif
315
316
317 /// Destructor. Invokes ReleaseShared() on member #owned.
318 ~OwnerShared() { callRelease(); }
319}; //class OwnerShared
320
321/// Similar to class \alib{lang;Owner}, but calls method \b TryAcquireShared instead of \b Acquire
322/// and \b ReleaseShared instead of \b Release.
323/// The result is retrievable with method #IsOwning().
324/// @see Chapter \ref alib_threads_locks_auto_owner of the Programmer's Manual of module
325/// \alib_threads
326/// @tparam TOwnable The type to own.
327/// Requirements are to have methods \b %TryAcquireShared and \b %ReleaseShared
328/// available.
329template <typename TOwnable>
331{
333
334 protected:
335 TOwnable& owned; ///< The resource to acquire and release.
336 bool isOwning; ///< The result of the call to \b TryAcquire.
337 #if ALIB_DEBUG
338 CallerInfo dbgCI; ///< Caller information. Available only with debug-builds.
339 #endif
340
341 #if !DOXYGEN
342 // choosing the right release method, with or without caller parameters.
343 #if ALIB_DEBUG
344 template<typename TEnableIf= TOwnable,
345 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, ReleaseShared, dbgCI))=0>
346 void callRelease() { owned.ReleaseShared(dbgCI); }
347 #endif
348
349 template<typename TEnableIf= TOwnable,
350 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, ReleaseShared, ))=0>
351 void callRelease() { owned.ReleaseShared(); }
352 #endif
353 public:
354
355 /// Constructor. Invokes TryAcquire() on member #owned.
356 /// @param ownable The ownable to acquire.
357 /// @param ci Caller information.
358 #if ALIB_DEBUG
359 OwnerTryShared( TOwnable& ownable, const CallerInfo& ci)
360 : owned(ownable)
361 , dbgCI(ci) { isOwning= ownable.TryAcquireShared(ci); }
362 #else
363 OwnerTryShared( TOwnable& ownable )
364 : owned(ownable) { isOwning= ownable.TryAcquireShared(); }
365 #endif
366
367
368 /// Destructor. Invokes Release() on member #owned.
369 ~OwnerTryShared() { if (isOwning) callRelease(); }
370
371 /// @return \c true if the try to acquire the #owned with construction of this type was
372 /// successful, \c false otherwise.
373 bool IsOwning() const noexcept { return isOwning; }
374}; //class OwnerTryShared
375
376
377/// Similar to class \alib{lang;Owner}, but calls method \b TryAcquireSharedTimed instead
378/// of \b Acquire and \b ReleaseShared instead of \b Shared.
379/// The result is retrievable with method #IsOwning().
380/// @see Chapter \ref alib_threads_locks_auto_owner of the Programmer's Manual of module
381/// \alib_threads
382/// @tparam TOwnable The type to own.
383/// Requirements are to have methods \b %TryAcquireSharedTimed and
384/// \b %ReleaseShared available.
385template <typename TOwnable>
387{
389
390 protected:
391 TOwnable& owned; ///< The resource to acquire and release.
392 bool isOwning; ///< The result of the call to \b TryAcquire.
393 #if ALIB_DEBUG
394 CallerInfo dbgCI; ///< Caller information. Available only with debug-builds.
395 #endif
396
397 #if !DOXYGEN
398 // choosing the right release method, with or without caller parameters.
399 #if ALIB_DEBUG
400 template<typename TEnableIf= TOwnable,
401 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, ReleaseShared, dbgCI))=0>
402 void callRelease() { owned.ReleaseShared(dbgCI); }
403 #endif
404
405 template<typename TEnableIf= TOwnable,
406 ATMP_T_IF(int, ATMP_HAS_METHOD(TEnableIf, ReleaseShared, ))=0>
407 void callRelease() { owned.ReleaseShared(); }
408 #endif
409 public:
410
411 /// Constructor. Invokes TryAcquire() on member #owned.
412 /// @tparam TTimeValue Type of time parameter accepted with construction and passed to
413 /// method <b>TOwnable::TryAcquireTimed</b>.<br>
414 /// Usually this is type \alib{time;Ticks} or
415 /// \alib{time;TimePointBase::Duration;Ticks::Duration}.
416 /// @param time The duration to wait for, or point in time to wait until.
417 /// @param ownable The ownable to acquire.
418 /// @param ci Caller information.
419 #if ALIB_DEBUG
420 template<typename TTimeValue>
421 OwnerSharedTimed( TOwnable& ownable, const TTimeValue& time, const CallerInfo& ci)
422 : owned(ownable)
423 , dbgCI(ci) { isOwning= ownable.TryAcquireSharedTimed( time, ci); }
424 #else
425 template<typename TTimeValue>
426 OwnerSharedTimed( TOwnable& ownable, const TTimeValue& time )
427 : owned(ownable) { isOwning= ownable.TryAcquireSharedTimed( time ); }
428 #endif
429
430
431 /// Destructor. Invokes Release() on member #owned.
432 ~OwnerSharedTimed() { if (isOwning) callRelease(); }
433
434 /// @return \c true if the try to acquire the #owned with construction of this type was
435 /// successful, \c false otherwise.
436 bool IsOwning() const noexcept { return isOwning; }
437}; //class OwnerSharedTimed
438
439} // namespace alib[::lang]
440
441} // namespace [alib]
442
443
444// #################################################################################################
445// Macros
446// #################################################################################################
447#define ALIB_OWN( ownable) alib::lang::Owner <decltype(ownable)> ALIB_IDENTIFIER(owner) (ownable ALIB_COMMA_CALLER_PRUNED);
448#define ALIB_OWN_RECURSIVE(ownable) alib::lang::OwnerRecursive<decltype(ownable)> ALIB_IDENTIFIER(owner) (ownable ALIB_COMMA_CALLER_PRUNED);
449#define ALIB_OWN_SHARED( ownable) alib::lang::OwnerShared <decltype(ownable)> ALIB_IDENTIFIER(owner) (ownable ALIB_COMMA_CALLER_PRUNED);
450
451// Thread-related aliases (placed here to achieve code agnostic from availability of module Threads)
452#if ALIB_THREADS
453# define ALIB_LOCK ALIB_OWN(*this)
454# define ALIB_LOCK_RECURSIVE ALIB_OWN_RECURSIVE(*this)
455# define ALIB_LOCK_SHARED ALIB_OWN_SHARED(*this)
456# define ALIB_LOCK_WITH(lock) ALIB_OWN(lock)
457# define ALIB_LOCK_RECURSIVE_WITH(lock) ALIB_OWN_RECURSIVE(lock)
458# define ALIB_LOCK_SHARED_WITH(lock) ALIB_OWN_SHARED(lock)
459#else
460# if ALIB_DEBUG
461# define ALIB_LOCK { alib::DbgAssertSingleThreaded(); }
462# define ALIB_LOCK_RECURSIVE { alib::DbgAssertSingleThreaded(); }
463# define ALIB_LOCK_SHARED { alib::DbgAssertSingleThreaded(); }
464# define ALIB_LOCK_WITH(VOID) { alib::DbgAssertSingleThreaded(); }
465# define ALIB_LOCK_RECURSIVE_WITH(VOID) { alib::DbgAssertSingleThreaded(); }
466# define ALIB_LOCK_SHARED_WITH(VOID) { alib::DbgAssertSingleThreaded(); }
467# else
468# define ALIB_LOCK {}
469# define ALIB_LOCK_RECURSIVE {}
470# define ALIB_LOCK_SHARED {}
471# define ALIB_LOCK_WITH(VOID) {}
472# define ALIB_LOCK_RECURSIVE_WITH(VOID) {}
473# define ALIB_LOCK_SHARED_WITH(VOID) {}
474# endif
475#endif // !ALIB_THREADS
476
477
478// Recursive invocation detection
479#if ALIB_DEBUG
480#define ALIB_DBG_PREVENT_RECURSIVE_METHOD_CALLS_MEMBER_DECL \
481bool dbgRecursionDetectionFlag = false;
482
483#define ALIB_DBG_PREVENT_RECURSIVE_METHOD_CALLS \
484struct RecursionDetection \
485{ \
486 bool& TestMember; \
487 RecursionDetection( bool& testMember ) : TestMember(testMember) {} \
488 \
489 void Acquire( const lang::CallerInfo& ci ) \
490 { \
491 ALIB_ASSERT_ERROR(TestMember==false,"FSOWNER","Forbidden recursive use of method ", ci.Func)\
492 TestMember= true; \
493 } \
494 void Release() { TestMember= false; } \
495}; \
496RecursionDetection dbgRecursionDetection( dbgRecursionDetectionFlag ); \
497ALIB_OWN(dbgRecursionDetection);
498#else
499# define ALIB_DBG_PREVENT_RECURSIVE_METHOD_CALLS_MEMBER_DECL
500# define ALIB_DBG_PREVENT_RECURSIVE_METHOD_CALLS
501#endif
502
503#endif // HPP_ALIB_LANG_OWNER
504
CallerInfo dbgCI
Caller information. Available only with debug-builds.
Definition owner.hpp:240
OwnerRecursive(TOwnable &ownable, const CallerInfo &ci)
Definition owner.hpp:261
~OwnerRecursive()
Destructor. Invokes ReleaseRecursive() on member owned.
Definition owner.hpp:270
TOwnable & owned
The resource to acquire and release.
Definition owner.hpp:238
CallerInfo dbgCI
Caller information. Available only with debug-builds.
Definition owner.hpp:394
bool isOwning
The result of the call to TryAcquire.
Definition owner.hpp:392
bool IsOwning() const noexcept
Definition owner.hpp:436
TOwnable & owned
The resource to acquire and release.
Definition owner.hpp:391
~OwnerSharedTimed()
Destructor. Invokes Release() on member owned.
Definition owner.hpp:432
OwnerSharedTimed(TOwnable &ownable, const TTimeValue &time, const CallerInfo &ci)
Definition owner.hpp:421
OwnerShared(TOwnable &ownable, const CallerInfo &ci)
Definition owner.hpp:309
CallerInfo dbgCI
Caller information. Available only with debug-builds.
Definition owner.hpp:288
~OwnerShared()
Destructor. Invokes ReleaseShared() on member owned.
Definition owner.hpp:318
TOwnable & owned
The resource to acquire and release.
Definition owner.hpp:286
CallerInfo dbgCI
Caller information. Available only with debug-builds.
Definition owner.hpp:167
OwnerTimed(TOwnable &ownable, const TTimeValue &time, const CallerInfo &ci)
Definition owner.hpp:206
bool isOwning
The result of the call to TryAcquire.
Definition owner.hpp:165
bool IsOwning() const noexcept
Definition owner.hpp:221
TOwnable & owned
The resource to acquire and release.
Definition owner.hpp:164
~OwnerTimed()
Destructor. Invokes Release() on member owned.
Definition owner.hpp:217
CallerInfo dbgCI
Caller information. Available only with debug-builds.
Definition owner.hpp:338
bool isOwning
The result of the call to TryAcquire.
Definition owner.hpp:336
OwnerTryShared(TOwnable &ownable, const CallerInfo &ci)
Definition owner.hpp:359
~OwnerTryShared()
Destructor. Invokes Release() on member owned.
Definition owner.hpp:369
bool IsOwning() const noexcept
Definition owner.hpp:373
TOwnable & owned
The resource to acquire and release.
Definition owner.hpp:335
CallerInfo dbgCI
Caller information. Available only with debug-builds.
Definition owner.hpp:103
bool isOwning
The result of the call to TryAcquire.
Definition owner.hpp:101
OwnerTry(TOwnable &ownable, const CallerInfo &ci)
Definition owner.hpp:135
bool IsOwning() const noexcept
Definition owner.hpp:149
TOwnable & owned
The resource to acquire and release.
Definition owner.hpp:100
~OwnerTry()
Destructor. Invokes Release() on member owned.
Definition owner.hpp:145
CallerInfo dbgCI
Caller information. Available only with debug-builds.
Definition owner.hpp:55
Owner(TOwnable &ownable, const CallerInfo &ci)
Definition owner.hpp:76
TOwnable & owned
The resource to acquire and release.
Definition owner.hpp:53
~Owner()
Destructor. Releases the owner by invoking Release().
Definition owner.hpp:85
#define ALIB_STACK_ALLOCATED_TYPE(T)
Definition alib.hpp:1030
#define ATMP_HAS_METHOD(T, Method,...)
Definition tmp.hpp:51
#define ATMP_T_IF(T, Cond)
Definition tmp.hpp:49
Definition alib.cpp:69