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
178 #define dbg_smartptr_verbosity 0
214 SmartPtr<T>&
operator=(
const SmartPtr<T>& rhs);
218 template <
class U1,
class U2>
220 bool operator==(
const SmartPtr<U1>& lhs,
const SmartPtr<U2>& rhs);
224 template <
class U1,
class U2>
226 bool operator==(
const SmartPtr<U1>& lhs, U2* raw_rhs);
230 template <
class U1,
class U2>
232 bool operator==(U1* lhs,
const SmartPtr<U2>& raw_rhs);
236 template <
class U1,
class U2>
238 bool operator!=(
const SmartPtr<U1>& lhs,
const SmartPtr<U2>& rhs);
242 template <
class U1,
class U2>
244 bool operator!=(
const SmartPtr<U1>& lhs, U2* raw_rhs);
248 template <
class U1,
class U2>
250 bool operator!=(U1* lhs,
const SmartPtr<U2>& raw_rhs);
267 U*
GetRawPtr(
const SmartPtr<U>& smart_ptr);
272 SmartPtr<const U>
ConstPtr(
const SmartPtr<U>& smart_ptr);
280 bool IsValid(
const SmartPtr<U>& smart_ptr);
288 bool IsNull(
const SmartPtr<U>& smart_ptr);
326 template <
class U1,
class U2>
329 template <
class U1,
class U2>
332 template <
class U1,
class U2>
335 template <
class U1,
class U2>
338 template <
class U1,
class U2>
341 template <
class U1,
class U2>
352 #ifdef IP_DEBUG_SMARTPTR
356 #ifdef CHECK_SMARTPTR
358 const ReferencedObject* trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_
360 trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ = 0;
371 #ifdef IP_DEBUG_SMARTPTR
375 #ifdef CHECK_SMARTPTR
377 const ReferencedObject* trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_
379 trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ = 0;
391 #ifdef IP_DEBUG_SMARTPTR
395 #ifdef CHECK_SMARTPTR
397 const ReferencedObject* trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_
399 trying_to_use_SmartPtr_with_an_object_that_does_not_inherit_from_ReferencedObject_ = 0;
408 #ifdef IP_DEBUG_SMARTPTR
419 #ifdef IP_DEBUG_SMARTPTR
424 #if COIN_IPOPT_CHECKLEVEL > 0
436 #ifdef IP_DEBUG_SMARTPTR
441 #if COIN_IPOPT_CHECKLEVEL > 0
453 #ifdef IP_DEBUG_SMARTPTR
457 return SetFromRawPtr_(rhs);
464 #ifdef IP_DEBUG_SMARTPTR
466 "SmartPtr<T>& SmartPtr<T>::operator=(const SmartPtr<T>& rhs)",
470 return SetFromSmartPtr_(rhs);
477 #ifdef IP_DEBUG_SMARTPTR
496 #ifdef IP_DEBUG_SMARTPTR
498 "SmartPtr<T>& SmartPtr<T>::SetFromSmartPtr_(const SmartPtr<T>& rhs)",
517 #ifdef IP_DEBUG_SMARTPTR
519 "void SmartPtr<T>::ReleasePointer()",
524 ptr_->ReleaseRef(
this);
525 if (ptr_->ReferenceCount() == 0) {
536 #ifdef IP_DEBUG_SMARTPTR
538 "T* GetRawPtr(const SmartPtr<T>& smart_ptr)",
542 return smart_ptr.
ptr_;
555 return !
IsNull(smart_ptr);
561 #ifdef IP_DEBUG_SMARTPTR
563 "bool IsNull(const SmartPtr<T>& smart_ptr)",
567 return (smart_ptr.
ptr_ == 0);
571 template <
class U1,
class U2>
574 #ifdef IP_DEBUG_SMARTPTR
576 "bool ComparePtrs(const U1* lhs, const U2* rhs)",
588 const void* v_lhs =
static_cast<const void*
>(lhs);
589 const void* v_rhs =
static_cast<const void*
>(rhs);
590 if (v_lhs == v_rhs) {
598 template <
class U1,
class U2>
601 #ifdef IP_DEBUG_SMARTPTR
603 "bool operator==(const SmartPtr<U1>& lhs, const SmartPtr<U2>& rhs)",
612 template <
class U1,
class U2>
615 #ifdef IP_DEBUG_SMARTPTR
617 "bool operator==(SmartPtr<U1>& lhs, U2* rhs)",
625 template <
class U1,
class U2>
628 #ifdef IP_DEBUG_SMARTPTR
630 "bool operator==(U1* raw_lhs, SmartPtr<U2>& rhs)",
638 template <
class U1,
class U2>
641 #ifdef IP_DEBUG_SMARTPTR
643 "bool operator!=(const SmartPtr<U1>& lhs, const SmartPtr<U2>& rhs)",
651 template <
class U1,
class U2>
654 #ifdef IP_DEBUG_SMARTPTR
656 "bool operator!=(SmartPtr<U1>& lhs, U2* rhs)",
664 template <
class U1,
class U2>
667 #ifdef IP_DEBUG_SMARTPTR
669 "bool operator!=(U1* raw_lhs, SmartPtr<U2>& rhs)",