DGtal  1.5.beta
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)
37 #define Profile_RECURSES
38 
39 #if !defined Profile_h
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
135  template<typename TValueFunctor = functors::Identity, typename TValue = double >
136  class Profile
137  {
138  // ----------------------- Standard services ------------------------------
139  public:
140 
147 
151  typedef TValueFunctor Functor;
152 
156  typedef TValue Value;
157 
159 
160 
165 
170 
171 
177 
178 
183  Profile( const Profile & other );
184 
185 
192  Profile & operator= ( const Profile & other );
193 
194 
195 
199  void clear();
200 
201 
202 
213  template <typename Iterator>
214  void init( Iterator beginXvalues, Iterator endXvalues,
215  const bool storeValsInStats=false );
216 
217 
218 
227  void init( const unsigned int nb, const bool storeValsInStats=false );
228 
229 
236  void addValue( const unsigned int indexX, const TValue value );
237 
238 
246  void addStatistic( const unsigned int indexX, const Statistic<Value> & stat );
247 
248 
249 
267  void stopStatsSaving() ;
268 
269 
270 
271 
272  // ----------------------- Profile services --------------------------------
273  public:
274 
281  void setType(const ProfileType type);
282 
283 
284 
292  void getProfile( std::vector<Value> & x,
293  std::vector<Value> & y ) const;
294 
295 
296 
297 
298 
299 
300  // ----------------------- Interface --------------------------------------
301  public:
302 
307  void selfDisplay ( std::ostream & out ) const;
308 
313  bool isValid() const;
314 
315  // ------------------------- Protected Datas ------------------------------
316  private:
317  // ------------------------- Private Datas --------------------------------
318  private:
319 
321 
325  std::vector<Value>* myXsamples;
326 
330  std::vector< Statistic<Value> >* myStats;
331 
337 
338 
339 
347 
348 
349 
350  // ------------------------- Hidden services ------------------------------
351  protected:
352 
353 
354  private:
355 
356 
357 
358 
359  // ------------------------- Internals ------------------------------------
360  private:
361 
362  }; // end of class Profile
363 
364 
371  template< typename TValueFunctor, typename TValue >
372  std::ostream&
373  operator<< ( std::ostream & out, const Profile<TValueFunctor, TValue> & object );
374 
375 
376 } // namespace DGtal
377 
378 
380 // Includes inline functions.
381 #if !defined(BUILD_INLINE)
382 #include "DGtal/math/Profile.ih"
383 #endif
384 
385 
386 // //
388 
389 #endif // !defined Profile_h
390 
391 #undef Profile_RECURSES
392 #endif // else defined(Profile_RECURSES)
Aim: This class can be used to represent a profile (PX, PY) defined from an input set of samples (Xi,...
Definition: Profile.h:137
void getProfile(std::vector< Value > &x, std::vector< Value > &y) const
Profile(const Profile &other)
BOOST_CONCEPT_ASSERT((concepts::CUnaryFunctor< Functor, Value, Value >))
std::vector< Statistic< Value > > * myStats
Definition: Profile.h:330
Functor myFunctor
Definition: Profile.h:320
Profile(ProfileType type)
void stopStatsSaving()
Profile & operator=(const Profile &other)
void addStatistic(const unsigned int indexX, const Statistic< Value > &stat)
TValue Value
Definition: Profile.h:156
std::vector< Value > * myXsamples
Definition: Profile.h:325
bool isValid() const
bool myStoreValInStats
Definition: Profile.h:346
void init(const unsigned int nb, const bool storeValsInStats=false)
void addValue(const unsigned int indexX, const TValue value)
void selfDisplay(std::ostream &out) const
TValueFunctor Functor
Definition: Profile.h:151
ProfileType myProfileDef
Definition: Profile.h:336
void init(Iterator beginXvalues, Iterator endXvalues, const bool storeValsInStats=false)
void setType(const ProfileType type)
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)
Aim: Defines a unary functor, which associates arguments to results.
Definition: CUnaryFunctor.h:90