13#ifndef RooFit_Detail_JSONInterface_h
14#define RooFit_Detail_JSONInterface_h
86 std::string
key()
const;
87 std::string
val()
const;
96 bool has_child(std::string
const &)
const;
108 template <
typename Collection>
112 for (
auto const &item : coll) {
117 template <
typename Matrix>
121 for (
int i = 0; i < mat.
GetNrows(); ++i) {
124 for (
int j = 0; j < mat.
GetNcols(); ++j) {
125 row.append_child() << mat(i, j);
133 template <
typename... Keys_t>
142 template <
typename... Keys_t>
168 static std::unique_ptr<JSONTree>
create();
169 static std::unique_ptr<JSONTree>
create(std::istream &is);
170 static std::unique_ptr<JSONTree>
create(std::string
const &str);
173 explicit JSONTree(std::unique_ptr<JSONNode::Storage> storage);
182 throw std::runtime_error(
"node " +
n.key() +
" is not of sequence type!");
184 for (
const auto &
e :
n.children()) {
185 v.push_back(
e.val_t<T>());
191inline int JSONNode::val_t<int>()
const
196inline double JSONNode::val_t<double>()
const
201inline bool JSONNode::val_t<bool>()
const
206inline 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++()
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)
The component at the end of a path of keys. The nodes on the path become maps.
double val_double() const
void erase(std::string const &key)
Remove a child of a map, if it exists.
bool is_container() const
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_mat(Matrix const &mat)
JSONNode const * find(std::string const &key) const
The component at the end of a path of keys, or nullptr if a component on the path doesn't exist.
JSONNode(JSONNode const &)=delete
bool has_child(std::string const &) const
std::optional< bool > try_val_bool() const
The value as a boolean, or std::nullopt if it is none. Like val_bool(), the integers 0 and 1 are acce...
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::vector< T > & operator<<(std::vector< T > &v, RooFit::Detail::JSONNode const &n)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...