The Gaudi Framework  v33r1 (b1225454)
Printer.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDIPYTHON_PRINTER_H
12 #define GAUDIPYTHON_PRINTER_H 1
13 // ============================================================================
14 // Include files
15 // ============================================================================
16 // STD & STL
17 // ============================================================================
18 #include <sstream>
19 #include <string>
20 // ============================================================================
21 // GaudiKernel
22 // ============================================================================
24 #include "GaudiKernel/DataObject.h"
25 // ============================================================================
26 
27 namespace GaudiPython {
34  template <class TYPE>
35  struct Printer {
36  static std::string print( const TYPE& object ) {
37  std::stringstream stream;
38  stream << object << std::endl;
39  return stream.str();
40  };
41  };
42  template <>
44  static std::string print( const ContainedObject& object ) {
45  std::ostringstream stream;
46  object.fillStream( stream );
47  return stream.str();
48  };
49  };
50  template <>
51  struct Printer<DataObject> {
52  static std::string print( const DataObject& type ) {
53  std::ostringstream stream;
54  type.fillStream( stream );
55  return stream.str();
56  };
57  };
58 
59 } // end of namespace GaudiPython
60 
61 #endif // GAUDIPYTHON_PRINTER_H
T endl(T... args)
STL class.
static std::string print(const ContainedObject &object)
Definition: Printer.h:44
T str(T... args)
static std::string print(const DataObject &type)
Definition: Printer.h:52
GaudiPython.h GaudiPython/GaudiPython.h.
Definition: AlgDecorators.h:47
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
static std::string print(const TYPE &object)
Definition: Printer.h:36
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:40