DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
L1LengthEstimator.ih
1 
30 
31 #include <cstdlib>
33 
35 // IMPLEMENTATION of inline methods.
37 
39 // ----------------------- Standard services ------------------------------
40 
44 template <typename T>
45 inline
47 {
48  myIsInitBefore = false;
49 }
50 
54 template <typename T>
55 inline
57 {
58 }
59 
60 
61 
63 // Interface - public :
64 
65 
66 
67 template <typename T>
68 inline
69 void
71  const ConstIterator& itb,
72  const ConstIterator& ite)
73 {
74  myH = h;
75  myBeginIt = itb;
76  myEndIt = ite;
77  myIsInitBefore = true;
78 }
79 
80 template <typename T>
81 inline
84 {
85  ASSERT(myH > 0);
86  ASSERT(myIsInitBefore);
87 
88  Quantity val = 0;
89 
90  if ( DGtal::isNotEmpty(myBeginIt,myEndIt) )
91  {
92  ConstIterator i = myBeginIt;
93  do
94  {
95  val += 1.0;
96  ++i;
97  }
98  while (i != myEndIt);
99  }
100 
101 
102  return val*myH;
103 }
104 
105 
106 
107 
108 
113 template <typename T>
114 inline
115 void
116 DGtal::L1LengthEstimator<T>::selfDisplay ( std::ostream & out ) const
117 {
118  out << "[L1LengthEstimator]";
119  if (myIsInitBefore)
120  out <<" myH="<<myH;
121  else
122  out<< " not initialized";
123 }
124 
129 template <typename T>
130 inline
131 bool
133 {
134  return myIsInitBefore;
135 }
136 
137 
138 
140 // Implementation of inline functions //
141 
142 template <typename T>
143 inline
144 std::ostream&
145 DGtal::operator<< ( std::ostream & out,
146  const L1LengthEstimator<T> & object )
147 {
148  object.selfDisplay( out );
149  return out;
150 }
151 
152 // //
154 
155