CMS 3D CMS Logo

OStreamColumn.h
Go to the documentation of this file.
1 #ifndef FWCore_Utilities_interface_OStreamColumn_h
2 #define FWCore_Utilities_interface_OStreamColumn_h
3 
4 // -*- C++ -*-
5 //
6 // Package: Utilities
7 // Class : OStreamColumn
8 //
34 //
35 // Original Author: Kyle Knoepfel
36 // Created:
37 // $Id$
38 //
39 
40 #include <iomanip>
41 #include <string>
42 
43 namespace edm {
44 
45  class OStreamColumn;
46 
47  template <typename T>
50  T t;
51  };
52 
53  class OStreamColumn {
54  public:
55  explicit OStreamColumn(std::string const& t);
56  explicit OStreamColumn(std::string const& t, std::size_t const w);
57 
58  template <typename T>
59  auto operator()(T const& t) const
60  {
61  return OStreamColumnEntry<T>{*this, t};
62  }
63 
64  std::size_t width() const { return width_; }
65 
66  private:
68  std::size_t width_;
69 
70  friend std::ostream& operator<<(std::ostream&, OStreamColumn const&);
71 
72  template <typename E>
73  friend std::ostream& operator<<(std::ostream&, OStreamColumnEntry<E> const&);
74  };
75 
76  std::ostream& operator<<(std::ostream& t, OStreamColumn const& c);
77 
78  template <typename E>
79  std::ostream& operator<<(std::ostream& t, OStreamColumnEntry<E> const& ce)
80  {
81  t << std::setw(ce.col.width_) << ce.t;
82  return t;
83  }
84 
85 }
86 
87 #endif
const double w
Definition: UKUtility.cc:23
OStreamColumn const & col
Definition: OStreamColumn.h:49
std::string title_
Definition: OStreamColumn.h:67
std::size_t width() const
Definition: OStreamColumn.h:64
auto operator()(T const &t) const
Definition: OStreamColumn.h:59
std::size_t width_
Definition: OStreamColumn.h:68
HLT enums.
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
long double T