LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 namespace util {
20 
21  namespace manip {
22 
23  namespace details {
24 
34  template <typename Vect>
36  Vect const& v;
37 
38  public:
40  Vector3DStruct(Vect const& vector) : v(vector) {}
41 
43  template <typename Stream>
44  Stream& operator()(Stream&& out) const
45  {
46  out << "( " << v.X() << " ; " << v.Y() << " ; " << v.Z() << " )";
47  return out;
48  } // operator()
49 
50  }; // class vector3D
51 
53  template <typename Vect>
54  std::ostream& operator<<(std::ostream& out, Vector3DStruct<Vect> const& vmanip)
55  {
56  return vmanip(out);
57  }
58 
59  } // namespace details
60 
77  template <typename Vect>
79  {
80  return {v};
81  }
82 
83  } // namespace manip
84 
85 } // namespace util
86 
87 #endif // LARDATAOBJ_UTILITIES_DATAIOMANIP_H
Namespace for general, non-LArSoft-specific utilities.
Definition: PIDAAlg.h:26
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
details::Vector3DStruct< Vect > vector3D(Vect const &v)
Produces a manipulator to print a vector.
Definition: DataIOmanip.h:78
Vector3DStruct(Vect const &vector)
Constructor: print the specified vector.
Definition: DataIOmanip.h:40
Stream & operator()(Stream &&out) const
The printing operator.
Definition: DataIOmanip.h:44
Utility class to store and print a 3D vector.
Definition: DataIOmanip.h:35
Vect const & v
Vector to be printed.
Definition: DataIOmanip.h:36