#ifndef __JCOMPAREHISTOGRAMS__JRESULTTITLE_T__ #define __JCOMPAREHISTOGRAMS__JRESULTTITLE_T__ #include #include "Jeep/JPrint.hh" #include "Jeep/JProperties.hh" /** * \author rgruiz */ namespace JCOMPAREHISTOGRAMS {} namespace JPP { using namespace JCOMPAREHISTOGRAMS; } namespace JCOMPAREHISTOGRAMS { using JEEP::JProperties; /** * Class dedicated to standardize the title of the graphical objects produced by the JTest_t() derived classes. */ class JResultTitle { public: /** * Default constructor */ JResultTitle() {} /** * Constructor * * \param testName Test name * \param parameterName Name of the parameter used to decide if the test passes. * \param passed True if the test passes, false if it fails. * \param value Value of the parameter used to decide if the test passes. */ JResultTitle(const std::string& testName, const std::string& parameterName, const bool passed, const double value): testName (testName), parameterName (parameterName), passed (passed ? "TRUE" : "FALSE"), value (value) {} /** * Returns a standard string to be used as title of a graphical root object. */ std::string getTitle() const { return MAKE_STRING(getProperties(*this)); } /** * Stream input. * * \param in input stream * \param title result title * \return input stream */ friend inline std::istream& operator>>(std::istream& in, JResultTitle& title) { return in >> getProperties(title); } /** * Stream output. * * \param out output stream * \param title result title * \return output stream */ friend inline std::ostream& operator<<(std::ostream& out, const JResultTitle& title) { return out << getProperties(title); } std::string testName; /*!< Test name. */ std::string parameterName; /*!< Name of the parameter used to evaluate the test. */ std::string passed; /*!< Human readable version of "passed". */ double value; /*!< Value of the parameter used to evaluate the test.*/ private: /** * Get properties of this class. * * \param object result title object * \return properties */ template static inline JProperties getProperties(JResultTitle_t& object) { JProperties properties; properties.setEndOfLine(":"); properties.insert(gmake_property(object.testName)); properties.insert(gmake_property(object.parameterName)); properties.insert(gmake_property(object.passed)); properties.insert(gmake_property(object.value)); return properties; } }; } #endif