21 namespace ns_yaml_cpp03
49 emitter_->SetDoublePrecision(std::numeric_limits<double>::digits10);
50 if (output_stream_->tellp() != 0)
52 *emitter_ << YAML::Newline;
54 *emitter_ << YAML::BeginMap;
56 skip_root_map_ =
false;
62 *emitter_ << YAML::EndMap;
63 *output_stream_ << emitter_->c_str();
69 explicit Writer(
const std::string &file_name)
72 output_stream_ = &config_ofs_;
77 explicit Writer(std::ostream &output_stream)
79 output_stream_ = &output_stream;
87 *output_stream_ <<
"\n";
88 output_stream_->flush();
99 namespace ns_yaml_cpp03
116 *
impl_->emitter_ << YAML::Key << map_name;
117 *
impl_->emitter_ << YAML::Value;
123 if (
impl_->map_depth_ > 0 or
false ==
impl_->skip_root_map_)
125 *
impl_->emitter_ << YAML::BeginMap;
133 ARILES_ASSERT(
impl_->map_depth_ > 0,
"Internal logic error.");
135 if (
impl_->map_depth_ > 0 or
false ==
impl_->skip_root_map_)
137 *
impl_->emitter_ << YAML::EndMap;
154 *
impl_->emitter_ << YAML::Flow;
156 *
impl_->emitter_ << YAML::BeginSeq;
161 *
impl_->emitter_ << YAML::EndSeq;
168 if (
true == name.empty())
170 impl_->skip_root_map_ =
true;
181 if (
false == name.empty())
185 impl_->skip_root_map_ =
false;
189 #define ARILES_BASIC_TYPE(type) \ 190 void Writer::writeElement(const type &element) \ 192 *impl_->emitter_ << element; \ 197 #undef ARILES_BASIC_TYPE 200 #define ARILES_BASIC_TYPE(type) \ 201 void Writer::writeElement(const type &element) \ 203 if (true == ariles::isNaN(element)) \ 205 *impl_->emitter_ << ".nan"; \ 209 if (true == ariles::isInfinity(element)) \ 213 *impl_->emitter_ << "-.inf"; \ 217 *impl_->emitter_ << ".inf"; \ 222 *impl_->emitter_ << element; \ 229 #undef ARILES_BASIC_TYPE 233 void Writer::writeElement(
const std::string &element)
235 *
impl_->emitter_ << element;
238 void Writer::writeElement(
const bool &element)
240 *
impl_->emitter_ << element;
#define ARILES_BASIC_INTEGER_TYPES_LIST
#define ARILES_TRACE_FUNCTION
void startMap(const std::size_t)
ARILES_MACRO_SUBSTITUTE(ARILES_BASIC_INTEGER_TYPES_LIST) ARILES_MACRO_SUBSTITUTE(ARILES_BASIC_REAL_TYPES_LIST) void Writer
void startArray(const std::size_t, const bool compact=false)
std::ostream * output_stream_
output stream
ARILES_SHARED_PTR< YAML::Emitter > EmitterPtr
Writer(const std::string &file_name)
void endRoot(const std::string &name)
EmitterPtr emitter_
instance of YAML emitter, is destroyed and reinitialized by flush()
void startRoot(const std::string &name)
void descend(const std::string &map_name)
Starts a nested map in the configuration file.
Writer(std::ostream &output_stream)
static void openFile(std::ofstream &config_ofs, const std::string &file_name)
open configuration file
std::ofstream config_ofs_
output file stream
#define ARILES_BASIC_REAL_TYPES_LIST
Writer(const std::string &file_name)
#define ARILES_VISIBILITY_ATTRIBUTE
ARILES_SHARED_PTR< t_Implementation > ImplPtr