9#ifndef SQUID_SRC_SECURITY_LOCKINGPOINTER_H
10#define SQUID_SRC_SECURITY_LOCKINGPOINTER_H
19#if HAVE_OPENSSL_CRYPTO_H
20#include <openssl/crypto.h>
26#define sk_free_wrapper(sk_object, argument, freefunction) \
27 extern "C++" inline void sk_object ## _free_wrapper(argument a) { \
28 sk_object ## _pop_free(a, freefunction); \
49template <
typename T,
void (*UnLocker)(T *t),
class Locker = NilFunctor>
95 explicit operator bool()
const {
return raw; }
#define Assure(condition)
void reset()
Forget the raw pointer - unlock if any value was set. Become a nil pointer.
bool operator!=(const SelfType &o) const
const SelfType & operator=(const SelfType &o)
constexpr LockingPointer(std::nullptr_t)
constructs a nil smart pointer from nullptr
void resetWithoutLocking(T *t)
Reset raw pointer - unlock any previous one and save new one without locking.
~LockingPointer()
use the custom UnLocker to unlock any value still stored.
bool operator==(const SelfType &o) const
T * release()
Forget the raw pointer without unlocking it. Become a nil pointer.
void lock(T *t)
The lock() method increments Object's reference counter.
T * get() const
Returns raw and possibly nullptr pointer.
LockingPointer(SelfType &&o)
Security::LockingPointer< T, UnLocker, Locker > SelfType
a helper label to simplify this objects API definitions below
LockingPointer(const SelfType &o)
constexpr LockingPointer()
constructs a nil smart pointer
Network/connection security abstraction layer.
bool nilFunction(const void *)
HardFun< bool, const void *, nilFunction > NilFunctor