Loading...
Searching...
No Matches
gpr::track::JsonRecord Class Reference

A JSON object assembled field by field; one line of a record stream. More...

#include <gpr/auxiliary/MlflowFileStore.h>

Public Member Functions

JsonRecord & add (std::string_view key, double value)
JsonRecord & add (std::string_view key, long value)
JsonRecord & add (std::string_view key, int value)
JsonRecord & add (std::string_view key, bool value)
JsonRecord & add (std::string_view key, std::string_view value)
JsonRecord & add (std::string_view key, const char *value)
JsonRecord & add (std::string_view key, const Eigen::VectorXd &value)
JsonRecord & add (std::string_view key, const Eigen::MatrixXd &value)
JsonRecord & addRaw (std::string_view key, std::string_view json)
 A nested object, already rendered.
std::string str () const

Detailed Description

A JSON object assembled field by field; one line of a record stream.

Definition at line 21 of file MlflowFileStore.h.

Member Function Documentation

◆ add() [1/8]

JsonRecord & gpr::track::JsonRecord::add ( std::string_view key,
bool value )

Definition at line 336 of file MlflowFileStore.cpp.

337{
338 separator(key);
339 out_ << (value ? "true" : "false");
340 return *this;
341}

◆ add() [2/8]

JsonRecord & gpr::track::JsonRecord::add ( std::string_view key,
const char * value )
inline

Definition at line 31 of file MlflowFileStore.h.

32 {
33 return add(key, std::string_view(value));
34 }
JsonRecord & add(std::string_view key, double value)

◆ add() [3/8]

JsonRecord & gpr::track::JsonRecord::add ( std::string_view key,
const Eigen::MatrixXd & value )

Definition at line 360 of file MlflowFileStore.cpp.

361{
362 separator(key);
363 out_ << '[';
364 for (Eigen::Index r = 0; r < value.rows(); ++r) {
365 out_ << (r ? ",[" : "[");
366 for (Eigen::Index c = 0; c < value.cols(); ++c)
367 out_ << (c ? "," : "") << jsonNumber(value(r, c));
368 out_ << ']';
369 }
370 out_ << ']';
371 return *this;
372}

◆ add() [4/8]

JsonRecord & gpr::track::JsonRecord::add ( std::string_view key,
const Eigen::VectorXd & value )

Definition at line 350 of file MlflowFileStore.cpp.

351{
352 separator(key);
353 out_ << '[';
354 for (Eigen::Index i = 0; i < value.size(); ++i)
355 out_ << (i ? "," : "") << jsonNumber(value(i));
356 out_ << ']';
357 return *this;
358}

◆ add() [5/8]

JsonRecord & gpr::track::JsonRecord::add ( std::string_view key,
double value )

Definition at line 322 of file MlflowFileStore.cpp.

323{
324 separator(key);
325 out_ << jsonNumber(value);
326 return *this;
327}

◆ add() [6/8]

JsonRecord & gpr::track::JsonRecord::add ( std::string_view key,
int value )
inline

Definition at line 25 of file MlflowFileStore.h.

26 {
27 return add(key, static_cast<long>(value));
28 }

◆ add() [7/8]

JsonRecord & gpr::track::JsonRecord::add ( std::string_view key,
long value )

Definition at line 329 of file MlflowFileStore.cpp.

330{
331 separator(key);
332 out_ << value;
333 return *this;
334}

◆ add() [8/8]

JsonRecord & gpr::track::JsonRecord::add ( std::string_view key,
std::string_view value )

Definition at line 343 of file MlflowFileStore.cpp.

344{
345 separator(key);
346 out_ << '"' << jsonEscape(value) << '"';
347 return *this;
348}

◆ addRaw()

JsonRecord & gpr::track::JsonRecord::addRaw ( std::string_view key,
std::string_view json )

A nested object, already rendered.

Definition at line 374 of file MlflowFileStore.cpp.

375{
376 separator(key);
377 out_ << json;
378 return *this;
379}

◆ str()

std::string gpr::track::JsonRecord::str ( ) const
nodiscard

Definition at line 381 of file MlflowFileStore.cpp.

382{
383 return first_ ? std::string("{}") : out_.str() + "}";
384}
std::string str() const

The documentation for this class was generated from the following files: