LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
PrettifierPrefixAnnotated.cc
Go to the documentation of this file.
2 #include "cetlib/container_algorithms.h"
4 #include "fhiclcpp/coding.h"
7 
8 using namespace fhicl;
9 using namespace fhicl::detail;
10 
11 //==========================================================================
12 void
14  any_t const&,
15  ParameterSet const* ps)
16 {
17  info_ = ps->get_src_info(key);
18 }
19 
20 //==========================================================================
21 
22 void
23 PrettifierPrefixAnnotated::enter_table(std::string const& key, std::any const&)
24 {
26  << nl() << indent_() << table::printed_prefix(key) << nl();
27  indent_.push();
28  name_stack_.emplace_back(key);
29 }
30 
31 void
32 PrettifierPrefixAnnotated::exit_table(std::string const& key, std::any const&)
33 {
34  name_stack_.pop_back();
35  indent_.pop();
37  << printed_suffix(key, sequence_sizes_.top()) << nl();
38 }
39 
40 //==========================================================================
41 
42 void
44  std::any const& a)
45 {
46  push_size_(a);
48  << nl() << indent_() << sequence::printed_prefix(key) << nl();
49  indent_.push();
50 }
51 
52 void
54  std::any const&)
55 {
56  indent_.pop();
58  << printed_suffix(key, sequence_sizes_.top()) << nl();
59  pop_size_();
60 }
61 
62 //==========================================================================
63 
64 void
65 PrettifierPrefixAnnotated::atom(std::string const& key, std::any const& a)
66 {
68  << nl() << indent_() << atom::printed_prefix(key) << atom::value(a)
69  << printed_suffix(key, sequence_sizes_.top()) << nl();
70 }
71 
72 //=========================================================================
73 
74 void
76 {
77  sequence_sizes_.emplace(std::any_cast<ps_sequence_t>(a).size());
79 }
80 
81 void
83 {
84  sequence_sizes_.pop();
86 }
87 
88 std::string
90 {
91  std::ostringstream os;
92  os << "#KEY|";
93  cet::copy_all(name_stack_, std::ostream_iterator<std::string>{os, "."});
94  os << name << "|";
95  return os.str();
96 }
std::string printed_suffix(std::string const &key, std::size_t const sz)
void atom(key_t const &, any_t const &) override
std::string printed_prefix(std::string const &key)
void enter_sequence(key_t const &, any_t const &) override
void exit_table(key_t const &, any_t const &) override
std::string print_prefix_annotated_info(std::string const &curr_info)
void before_action(key_t const &, any_t const &, ParameterSet const *) override
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
std::string printed_prefix(std::string const &key)
parameter set interface
std::string print_full_key_(name_t const &k) const
std::string value(std::any const &)
std::string get_src_info(std::string const &key) const
void enter_table(key_t const &, any_t const &) override
std::string printed_prefix(std::string const &key)
std::string nl(std::size_t i=1)
std::string closing_brace()
void exit_sequence(key_t const &, any_t const &) override