DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CountedPtr.ih
1 
30 
31 #include <cstdlib>
33 
35 // IMPLEMENTATION of inline methods.
37 
39 // ----------------------- Standard services ------------------------------
40 
41 
43 // Interface - public :
44 
49 template <typename T>
50 inline
51 void
52 DGtal::CountedPtr<T>::selfDisplay ( std::ostream & out ) const
53 {
54  if (isValid())
55  out << "[CountedPtr nbcounts=" << myCounter->count << "]";
56  else
57  out << "[CountedPtr to NULL]";
58 }
59 
64 template <typename T>
65 inline
66 bool
68 {
69  return myCounter;
70 }
71 
72 
73 
75 // Implementation of inline functions //
76 
77 template <typename T>
78 inline
79 std::ostream&
80 DGtal::operator<< ( std::ostream & out,
81  const CountedPtr<T> & object )
82 {
83  object.selfDisplay( out );
84  return out;
85 }
86 
87 // //
89 
90