9#ifndef CoinSmartPtr_hpp
10#define CoinSmartPtr_hpp
175#if COIN_IPOPT_CHECKLEVEL > 2
176#define IP_DEBUG_SMARTPTR
178#ifdef IP_DEBUG_SMARTPTR
179#include "IpDebug.hpp"
354 if (
ptr_->ReferenceCount() == 0) {
384#define dbg_smartptr_verbosity 0
422#if COIN_COINUTILS_CHECKLEVEL > 0
432#if COIN_IPOPT_CHECKLEVEL > 0
455 template <
class U1,
class U2 >
460 template <
class U1,
class U2 >
465 template <
class U1,
class U2 >
470 template <
class U1,
class U2 >
475 template <
class U1,
class U2 >
480 template <
class U1,
class U2 >
485template <
class U1,
class U2 >
494 return static_cast< const void *
>(lhs) ==
static_cast< const void *
>(rhs);
504template <
class U1,
class U2 >
510template <
class U1,
class U2 >
516template <
class U1,
class U2 >
522template <
class U1,
class U2 >
528template <
class U1,
class U2 >
534template <
class U1,
class U2 >
541#define CoinReferencedObject Coin::ReferencedObject
542#define CoinSmartPtr Coin::SmartPtr
543#define CoinComparePointers Coin::ComparePointers
bool operator==(const Coin::SmartPtr< U1 > &lhs, const Coin::SmartPtr< U2 > &rhs)
bool operator!=(const Coin::SmartPtr< U1 > &lhs, const Coin::SmartPtr< U2 > &rhs)
virtual ~ReferencedObject()
int ReferenceCount() const
Template class for Smart Pointers.
~SmartPtr()
Destructor, automatically decrements the reference count, deletes the object if necessary.
T * ptr_
Actual raw pointer to the object.
T * operator->() const
Overloaded arrow operator, allows the user to call methods using the contained pointer.
SmartPtr< T > & operator=(const SmartPtr< T > &rhs)
Overloaded equals operator, allows the user to set the value of the SmartPtr from another SmartPtr.
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.
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.
SmartPtr< T > & SetFromRawPtr_(T *rhs)
Set the value of the internal raw pointer from another raw pointer, releasing the previously referenc...
T * GetRawPtr() const
Returns the raw pointer contained.
SmartPtr< T > & SetFromSmartPtr_(const SmartPtr< T > &rhs)
Set the value of the internal raw pointer from a SmartPtr, releasing the previously referenced object...
SmartPtr(T *ptr)
Constructor, initialized from T* ptr.
SmartPtr()
Default constructor, initialized to NULL.
SmartPtr(const SmartPtr< T > ©)
Copy constructor, initialized from copy.
void ReleasePointer_()
Release the currently referenced object.
SmartPtr< T > & operator=(T *rhs)
Overloaded equals operator, allows the user to set the value of the SmartPtr from a raw pointer.
bool IsNull() const
Returns true if the SmartPtr is NULL.
bool IsValid() const
Returns true if the SmartPtr is NOT NULL.
T & operator*() const
Overloaded dereference operator, allows the user to dereference the contained pointer.
bool ComparePointers(const U1 *lhs, const U2 *rhs)