TimeDistribution.cc
Go to the documentation of this file.
1 
9 #include <utl/TimeDistribution.h>
10 
11 using namespace std;
12 
13 
14 namespace utl {
15 
16  template<typename T>
17  void
18  Print(ostream& os, const TimeDistribution<T>& td)
19  {
20  os << "TD" << (T(0.5) == 0.5 ? 'D' : 'I') << '[' << td.GetBinning() << "]{";
21  bool first = true;
22  for (typename TimeDistribution<T>::SparseIterator it = td.SparseBegin(), end = td.SparseEnd();
23  it != end; ++it) {
24  if (first)
25  first = false;
26  else
27  os << ',';
28  os << it->template get<0>() << ':' << it->template get<1>();
29  }
30  os << '}';
31  }
32 
33 
34  // instantiate
35  template void Print(ostream& os, const TimeDistributionI& td);
36  template void Print(ostream& os, const TimeDistributionD& td);
37 
38 }
39 
40 
41 // Configure (x)emacs for this file ...
42 // Local Variables:
43 // mode: c++
44 // End:
TimeDistribution< double > TimeDistributionD
Histogram class for time distributions with suppressed empty bins.
double GetBinning() const
Size of one slot.
void Print(ostream &os, const TimeDistribution< T > &td)
SparseIterator SparseEnd() const
TimeDistribution< int > TimeDistributionI
SparseIterator SparseBegin() const
Iterator over time slots with data in them (skips empty slots).
boost::transform_iterator< InternalMapFunctor, InternalConstIterator, Tuple > SparseIterator

, generated on Tue Sep 26 2023.