Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JResultTitle.hh
Go to the documentation of this file.
1#ifndef __JCOMPAREHISTOGRAMS__JRESULTTITLE_T__
2#define __JCOMPAREHISTOGRAMS__JRESULTTITLE_T__
3
4#include <string>
5
6#include "Jeep/JPrint.hh"
7#include "Jeep/JProperties.hh"
8
9
10/**
11 * \author rgruiz
12 */
13
15namespace JPP { using namespace JCOMPAREHISTOGRAMS; }
16
17namespace JCOMPAREHISTOGRAMS {
18
20
21
22 /**
23 * Class dedicated to standardize the title of the graphical objects produced by the JTest_t() derived classes.
24 */
26 {
27 public:
28 /**
29 * Default constructor
30 */
32 {}
33
34
35 /**
36 * Constructor
37 *
38 * \param testName Test name
39 * \param parameterName Name of the parameter used to decide if the test passes.
40 * \param passed True if the test passes, false if it fails.
41 * \param value Value of the parameter used to decide if the test passes.
42 */
43 JResultTitle(const std::string& testName,
44 const std::string& parameterName,
45 const bool passed,
46 const double value):
49 passed (passed ? "TRUE" : "FALSE"),
50 value (value)
51 {}
52
53
54 /**
55 * Returns a standard string to be used as title of a graphical root object.
56 */
57 std::string getTitle() const
58 {
59 return MAKE_STRING(getProperties(*this));
60 }
61
62
63 /**
64 * Stream input.
65 *
66 * \param in input stream
67 * \param title result title
68 * \return input stream
69 */
70 friend inline std::istream& operator>>(std::istream& in, JResultTitle& title)
71 {
72 return in >> getProperties(title);
73 }
74
75
76 /**
77 * Stream output.
78 *
79 * \param out output stream
80 * \param title result title
81 * \return output stream
82 */
83 friend inline std::ostream& operator<<(std::ostream& out, const JResultTitle& title)
84 {
85 return out << getProperties(title);
86 }
87
88
89 std::string testName; /*!< Test name. */
90 std::string parameterName; /*!< Name of the parameter used to evaluate the test. */
91 std::string passed; /*!< Human readable version of "passed". */
92 double value; /*!< Value of the parameter used to evaluate the test.*/
93
94
95 private:
96 /**
97 * Get properties of this class.
98 *
99 * \param object result title object
100 * \return properties
101 */
102 template<class JResultTitle_t>
103 static inline JProperties getProperties(JResultTitle_t& object)
104 {
105 JProperties properties;
106
107 properties.setEndOfLine(":");
108
109 properties.insert(gmake_property(object.testName));
110 properties.insert(gmake_property(object.parameterName));
111 properties.insert(gmake_property(object.passed));
112 properties.insert(gmake_property(object.value));
113
114 return properties;
115 }
116 };
117}
118
119#endif
I/O formatting auxiliaries.
#define MAKE_STRING(A)
Make string.
Definition JPrint.hh:63
Utility class to parse parameter values.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Class dedicated to standardize the title of the graphical objects produced by the JTest_t() derived c...
friend std::istream & operator>>(std::istream &in, JResultTitle &title)
Stream input.
JResultTitle(const std::string &testName, const std::string &parameterName, const bool passed, const double value)
Constructor.
JResultTitle()
Default constructor.
friend std::ostream & operator<<(std::ostream &out, const JResultTitle &title)
Stream output.
static JProperties getProperties(JResultTitle_t &object)
Get properties of this class.
std::string getTitle() const
Returns a standard string to be used as title of a graphical root object.
Utility class to parse parameter values.
void setEndOfLine(const std::string &eol)
Set end of line characters.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).