30#ifndef __igtlSmartPointer_h
31#define __igtlSmartPointer_h
55template <
class TObjectType>
67 m_Pointer(p.m_Pointer)
93 {
return m_Pointer != 0; }
95 {
return m_Pointer == 0; }
100 bool operator == ( R r )
const
101 {
return (m_Pointer ==
static_cast<const ObjectType*
>(r) ); }
103 template <
typename R>
104 bool operator != ( R r )
const
105 {
return (m_Pointer !=
static_cast<const ObjectType*
>(r) ); }
109 {
return m_Pointer; }
113 {
return (
void*)m_Pointer < (
void*) r.m_Pointer; }
117 {
return (
void*)m_Pointer > (
void*) r.m_Pointer; }
121 {
return (
void*)m_Pointer <= (
void*) r.m_Pointer; }
125 {
return (
void*)m_Pointer >= (
void*) r.m_Pointer; }
139 if ( tmp ) { tmp->UnRegister(); }
149 (*m_Pointer).Print(os);
156 ObjectType* m_Pointer;
160 if(m_Pointer) { m_Pointer->Register(); }
165 if(m_Pointer) { m_Pointer->UnRegister(); }
Implements transparent reference counting.
ObjectType * GetPointer() const
SmartPointer(ObjectType *p)
ObjectType * Print(std::ostream &os) const
SmartPointer(const SmartPointer< ObjectType > &p)
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...
std::ostream & operator<<(std::ostream &os, SmartPointer< T > p)