Public Member Functions | Private Member Functions | Private Attributes | List of all members
evgen::MarleyParameterSetWalker Class Reference

#include <MarleyParameterSetWalker.h>

Inheritance diagram for evgen::MarleyParameterSetWalker:
fhicl::ParameterSetWalker

Public Member Functions

const marley::JSON & get_json () const
 
marley::JSON & get_json ()
 
- Public Member Functions inherited from fhicl::ParameterSetWalker
virtual ~ParameterSetWalker () noexcept=default
 
void do_enter_table (key_t const &k, any_t const &a)
 
void do_enter_sequence (key_t const &k, any_t const &a)
 
void do_atom (key_t const &k, any_t const &a)
 
void do_before_action (key_t const &k, any_t const &a, ParameterSet const *ps)
 
void do_after_action (key_t const &k)
 
void do_exit_table (key_t const &k, any_t const &a)
 
void do_exit_sequence (key_t const &k, any_t const &a)
 

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
 

Additional Inherited Members

- Public Types inherited from fhicl::ParameterSetWalker
using key_t = std::string
 
using any_t = std::any
 

Detailed Description

Definition at line 25 of file MarleyParameterSetWalker.h.

Member Function Documentation

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

Definition at line 48 of file MarleyParameterSetWalker.h.

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

Definition at line 40 of file MarleyParameterSetWalker.h.

40  {
41  auto& json = json_refs_.back().get();
42  in_seq_ = true;
43  seq_index_ = 0u;
44  json_refs_.emplace_back( json[ key ]
46  }
#define Array
Definition: scanner.cpp:11549
def key(type, name=None)
Definition: graph.py:13
unique_ptr< InputSource > make(ParameterSet const &conf, InputSourceDescription &desc)
std::vector< std::reference_wrapper< marley::JSON > > json_refs_
References to the owned JSON object or a sub-object thereof.
void evgen::MarleyParameterSetWalker::enter_table ( const key_t key,
const any_t  
)
inlineoverrideprivate

Definition at line 34 of file MarleyParameterSetWalker.h.

34  {
35  auto& json = json_refs_.back().get();
36  json_refs_.emplace_back( json[ key ]
38  }
def key(type, name=None)
Definition: graph.py:13
struct Object Object
Object type.
Definition: manual.c:5
unique_ptr< InputSource > make(ParameterSet const &conf, InputSourceDescription &desc)
std::vector< std::reference_wrapper< marley::JSON > > json_refs_
References to the owned JSON object or a sub-object thereof.
void evgen::MarleyParameterSetWalker::exit_sequence ( const key_t ,
const any_t  
)
inlineoverrideprivate

Definition at line 73 of file MarleyParameterSetWalker.h.

73  {
74  json_refs_.pop_back();
75  in_seq_ = false;
76  }
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 69 of file MarleyParameterSetWalker.h.

69  {
70  json_refs_.pop_back();
71  }
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 29 of file MarleyParameterSetWalker.h.

29 { 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 30 of file MarleyParameterSetWalker.h.

30 { 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 79 of file MarleyParameterSetWalker.h.

bool evgen::MarleyParameterSetWalker::in_seq_ = false
private

Definition at line 86 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 83 of file MarleyParameterSetWalker.h.

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

Definition at line 85 of file MarleyParameterSetWalker.h.


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