LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
PrettifierAnnotated.cc
Go to the documentation of this file.
5 
6 using namespace fhicl;
7 using namespace fhicl::detail;
8 
9 //===================================================================
10 
11 PrettifierAnnotated::PrettifierAnnotated(unsigned const initial_indent_level)
12  : buffer_()
13  , indent_{initial_indent_level}
14  , curr_info_()
15  , cached_info_()
16  , sequence_sizes_{{-1u}}
18 {}
19 
20 //==========================================================================
21 void
23  any_t const&,
24  ParameterSet const* ps)
25 {
26  curr_info_ = ps->get_src_info(key);
27 }
28 
29 void
31 {
33 }
34 
35 //==========================================================================
36 
37 void
38 PrettifierAnnotated::enter_table(std::string const& key, boost::any const&)
39 {
42  indent_.push();
43 }
44 
45 void
46 PrettifierAnnotated::exit_table(std::string const& key, boost::any const&)
47 {
48  indent_.pop();
50  << printed_suffix(key, curr_size_) << nl();
51 }
52 
53 //==========================================================================
54 
55 void
56 PrettifierAnnotated::enter_sequence(std::string const& key, boost::any const& a)
57 {
58  push_size_(a);
61  indent_.push();
62 }
63 
64 void
65 PrettifierAnnotated::exit_sequence(std::string const& key, boost::any const&)
66 {
67  indent_.pop();
69  << printed_suffix(key, curr_size_) << nl();
70  pop_size_();
71 }
72 
73 //==========================================================================
74 
75 void
76 PrettifierAnnotated::atom(std::string const& key, boost::any const& a)
77 {
79  << printed_suffix(key, curr_size_)
81 }
82 
83 //=========================================================================
84 
85 void
86 PrettifierAnnotated::push_size_(boost::any const& a)
87 {
88  sequence_sizes_.emplace(boost::any_cast<ps_sequence_t>(a).size());
90 }
91 
92 void
94 {
95  sequence_sizes_.pop();
97 }
std::string printed_suffix(std::string const &key, std::size_t const sz)
std::string print_annotated_info(std::string const &curr_info, std::string const &cached_info)
std::string printed_prefix(std::string const &key)
void before_action(key_t const &, any_t const &, ParameterSet const *) override
std::stack< std::size_t > sequence_sizes_
void enter_table(key_t const &, any_t const &) override
std::string printed_prefix(std::string const &key)
parameter set interface
void atom(key_t const &, any_t const &) override
void exit_table(key_t const &, any_t const &) override
void exit_sequence(key_t const &, any_t const &) override
std::string value(boost::any const &)
std::string get_src_info(std::string const &key) const
void enter_sequence(key_t const &, any_t const &) override
PrettifierAnnotated(unsigned initial_indent_level=0)
std::string printed_prefix(std::string const &key)
std::string nl(std::size_t i=1)
std::string closing_brace()