55#ifndef LASS_GUARDIAN_OF_INCLUSION_UTIL_SMART_I_H
56#define LASS_GUARDIAN_OF_INCLUSION_UTIL_SMART_I_H
96 explicit SmartI(TInterface* iInterface):
97 interface_(iInterface)
104 interface_(iOther.interface_)
112 interface_(iOther.interface_)
114 iOther.interface_ =
nullptr;
139 TSelf temp(iInterface);
156 interface_ = iOther.interface_;
157 iOther.interface_ =
nullptr;
172 LASS_ASSERT(interface_);
188 return interface_ == 0;
196 return interface_ == 0;
202 explicit operator bool()
const
204 return interface_ != 0;
211 std::swap(interface_, iOther.interface_);
220 interface_->AddRef();
228 interface_->Release();
void reset()
Reinitialize to NULL interface.
TPointer operator->() const
access pointee as a pointer
SmartI(TSelf &&iOther) noexcept
Move constructor.
TAddress address()
access address of interface pointer.
TPointer get() const
return pointer to interface
bool isEmpty() const
return true if pointer doesn't own any interface.
SmartI(TInterface *iInterface)
Constructor won't do an extra AddRef() on construction but will Release() on destruction.
SmartI(const TSelf &iOther)
Copy constructor performs AddRef() on interface.
~SmartI()
Destructor performs Release() on interface.
TSelf & operator=(const TSelf &iOther)
assign the SmartI to another one, performing AddRef() on interface.
void swap(TSelf &iOther)
exchange the pointees (and there reference counts) between two shared pointers
SmartI()
Default constructor initializes to NULL interface.
TSelf & operator=(TSelf &&iOther) noexcept
Move assignment.
SmartI< I > TSelf
type of *this
void reset(TInterface *iInterface)
Reinitialize to an interface, performs no AddRef on new interface, but will Release() it in destructo...
bool operator!() const
return true if pointer doesn't own any interface (same as isEmpty).
general utility, debug facilities, ...
Library for Assembled Shared Sources.
Rebind to another interface type.