9 #ifndef __IPSMARTPTR_HPP__
10 #define __IPSMARTPTR_HPP__
18 # error "don't have header file for stddef"
25 #if COIN_IPOPT_CHECKLEVEL > 2
26 # define IP_DEBUG_SMARTPTR
29 # if defined(__GNUC__)
30 # define IPOPT_UNUSED __attribute__((unused))
185 #define ipopt_dbg_smartptr_verbosity 0
225 SmartPtr<T>&
operator=(
const SmartPtr<T>& rhs);
231 SmartPtr<T>&
operator=(
const SmartPtr<U>& rhs);
235 template <
class U1,
class U2>
237 bool operator==(
const SmartPtr<U1>& lhs,
const SmartPtr<U2>& rhs);
241 template <
class U1,
class U2>
243 bool operator==(
const SmartPtr<U1>& lhs, U2* raw_rhs);
247 template <
class U1,
class U2>
249 bool operator==(U1* lhs,
const SmartPtr<U2>& raw_rhs);
253 template <
class U1,
class U2>
255 bool operator!=(
const SmartPtr<U1>& lhs,
const SmartPtr<U2>& rhs);
259 template <
class U1,
class U2>
261 bool operator!=(
const SmartPtr<U1>& lhs, U2* raw_rhs);
265 template <
class U1,
class U2>
267 bool operator!=(U1* lhs,
const SmartPtr<U2>& raw_rhs);
273 bool operator<(const SmartPtr<U>& lhs,
const SmartPtr<U>& rhs);
290 U*
GetRawPtr(
const SmartPtr<U>& smart_ptr);
295 SmartPtr<const U>
ConstPtr(
const SmartPtr<U>& smart_ptr);
303 bool IsValid(
const SmartPtr<U>& smart_ptr);
311 bool IsNull(
const SmartPtr<U>& smart_ptr);
349 template <
class U1,
class U2>
352 template <
class U1,
class U2>
355 template <
class U1,
class U2>
358 template <
class U1,
class U2>
361 template <
class U1,
class U2>
364 template <
class U1,
class U2>
375 #ifdef IP_DEBUG_SMARTPTR
391 #ifdef IP_DEBUG_SMARTPTR
409 #ifdef IP_DEBUG_SMARTPTR
426 #ifdef IP_DEBUG_SMARTPTR
440 #ifdef IP_DEBUG_SMARTPTR
451 #ifdef IP_DEBUG_SMARTPTR
456 #if COIN_IPOPT_CHECKLEVEL > 0
467 #ifdef IP_DEBUG_SMARTPTR
472 #if COIN_IPOPT_CHECKLEVEL > 0
483 #ifdef IP_DEBUG_SMARTPTR
487 return SetFromRawPtr_(rhs);
494 #ifdef IP_DEBUG_SMARTPTR
496 "SmartPtr<T>& SmartPtr<T>::operator=(const SmartPtr<T>& rhs)",
500 return SetFromSmartPtr_(rhs);
508 #ifdef IP_DEBUG_SMARTPTR
510 "SmartPtr<T>& SmartPtr<T>::operator=(const SmartPtr<U>& rhs)",
521 #ifdef IP_DEBUG_SMARTPTR
540 #ifdef IP_DEBUG_SMARTPTR
542 "SmartPtr<T>& SmartPtr<T>::SetFromSmartPtr_(const SmartPtr<T>& rhs)",
555 #ifdef IP_DEBUG_SMARTPTR
557 "void SmartPtr<T>::ReleasePointer()",
562 ptr_->ReleaseRef(
this);
563 if (ptr_->ReferenceCount() == 0)
572 #ifdef IP_DEBUG_SMARTPTR
574 "T* GetRawPtr(const SmartPtr<T>& smart_ptr)",
578 return smart_ptr.
ptr_;
591 return !
IsNull(smart_ptr);
597 #ifdef IP_DEBUG_SMARTPTR
599 "bool IsNull(const SmartPtr<T>& smart_ptr)",
603 return (smart_ptr.
ptr_ == 0);
607 template <
class U1,
class U2>
610 #ifdef IP_DEBUG_SMARTPTR
612 "bool ComparePtrs(const U1* lhs, const U2* rhs)",
623 return v_lhs == v_rhs;
626 template <
class U1,
class U2>
629 #ifdef IP_DEBUG_SMARTPTR
631 "bool operator==(const SmartPtr<U1>& lhs, const SmartPtr<U2>& rhs)",
640 template <
class U1,
class U2>
643 #ifdef IP_DEBUG_SMARTPTR
645 "bool operator==(SmartPtr<U1>& lhs, U2* rhs)",
653 template <
class U1,
class U2>
656 #ifdef IP_DEBUG_SMARTPTR
658 "bool operator==(U1* raw_lhs, SmartPtr<U2>& rhs)",
666 template <
class U1,
class U2>
669 #ifdef IP_DEBUG_SMARTPTR
671 "bool operator!=(const SmartPtr<U1>& lhs, const SmartPtr<U2>& rhs)",
679 template <
class U1,
class U2>
682 #ifdef IP_DEBUG_SMARTPTR
684 "bool operator!=(SmartPtr<U1>& lhs, U2* rhs)",
692 template <
class U1,
class U2>
695 #ifdef IP_DEBUG_SMARTPTR
697 "bool operator!=(U1* raw_lhs, SmartPtr<U2>& rhs)",
708 #ifdef IP_DEBUG_REFERENCED
720 return lhs.
ptr_ < rhs.ptr_;
729 template <
class T>
bool
732 return !( rhs < lhs );
735 template <
class T>
bool
738 return !( lhs < rhs );
742 #undef ipopt_dbg_smartptr_verbosity