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
edm
HLT enums.
Definition: AlignableModifier.h:19
OStreamColumn
edm::OStreamColumnEntry::col
OStreamColumn const & col
Definition: OStreamColumn.h:49
edm::OStreamColumn::operator()
auto operator()(T const &t) const
Definition: OStreamColumn.h:59
edm::operator<<
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
Definition: HLTGlobalStatus.h:106
edm::OStreamColumn::title_
std::string title_
Definition: OStreamColumn.h:66
w
const double w
Definition: UKUtility.cc:23
edm::OStreamColumnEntry::t
T t
Definition: OStreamColumn.h:50
edm::OStreamColumn::operator<<
friend std::ostream & operator<<(std::ostream &, OStreamColumn const &)
Definition: OStreamColumn.cc:12
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::OStreamColumnEntry
Definition: OStreamColumn.h:48
edm::OStreamColumn::width_
std::size_t width_
Definition: OStreamColumn.h:67
edm::OStreamColumn
Definition: OStreamColumn.h:53
edm::OStreamColumn::width
std::size_t width() const
Definition: OStreamColumn.h:63
T
long double T
Definition: Basic3DVectorLD.h:48
edm::OStreamColumn::OStreamColumn
OStreamColumn(std::string const &t)
Definition: OStreamColumn.cc:7
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644