DGtal  0.9.2
Profile.h
1 
17 #pragma once
18 
33 #if defined(Profile_RECURSES)
34 #error Recursive header files inclusion detected in Profile.h
35 #else // defined(Profile_RECURSES)
36 
37 #define Profile_RECURSES
38 
39 #if !defined Profile_h
40 
41 #define Profile_h
42 
44 // Inclusions
45 #include <iostream>
46 #include <vector>
47 #include "DGtal/math/Statistic.h"
48 
49 #include "DGtal/base/Common.h"
51 
52 namespace DGtal
53 {
54 
56  // class Profile
136  template<typename TValueFunctor = functors::Identity, typename TValue = double >
137  class Profile
138  {
139  // ----------------------- Standard services ------------------------------
140  public:
141 
148 
152  typedef TValueFunctor Functor;
153 
157  typedef TValue Value;
158 
160 
161 
165  ~Profile();
166 
170  Profile();
171 
172 
177  Profile(ProfileType type);
178 
179 
184  Profile( const Profile & other );
185 
186 
193  Profile & operator= ( const Profile & other );
194 
195 
196 
200  void clear();
201 
202 
203 
214  template <typename Iterator>
215  void init( Iterator beginXvalues, Iterator endXvalues,
216  const bool storeValsInStats=false );
217 
218 
219 
228  void init( const unsigned int nb, const bool storeValsInStats=false );
229 
230 
237  void addValue( const unsigned int indexX, const TValue value );
238 
239 
247  void addStatistic( const unsigned int indexX, const Statistic<Value> & stat );
248 
249 
250 
268  void stopStatsSaving() ;
269 
270 
271 
272 
273  // ----------------------- Profile services --------------------------------
274  public:
275 
282  void setType(const ProfileType type);
283 
284 
285 
293  void getProfile( std::vector<Value> & x,
294  std::vector<Value> & y ) const;
295 
296 
297 
298 
299 
300 
301  // ----------------------- Interface --------------------------------------
302  public:
303 
308  void selfDisplay ( std::ostream & out ) const;
309 
314  bool isValid() const;
315 
316  // ------------------------- Protected Datas ------------------------------
317  private:
318  // ------------------------- Private Datas --------------------------------
319  private:
320 
321  Functor myFunctor;
322 
326  std::vector<Value>* myXsamples;
327 
331  std::vector< Statistic<Value> >* myStats;
332 
338 
339 
340 
348 
349 
350 
351  // ------------------------- Hidden services ------------------------------
352  protected:
353 
354 
355  private:
356 
357 
358 
359 
360  // ------------------------- Internals ------------------------------------
361  private:
362 
363  }; // end of class Profile
364 
365 
372  template< typename TValueFunctor, typename TValue >
373  std::ostream&
374  operator<< ( std::ostream & out, const Profile<TValueFunctor, TValue> & object );
375 
376 
377 } // namespace DGtal
378 
379 
381 // Includes inline functions.
382 #if !defined(BUILD_INLINE)
383 #include "DGtal/math/Profile.ih"
384 #endif
385 
386 
387 // //
389 
390 #endif // !defined Profile_h
391 
392 #undef Profile_RECURSES
393 #endif // else defined(Profile_RECURSES)
void getProfile(std::vector< Value > &x, std::vector< Value > &y) const
ProfileType myProfileDef
Definition: Profile.h:337
void addStatistic(const unsigned int indexX, const Statistic< Value > &stat)
void setType(const ProfileType type)
void selfDisplay(std::ostream &out) const
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:89
bool myStoreValInStats
Definition: Profile.h:347
std::vector< Statistic< Value > > * myStats
Definition: Profile.h:331
void addValue(const unsigned int indexX, const TValue value)
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: This class can be used to represent a profile (PX, PY) defined from an input set of samples (Xi...
Definition: Profile.h:137
Profile & operator=(const Profile &other)
bool isValid() const
void init(Iterator beginXvalues, Iterator endXvalues, const bool storeValsInStats=false)
void stopStatsSaving()
TValueFunctor Functor
Definition: Profile.h:152
std::vector< Value > * myXsamples
Definition: Profile.h:326
Functor myFunctor
Definition: Profile.h:321
TValue Value
Definition: Profile.h:157
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< Functor, Value, Value >))