LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
PrettifierPrefixAnnotated.cc
Go to the documentation of this file.
2 #include "cetlib/container_algorithms.h"
6 
7 using namespace fhicl;
8 using namespace fhicl::detail;
9 
10 //===================================================================
11 
13  : buffer_()
14  , indent_{}
15  , info_()
16  , sequence_sizes_{{-1u}}
17  , curr_size_{}
18  , name_stack_{}
19 {}
20 
21 //==========================================================================
22 void
24  any_t const&,
25  ParameterSet const* ps)
26 {
27  info_ = ps->get_src_info(key);
28 }
29 
30 //==========================================================================
31 
32 void
34  boost::any const&)
35 {
37  << nl() << indent_() << table::printed_prefix(key) << nl();
38  indent_.push();
39  name_stack_.emplace_back(key);
40 }
41 
42 void
43 PrettifierPrefixAnnotated::exit_table(std::string const& key, boost::any const&)
44 {
45  name_stack_.pop_back();
46  indent_.pop();
48  << printed_suffix(key, sequence_sizes_.top()) << nl();
49 }
50 
51 //==========================================================================
52 
53 void
55  boost::any const& a)
56 {
57  push_size_(a);
59  << nl() << indent_() << sequence::printed_prefix(key) << nl();
60  indent_.push();
61 }
62 
63 void
65  boost::any const&)
66 {
67  indent_.pop();
69  << printed_suffix(key, sequence_sizes_.top()) << nl();
70  pop_size_();
71 }
72 
73 //==========================================================================
74 
75 void
76 PrettifierPrefixAnnotated::atom(std::string const& key, boost::any const& a)
77 {
79  << nl() << indent_() << atom::printed_prefix(key) << atom::value(a)
80  << printed_suffix(key, sequence_sizes_.top()) << nl();
81 }
82 
83 //=========================================================================
84 
85 void
87 {
88  sequence_sizes_.emplace(boost::any_cast<ps_sequence_t>(a).size());
90 }
91 
92 void
94 {
95  sequence_sizes_.pop();
97 }
98 
99 std::string
101 {
102  std::ostringstream os;
103  os << "#KEY|";
104  cet::copy_all(name_stack_, std::ostream_iterator<std::string>{os, "."});
105  os << name << "|";
106  return os.str();
107 }
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
std::string printed_prefix(std::string const &key)
parameter set interface
std::string print_full_key_(name_t const &k) const
std::string value(boost::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