AFF --- A container for numbers (array) by Friederich and Forbriger.
histo.h
Go to the documentation of this file.
1 
35 // include guard
36 #ifndef AFF_HISTO_H_VERSION
37 
38 #define AFF_HISTO_H_VERSION \
39  "AFF_HISTO_H V1.0 "
40 
41 
42 #include<aff/lib/collector.h>
43 #include<map>
44 
45 namespace aff {
46 
47  namespace func {
48 
49  namespace util {
50 
58  template<class C>
59  class Extracthisto {
60  typedef typename C::Tcoc Tcont;
61  typedef typename C::Tvalue Tvalue;
62  public:
63  typedef typename std::map<Tvalue,int> Tmap;
64  typedef Tmap Tretval;
66  Extracthisto(const Tcont& c) { }
68  void operator() (const Tvalue& v)
69  { ++Mmap[v]; }
71  Tretval result() const { return(Mmap); }
72  private:
74  }; // class Extracthisto
75 
76  } // namespace util
77 
78 /*----------------------------------------------------------------------*/
79 
90  template<class C>
92  {
93  return(aff::func::util::collect<C, aff::func::util::Extracthisto>(c));
94  } // histo()
95 
96  } // namespace func
97 
98 } // namespace aff
99 
100 #endif // AFF_HISTO_H_VERSION (includeguard)
101 
102 /* ----- END OF histo.h ----- */
Root namespace of library.
Definition: array.h:148
collect values (prototypes)
void operator()(const Tvalue &v)
collect another value
Definition: histo.h:68
aff::func::util::Extracthisto< C >::Tmap histo(const C &c)
Definition: histo.h:91
Extracthisto(const Tcont &c)
initialize member data
Definition: histo.h:66
std::map< Tvalue, int > Tmap
Definition: histo.h:63
Tretval result() const
return result of operation
Definition: histo.h:71