LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
DataIOmanip.h
Go to the documentation of this file.
1 
12 #ifndef LARDATAOBJ_UTILITIES_DATAIOMANIP_H
13 #define LARDATAOBJ_UTILITIES_DATAIOMANIP_H
14 
15 // C++ standard library
16 #include <iosfwd> // std::ostream
17 #include <utility> // std::forward()
18 
19 
20 namespace util {
21 
22  namespace manip {
23 
24 
25  namespace details {
26 
36  template <typename Vect>
38  Vect const& v;
39 
40  public:
42  Vector3DStruct(Vect const& vector): v(vector) {}
43 
45  template <typename Stream>
46  Stream& operator() (Stream&& out) const
47  {
48  out << "( " << v.X() << " ; " << v.Y() << " ; " << v.Z() << " )";
49  return out;
50  } // operator()
51 
52  }; // class vector3D
53 
55  template <typename Vect>
56  std::ostream& operator<<
57  (std::ostream& out, Vector3DStruct<Vect> const& vmanip)
58  { return vmanip(out); }
59 
60  } // namespace details
61 
62 
79  template <typename Vect>
80  details::Vector3DStruct<Vect> vector3D(Vect const& v) { return { v }; }
81 
82 
83  } // namespace manip
84 
85 
86 } // namespace util
87 
88 
89 #endif // LARDATAOBJ_UTILITIES_DATAIOMANIP_H
Namespace for general, non-LArSoft-specific utilities.
Definition: PIDAAlg.h:17
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
details::Vector3DStruct< Vect > vector3D(Vect const &v)
Produces a manipulator to print a vector.
Definition: DataIOmanip.h:80
Vector3DStruct(Vect const &vector)
Constructor: print the specified vector.
Definition: DataIOmanip.h:42
Stream & operator()(Stream &&out) const
The printing operator.
Definition: DataIOmanip.h:46
Utility class to store and print a 3D vector.
Definition: DataIOmanip.h:37
Vect const & v
Vector to be printed.
Definition: DataIOmanip.h:38