44template <
typename TOwnable,
bool TOptional= false>
62 template<
typename TRequires= TOwnable>
67 template<
typename TRequires= TOwnable>
69 void callRelease() {
owned->Release(); }
79 ,
dbgCI(ci) { ownable.Acquire( ci ); }
88 ,
dbgCI(ci) {
if (ownable !=
nullptr) ownable->Acquire( ci ); }
90 Owner( TOwnable& ownable ) :
owned(&ownable) { ownable.Acquire(); }
93 :
owned(ownable) {
if (ownable !=
nullptr) ownable->Acquire(); }
119template <
typename TOwnable,
bool TOptional= false>
138 template<
typename TRequires= TOwnable>
143 template<
typename TRequires= TOwnable>
145 void callRelease() {
if (!TOptional ||
owned)
owned->Release(); }
148 template<
typename TRequires= TOwnable>
150 void callRelease() {
if (!TOptional ||
owned)
owned->ReleaseRecursive(
dbgCI); }
153 template<
typename TRequires= TOwnable>
155 void callRelease() {
if (!TOptional ||
owned)
owned->ReleaseRecursive(); }
175 ,
dbgCI(ci) {
isOwning = !ownable || ownable->TryAcquire( ci ); }
181 :
owned(ownable) {
isOwning = !ownable || ownable->TryAcquire(); }
216template <
typename TOwnable,
bool TOptional= false>
235 template<
typename TRequires= TOwnable>
240 template<
typename TRequires= TOwnable>
242 void callRelease() {
owned->Release(); }
246 template<
typename TRequires= TOwnable>
248 void callRelease() {
owned->ReleaseRecursive(
dbgCI); }
251 template<
typename TRequires= TOwnable>
253 void callRelease() {
owned->ReleaseRecursive(); }
267 template<
typename TTimeValue>
281 template<
typename TTimeValue>
287 template<
typename TTimeValue>
291 template<
typename TTimeValue>
311 template<
typename TTimeValue>
336template <
typename TOwnable,
bool TOptional= false>
354 template<
typename TRequires= TOwnable>
356 void callRelease() {
owned->ReleaseRecursive(
dbgCI); }
359 template<
typename TRequires= TOwnable>
361 void callRelease() {
owned->ReleaseRecursive(); }
371 ,
dbgCI(ci) { ownable.AcquireRecursive(ci); }
380 ,
dbgCI(ci) {
if (ownable !=
nullptr) ownable->AcquireRecursive( ci ); }
386 :
owned(ownable) {
if (ownable !=
nullptr) ownable->AcquireRecursive(); }
413template <
typename TOwnable,
bool TOptional= false>
431 template<
typename TRequires= TOwnable>
433 void callRelease()
const {
owned->ReleaseShared(
dbgCI); }
436 template<
typename TRequires= TOwnable>
438 void callRelease()
const {
owned->ReleaseShared(); }
448 ,
dbgCI(ci) { ownable.AcquireShared(ci); }
457 ,
dbgCI(ci) {
if (ownable !=
nullptr) ownable->AcquireShared( ci ); }
459 OwnerShared( TOwnable& ownable ) :
owned(&ownable) { ownable.AcquireShared(); }
462 :
owned(ownable) {
if (ownable !=
nullptr) ownable->AcquireShared(); }
491template <
typename TOwnable,
bool TOptional= false>
510 template<
typename TRequires= TOwnable>
512 void callRelease() {
owned->ReleaseShared(
dbgCI); }
515 template<
typename TRequires= TOwnable>
517 void callRelease() {
owned->ReleaseShared(); }
536 ,
dbgCI(ci) {
isOwning = !ownable || ownable->TryAcquireShared( ci ); }
543 :
owned(ownable) {
isOwning = !ownable || ownable->TryAcquireShared(); }
581template <
typename TOwnable,
bool TOptional= false>
600 template<
typename TRequires= TOwnable>
602 void callRelease() {
owned->ReleaseShared(
dbgCI); }
605 template<
typename TRequires= TOwnable>
607 void callRelease() {
owned->ReleaseShared(); }
620 template<
typename TTimeValue>
634 template<
typename TTimeValue>
640 template<
typename TTimeValue>
644 template<
typename TTimeValue>
647 :
owned(ownable) {
isOwning= !ownable || ownable->TryAcquireSharedTimed(
time); }
670 template<
typename TTimeValue>
void Set(OwnablePointer ownable)
std::remove_reference_t< TOwnable > * OwnablePointer
The pointer type of the owned object.
OwnerRecursive(OwnablePointer ownable, const CallerInfo &ci)
OwnerRecursive(TOwnable &ownable, const CallerInfo &ci)
OwnablePointer owned
The resource to acquire and release.
CallerInfo dbgCI
Caller information. Available only with debug-builds.
~OwnerRecursive()
Destructor. Invokes ReleaseRecursive() on member owned.
std::remove_reference_t< TOwnable > * OwnablePointer
The pointer type of the owned object.
~OwnerSharedTimed()
Destructor. Invokes Release() on member owned.
CallerInfo dbgCI
Caller information. Available only with debug-builds.
OwnerSharedTimed(OwnablePointer ownable, const TTimeValue &time, const CallerInfo &ci)
bool Set(OwnablePointer ownable, const TTimeValue &time)
OwnerSharedTimed(TOwnable &ownable, const TTimeValue &time, const CallerInfo &ci)
bool isOwning
The result of the call to TryAcquire.
bool IsOwning() const noexcept
OwnablePointer owned
The resource to acquire and release.
OwnerShared(TOwnable &ownable, const CallerInfo &ci)
OwnablePointer owned
The resource to acquire and release.
std::remove_reference_t< TOwnable > * OwnablePointer
The pointer type of the owned object.
~OwnerShared()
Destructor. Invokes ReleaseShared() on member owned.
OwnerShared(OwnablePointer ownable, const CallerInfo &ci)
void Set(OwnablePointer ownable)
CallerInfo dbgCI
Caller information. Available only with debug-builds.
std::remove_reference_t< TOwnable > * OwnablePointer
The pointer type of the owned object.
bool IsOwning() const noexcept
~OwnerTimed()
Destructor. Invokes Release() on member owned.
OwnerTimed(OwnablePointer ownable, const TTimeValue &time, const CallerInfo &ci)
OwnerTimed(TOwnable &ownable, const TTimeValue &time, const CallerInfo &ci)
bool Set(OwnablePointer ownable, const TTimeValue &time)
OwnablePointer owned
The resource to acquire and release.
CallerInfo dbgCI
Caller information. Available only with debug-builds.
bool isOwning
The result of the call to TryAcquire.
bool IsOwning() const noexcept
CallerInfo dbgCI
Caller information. Available only with debug-builds.
bool isOwning
The result of the call to TryAcquire.
std::remove_reference_t< TOwnable > * OwnablePointer
The pointer type of the owned object.
OwnablePointer owned
The resource to acquire and release.
bool Set(OwnablePointer ownable)
OwnerTryShared(TOwnable &ownable, const CallerInfo &ci)
OwnerTryShared(OwnablePointer ownable, const CallerInfo &ci)
~OwnerTryShared()
Destructor. Invokes Release() on member owned.
OwnablePointer owned
The resource to acquire and release.
bool Set(OwnablePointer ownable)
OwnerTry(OwnablePointer ownable, const CallerInfo &ci)
~OwnerTry()
Destructor. Invokes Release() on member owned.
CallerInfo dbgCI
Caller information. Available only with debug-builds.
std::remove_reference_t< TOwnable > * OwnablePointer
The pointer type of the owned object.
bool IsOwning() const noexcept
OwnerTry(TOwnable &ownable, const CallerInfo &ci)
bool isOwning
The result of the call to TryAcquire.
OwnablePointer owned
The resource to acquire and release.
std::remove_reference_t< TOwnable > * OwnablePointer
The pointer type of the owned object.
~Owner()
Destructor. Releases the owner by invoking Release().
Owner(TOwnable &ownable, const CallerInfo &ci)
Owner(OwnablePointer ownable, const CallerInfo &ci)
CallerInfo dbgCI
Caller information. Available only with debug-builds.
void Set(OwnablePointer ownable)
#define ALIB_HAS_METHOD(T, Method,...)
#define ALIB_STACK_ALLOCATED_TYPE(T)
#define ALIB_ASSERT_ERROR(cond, domain,...)