9 #ifndef CoinSmartPtr_hpp
10 #define CoinSmartPtr_hpp
162 inline void AddRef()
const { ++reference_count_; }
166 mutable int reference_count_;
173 #if COIN_IPOPT_CHECKLEVEL > 2
174 # define IP_DEBUG_SMARTPTR
176 #ifdef IP_DEBUG_SMARTPTR
177 # include "IpDebug.hpp"
339 bool IsNull()
const {
return ptr_ == NULL; }
348 void ReleasePointer_() {
351 if (ptr_->ReferenceCount() == 0) {
360 SmartPtr<T>& SetFromRawPtr_(T* rhs){
371 inline SmartPtr<T>& SetFromSmartPtr_(
const SmartPtr<T>& rhs) {
372 SetFromRawPtr_(rhs.GetRawPtr());
379 #define dbg_smartptr_verbosity 0
388 (
void) SetFromSmartPtr_(copy);
393 (
void) SetFromRawPtr_(ptr);
408 #if COIN_COINUTILS_CHECKLEVEL > 0
417 #if COIN_IPOPT_CHECKLEVEL > 0
426 return SetFromRawPtr_(rhs);
433 return SetFromSmartPtr_(rhs);
438 template <
class U1,
class U2>
444 template <
class U1,
class U2>
450 template <
class U1,
class U2>
456 template <
class U1,
class U2>
462 template <
class U1,
class U2>
468 template <
class U1,
class U2>
475 template <
class U1,
class U2>
483 return static_cast<const void*
>(lhs) == static_cast<const void*>(rhs);
493 template <
class U1,
class U2>
498 template <
class U1,
class U2>
503 template <
class U1,
class U2>
508 template <
class U1,
class U2>
513 template <
class U1,
class U2>
518 template <
class U1,
class U2>
524 #define CoinReferencedObject Coin::ReferencedObject
525 #define CoinSmartPtr Coin::SmartPtr
526 #define CoinComparePointers Coin::ComparePointers
bool operator!=(const Coin::SmartPtr< U1 > &lhs, const Coin::SmartPtr< U2 > &rhs)
~SmartPtr()
Destructor, automatically decrements the reference count, deletes the object if necessary.
typedef void(COINLINKAGE_CB *clp_callback)(Clp_Simplex *model
typedef for user call back.
bool ComparePointers(const U1 *lhs, const U2 *rhs)
Template class for Smart Pointers.
int ReferenceCount() const
SmartPtr()
Default constructor, initialized to NULL.
SmartPtr< T > & operator=(const SmartPtr< T > &rhs)
Overloaded equals operator, allows the user to set the value of the SmartPtr from another SmartPtr...
T * GetRawPtr() const
Returns the raw pointer contained.
bool operator==(const Coin::SmartPtr< U1 > &lhs, const Coin::SmartPtr< U2 > &rhs)
SmartPtr(const SmartPtr< T > ©)
Copy constructor, initialized from copy.
bool IsValid() const
Returns true if the SmartPtr is NOT NULL.
SmartPtr< T > & operator=(T *rhs)
Overloaded equals operator, allows the user to set the value of the SmartPtr from a raw pointer...
T * operator->() const
Overloaded arrow operator, allows the user to call methods using the contained pointer.
SmartPtr(T *ptr)
Constructor, initialized from T* ptr.
friend bool operator==(const SmartPtr< U1 > &lhs, const SmartPtr< U2 > &rhs)
Overloaded equality comparison operator, allows the user to compare the value of two SmartPtrs...
T & operator*() const
Overloaded dereference operator, allows the user to dereference the contained pointer.
bool IsNull() const
Returns true if the SmartPtr is NULL.
friend bool operator!=(const SmartPtr< U1 > &lhs, const SmartPtr< U2 > &rhs)
Overloaded in-equality comparison operator, allows the user to compare the value of two SmartPtrs...
virtual ~ReferencedObject()