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  return OStreamColumnEntry<T>{*this, t};
61  }
62 
63  std::size_t width() const { return width_; }
64 
65  private:
67  std::size_t width_;
68 
69  friend std::ostream& operator<<(std::ostream&, OStreamColumn const&);
70 
71  template <typename E>
72  friend std::ostream& operator<<(std::ostream&, OStreamColumnEntry<E> const&);
73  };
74 
75  std::ostream& operator<<(std::ostream& t, OStreamColumn const& c);
76 
77  template <typename E>
78  std::ostream& operator<<(std::ostream& t, OStreamColumnEntry<E> const& ce) {
79  t << std::setw(ce.col.width_) << ce.t;
80  return t;
81  }
82 
83 } // namespace edm
84 
85 #endif
OStreamColumn const & col
Definition: OStreamColumn.h:49
T w() const
std::string title_
Definition: OStreamColumn.h:66
OStreamColumn(std::string const &t)
Definition: OStreamColumn.cc:7
std::size_t width() const
Definition: OStreamColumn.h:63
auto operator()(T const &t) const
Definition: OStreamColumn.h:59
std::size_t width_
Definition: OStreamColumn.h:67
HLT enums.
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger table.
long double T
friend std::ostream & operator<<(std::ostream &, OStreamColumn const &)