Program Listing for File XMLStateWriter.h
↰ Return to documentation for file (include/flamegpu/io/XMLStateWriter.h
)
#ifndef INCLUDE_FLAMEGPU_IO_XMLSTATEWRITER_H_
#define INCLUDE_FLAMEGPU_IO_XMLSTATEWRITER_H_
#include <memory>
#include <string>
#include <unordered_map>
#include "flamegpu/io/StateWriter.h"
#include "flamegpu/model/ModelDescription.h"
#include "flamegpu/util/StringPair.h"
namespace tinyxml2 {
class XMLDocument;
class XMLNode;
}
namespace flamegpu {
namespace io {
class XMLStateWriter : public StateWriter {
public:
XMLStateWriter();
bool isWriting() override { return doc || pRoot; }
void beginWrite(const std::string &output_file, bool pretty_print) override;
void endWrite() override;
void writeConfig(const Simulation *sim_instance) override;
void writeStats(unsigned int iterations) override;
void writeEnvironment(const std::shared_ptr<const detail::EnvironmentManager>& env_manager) override;
void writeMacroEnvironment(const std::shared_ptr<const detail::CUDAMacroEnvironment>& macro_env, std::initializer_list<std::string> filter = {}) override;
void writeAgents(const util::StringPairUnorderedMap<std::shared_ptr<const AgentVector>>& agents_map) override;
private:
std::unique_ptr<tinyxml2::XMLDocument> doc;
tinyxml2::XMLNode* pRoot = nullptr;
bool config_written = false;
bool stats_written = false;
bool environment_written = false;
bool macro_environment_written = false;
bool agents_written = false;
std::string outputPath;
bool prettyPrint;
};
} // namespace io
} // namespace flamegpu
#endif // INCLUDE_FLAMEGPU_IO_XMLSTATEWRITER_H_