Program Listing for File XMLLogger.h

Return to documentation for file (include/flamegpu/io/XMLLogger.h)

#ifndef INCLUDE_FLAMEGPU_IO_XMLLOGGER_H_
#define INCLUDE_FLAMEGPU_IO_XMLLOGGER_H_

#include <string>
#include <typeindex>

#include "flamegpu/io/Logger.h"
#include "flamegpu/detail/Any.h"

namespace tinyxml2 {
class XMLNode;
class XMLDocument;
class XMLElement;
}  // namespace tinyxml2

namespace flamegpu {

struct RunLog;
struct StepLogFrame;
struct ExitLogFrame;
struct LogFrame;
class RunPlan;

namespace io {
class XMLLogger : public Logger{
 public:
    XMLLogger(const std::string &outPath, bool prettyPrint, bool truncateFile);
    void log(const RunLog &log, const RunPlan &plan, bool logSteps = true, bool logExit = true, bool logStepTime = false, bool logExitTime = false) const override;
    void log(const RunLog &log, bool logConfig = true, bool logSteps = true, bool logExit = true, bool logStepTime = false, bool logExitTime = false) const override;

 private:
    void logCommon(const RunLog &log, const RunPlan *plan, bool logConfig, bool logSteps, bool logExit, bool logStepTime, bool logExitTime) const;
    tinyxml2::XMLNode *logConfig(tinyxml2::XMLDocument &doc, const RunLog &log) const;
    tinyxml2::XMLNode *logConfig(tinyxml2::XMLDocument &doc, const RunPlan &plan) const;
    tinyxml2::XMLNode* logPerformanceSpecs(tinyxml2::XMLDocument& doc, const RunLog& log) const;
    tinyxml2::XMLNode *logSteps(tinyxml2::XMLDocument &doc, const RunLog &log, bool logTime) const;
    tinyxml2::XMLNode *logExit(tinyxml2::XMLDocument &doc, const RunLog &log, bool logTime) const;
    tinyxml2::XMLNode *writeLogFrame(tinyxml2::XMLDocument &doc, const StepLogFrame &log, bool logTime) const;
    tinyxml2::XMLNode* writeLogFrame(tinyxml2::XMLDocument& doc, const ExitLogFrame& log, bool logTime) const;
    void writeCommonLogFrame(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* pFrameElement, const LogFrame& frame) const;
    void writeAny(tinyxml2::XMLElement *element, const detail::Any &value, unsigned int elements = 1) const;

    std::string out_path;
    bool prettyPrint;
    bool truncateFile;
};
}  // namespace io
}  // namespace flamegpu

#endif  // INCLUDE_FLAMEGPU_IO_XMLLOGGER_H_