13#ifndef RooFit_Detail_JSONInterface_h
14#define RooFit_Detail_JSONInterface_h
20#include <unordered_map>
98 std::string
key()
const;
99 std::string
val()
const;
107 bool has_child(std::string
const &)
const;
119 template <
typename Collection>
123 for (
auto const &item : coll) {
128 template <
typename Collection>
133 for (
auto const &item : coll) {
141 template <
typename Collection,
typename TransformationFunc>
142 void fill_seq(Collection
const &coll, TransformationFunc func)
145 for (
auto const &item : coll) {
150 template <
typename Matrix>
154 for (
int i = 0; i < mat.
GetNrows(); ++i) {
157 for (
int j = 0; j < mat.
GetNcols(); ++j) {
158 row.append_child() << mat(i, j);
169 template <
typename... Keys_t>
183 template <
typename... Keys_t>
188 return next.get(keys...);
211 static std::unique_ptr<JSONTree>
create();
212 static std::unique_ptr<JSONTree>
create(std::istream &is);
213 static std::unique_ptr<JSONTree>
create(std::string
const &str);
216 explicit JSONTree(std::unique_ptr<JSONNode::Storage> storage);
226 for (
const auto &
e : cv) {
227 v.push_back(
e.val_t<T>());
235 for (
const auto &
e : cv) {
236 v.push_back(
e.val_t<T>());
245 throw std::runtime_error(
"node " +
n.key() +
" is not of sequence type!");
269template <
class Key,
class T,
class Hash,
class KeyEqual,
class Allocator>
274 for (
const auto &it :
m) {
275 n[it.first] << it.second;
280template <
class Key,
class T,
class Compare,
class Allocator>
284 for (
const auto &it :
m) {
285 n[it.first] << it.second;
291inline int JSONNode::val_t<int>()
const
296inline double JSONNode::val_t<double>()
const
301inline bool JSONNode::val_t<bool>()
const
306inline std::string JSONNode::val_t<std::string>()
const
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t child
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
child_iterator_t(Nd *const *pos)
child_iterator_t & operator--()
child_iterator_t & operator++()
friend bool operator==(child_iterator_t const &lhs, child_iterator_t const &rhs)
friend bool operator!=(child_iterator_t const &lhs, child_iterator_t const &rhs)
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
JSONNode & operator[](std::string const &k)
JSONNode & get(std::string const &key)
double val_double() const
void erase(std::string const &key)
Remove a child of a map, if it exists.
bool is_container() const
void fill_seq(Collection const &coll, size_t nmax)
JSONNode & get(std::string const &key, Keys_t const &...keys)
void fill_seq(Collection const &coll)
JSONNode const * find(std::string const &key, Keys_t const &...keys) const
void writeJSON(std::ostream &os) const
JSONNode & append_child()
JSONNode & operator<<(std::string const &s)
JSONNode & operator=(JSONNode const &)=delete
JSONNode & operator<<(const char *s)
size_t num_children() const
void fill_seq(Collection const &coll, TransformationFunc func)
void fill_mat(Matrix const &mat)
JSONNode const * find(std::string const &key) const
JSONNode(JSONNode const &)=delete
const JSONNode & operator>>(std::string &v) const
bool has_child(std::string const &) const
Records which components of a JSON map are read while it is alive, through any node of the tree.
static std::unique_ptr< JSONTree > create()
JSONTree(std::unique_ptr< JSONNode::Storage > storage)
std::unique_ptr< JSONNode::Storage > _storage
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...