All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
evgen::MarleyParameterSetWalker Class Reference

#include <MarleyParameterSetWalker.h>

Inheritance diagram for evgen::MarleyParameterSetWalker:

Public Member Functions

const marley::JSON & get_json () const
 
marley::JSON & get_json ()
 

Private Member Functions

void enter_table (const key_t &key, const any_t &) override
 
void enter_sequence (const key_t &key, const any_t &) override
 
void atom (const key_t &key, const any_t &any) override
 
void exit_table (const key_t &, const any_t &) override
 
void exit_sequence (const key_t &, const any_t &) override
 

Private Attributes

marley::JSON full_json_
 Owned JSON object used to store the converted FHiCL parameters. More...
 
std::vector
< std::reference_wrapper
< marley::JSON > > 
json_refs_ = { full_json_ }
 References to the owned JSON object or a sub-object thereof. More...
 
unsigned seq_index_ = 0u
 
bool in_seq_ = false
 

Detailed Description

Definition at line 26 of file MarleyParameterSetWalker.h.

Member Function Documentation

void evgen::MarleyParameterSetWalker::atom ( const key_t &  key,
const any_t &  any 
)
inlineoverrideprivate

Definition at line 49 of file MarleyParameterSetWalker.h.

49  {
50  auto& json = json_refs_.back().get();
51  // Convert the atom to a string. Add an extra space to keep some
52  // of MARLEY's JSON parsing routines (which rely on looking ahead
53  // in some cases) happy
54  std::string atom_val = fhicl::detail::atom::value( any ) + ' ';
55  marley::JSON json_atom;
56  // Hard-coded value taken from fhiclcpp/detail/printing_helpers.cc
57  if ( atom_val != "@nil" ) {
58  std::istringstream iss( atom_val );
59  // Utility function defined in marley/JSON.hh
60  json_atom = marley::parse_next( iss );
61  }
62  if ( in_seq_ ) {
63  json[ seq_index_++ ] = json_atom;
64  }
65  else {
66  json[ key ] = json_atom;
67  }
68  }
std::vector< std::reference_wrapper< marley::JSON > > json_refs_
References to the owned JSON object or a sub-object thereof.
temporary value
basic_json<> json
default JSON class
Definition: json.hpp:2445
void evgen::MarleyParameterSetWalker::enter_sequence ( const key_t &  key,
const any_t &   
)
inlineoverrideprivate

Definition at line 41 of file MarleyParameterSetWalker.h.

41  {
42  auto& json = json_refs_.back().get();
43  in_seq_ = true;
44  seq_index_ = 0u;
45  json_refs_.emplace_back( json[ key ]
46  = marley::JSON::make(marley::JSON::DataType::Array) );
47  }
std::vector< std::reference_wrapper< marley::JSON > > json_refs_
References to the owned JSON object or a sub-object thereof.
basic_json<> json
default JSON class
Definition: json.hpp:2445
void evgen::MarleyParameterSetWalker::enter_table ( const key_t &  key,
const any_t &   
)
inlineoverrideprivate

Definition at line 35 of file MarleyParameterSetWalker.h.

35  {
36  auto& json = json_refs_.back().get();
37  json_refs_.emplace_back( json[ key ]
38  = marley::JSON::make(marley::JSON::DataType::Object) );
39  }
std::vector< std::reference_wrapper< marley::JSON > > json_refs_
References to the owned JSON object or a sub-object thereof.
basic_json<> json
default JSON class
Definition: json.hpp:2445
void evgen::MarleyParameterSetWalker::exit_sequence ( const key_t &  ,
const any_t &   
)
inlineoverrideprivate

Definition at line 74 of file MarleyParameterSetWalker.h.

74  {
75  json_refs_.pop_back();
76  in_seq_ = false;
77  }
std::vector< std::reference_wrapper< marley::JSON > > json_refs_
References to the owned JSON object or a sub-object thereof.
void evgen::MarleyParameterSetWalker::exit_table ( const key_t &  ,
const any_t &   
)
inlineoverrideprivate

Definition at line 70 of file MarleyParameterSetWalker.h.

70  {
71  json_refs_.pop_back();
72  }
std::vector< std::reference_wrapper< marley::JSON > > json_refs_
References to the owned JSON object or a sub-object thereof.
const marley::JSON& evgen::MarleyParameterSetWalker::get_json ( ) const
inline

Definition at line 30 of file MarleyParameterSetWalker.h.

30 { return full_json_; }
marley::JSON full_json_
Owned JSON object used to store the converted FHiCL parameters.
marley::JSON& evgen::MarleyParameterSetWalker::get_json ( )
inline

Definition at line 31 of file MarleyParameterSetWalker.h.

31 { return full_json_; }
marley::JSON full_json_
Owned JSON object used to store the converted FHiCL parameters.

Member Data Documentation

marley::JSON evgen::MarleyParameterSetWalker::full_json_
private

Owned JSON object used to store the converted FHiCL parameters.

Definition at line 80 of file MarleyParameterSetWalker.h.

bool evgen::MarleyParameterSetWalker::in_seq_ = false
private

Definition at line 87 of file MarleyParameterSetWalker.h.

std::vector< std::reference_wrapper<marley::JSON> > evgen::MarleyParameterSetWalker::json_refs_ = { full_json_ }
private

References to the owned JSON object or a sub-object thereof.

Definition at line 84 of file MarleyParameterSetWalker.h.

unsigned evgen::MarleyParameterSetWalker::seq_index_ = 0u
private

Definition at line 86 of file MarleyParameterSetWalker.h.


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