sisi4s
Loading...
Searching...
No Matches
Emitter.hpp
Go to the documentation of this file.
1#ifndef EMITTER_DEFINED
2#define EMITTER_DEFINED
3
5
6#include <string>
7#include <yaml-cpp/yaml.h>
8
9namespace sisi4s {
14class Emitter {
15public:
16 static void setRank(const int rank);
17 static int getRank();
18 static YAML::Emitter &getEmitter();
19 static void flush();
20 static void setFileName(const std::string &);
21
22protected:
23 static int rank;
24 static std::string fileName;
25 static PTR(std::ofstream) yamlFile;
26 static PTR(YAML::Emitter) yamlEmitter;
27};
28} // namespace sisi4s
29
30#define EMIT(...) \
31 if (sisi4s::Emitter::getRank() != 0) { \
32 } else sisi4s::Emitter::getEmitter()
33#define EMIT_FLUSH(...) \
34 if (sisi4s::Emitter::getRank() != 0) { \
35 } else sisi4s::Emitter::flush()
36
37#endif
#define PTR(TYPE)
Definition SharedPointer.hpp:8
Class with static members offering control over yaml emitting. Entries are emitted with the macro EMI...
Definition Emitter.hpp:14
static void flush()
Definition Emitter.cxx:28
static void setFileName(const std::string &)
Definition Emitter.cxx:17
static std::shared_ptr< std::ofstream > yamlFile
Definition Emitter.hpp:25
static int getRank()
Definition Emitter.cxx:15
static std::shared_ptr< YAML::Emitter > yamlEmitter
Definition Emitter.hpp:26
static std::string fileName
Definition Emitter.hpp:24
static YAML::Emitter & getEmitter()
Definition Emitter.cxx:19
static void setRank(const int rank)
Definition Emitter.cxx:13
static int rank
Definition Emitter.hpp:23
Definition Algorithm.hpp:10