13#ifndef RooFit_Detail_JSONInterface_h
14#define RooFit_Detail_JSONInterface_h
33 virtual std::unique_ptr<Impl>
clone()
const = 0;
41 std::unique_ptr<Impl>
it;
80 virtual void writeYML(std::ostream &)
const {
throw std::runtime_error(
"YML not supported"); }
98 virtual std::string
key()
const = 0;
99 virtual std::string
val()
const = 0;
100 virtual int val_int()
const {
return atoi(this->
val().c_str()); }
102 virtual bool val_bool()
const {
return atoi(this->
val().c_str()); }
119 template <
typename Collection>
123 for (
auto const &item : coll) {
128 template <
typename Collection,
typename TransformationFunc>
129 void fill_seq(Collection
const &coll, TransformationFunc func)
132 for (
auto const &item : coll) {
137 template <
typename Matrix>
141 for (
int i = 0; i < mat.
GetNrows(); ++i) {
144 for (
int j = 0; j < mat.
GetNcols(); ++j) {
145 row.append_child() << mat(i, j);
157 static std::unique_ptr<JSONTree>
create();
158 static std::unique_ptr<JSONTree>
create(std::istream &is);
177 for (
const auto &
e : cv) {
178 v.push_back(
e.val_t<
T>());
186 for (
const auto &
e : cv) {
187 v.push_back(
e.val_t<
T>());
196 throw std::runtime_error(
"node " +
n.key() +
" is not of sequence type!");
virtual std::unique_ptr< Impl > clone() const =0
virtual bool equal(const Impl &other) const =0
virtual void backward()=0
child_iterator_t & operator--()
bool operator==(const child_iterator_t &that) const
bool operator!=(const child_iterator_t &that) const
child_iterator_t & operator++()
child_iterator_t(std::unique_ptr< Impl > impl)
child_iterator_t(const child_iterator_t &other)
std::unique_ptr< Impl > it
child_iterator_t< Nd > begin() const
children_view_t(child_iterator_t< Nd > const &b_, child_iterator_t< Nd > const &e_)
child_iterator_t< Nd > end() const
virtual JSONNode & operator<<(std::string const &s)=0
virtual bool val_bool() const
virtual std::string val() const =0
virtual const JSONNode & operator>>(std::string &v) const =0
virtual JSONNode & operator[](size_t pos)=0
void fill_seq(Collection const &coll)
virtual const JSONNode & operator[](size_t pos) const =0
virtual JSONNode & append_child()=0
virtual JSONNode & operator<<(double d)=0
virtual children_view children()
virtual size_t num_children() const =0
virtual JSONNode & child(size_t pos)=0
virtual bool is_container() const =0
virtual void writeJSON(std::ostream &os) const =0
virtual bool is_seq() const =0
virtual const JSONNode & operator[](std::string const &k) const =0
virtual void writeYML(std::ostream &) const
virtual bool is_map() const =0
virtual bool has_child(std::string const &) const =0
virtual std::string key() const =0
void fill_seq(Collection const &coll, TransformationFunc func)
virtual JSONNode & operator[](std::string const &k)=0
void fill_mat(Matrix const &mat)
virtual bool has_key() const =0
virtual const JSONNode & child(size_t pos) const =0
virtual double val_double() const
virtual bool has_val() const =0
virtual int val_int() const
virtual JSONNode & operator<<(int i)=0
static void setBackend(std::string const &name)
Set the library that serves as the backend for the JSON interface.
static Backend & getBackendEnum()
static std::unique_ptr< JSONTree > create()
static bool hasBackend(std::string const &name)
Check if ROOT was compiled with support for a certain JSON backend library.
static std::string getBackend()
Returns the name of the library that serves as the backend for the JSON interface,...
virtual ~JSONTree()=default
virtual JSONNode & rootnode()=0
std::ostream & operator<<(std::ostream &os, RooFit::Detail::JSONNode const &s)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
static constexpr double s