LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
fhicl::detail::PrettifierAnnotated Class Reference

#include "PrettifierAnnotated.h"

Inheritance diagram for fhicl::detail::PrettifierAnnotated:
fhicl::ParameterSetWalker

Public Types

using key_t = std::string
 
using any_t = std::any
 

Public Member Functions

 PrettifierAnnotated (unsigned initial_indent_level=0)
 
std::string result () const
 
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 before_action (key_t const &, any_t const &, ParameterSet const *) override
 
void after_action (key_t const &) override
 
void enter_table (key_t const &, any_t const &) override
 
void enter_sequence (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
 
void atom (key_t const &, any_t const &) override
 
void push_size_ (any_t const &)
 
void pop_size_ ()
 

Private Attributes

std::ostringstream buffer_
 
Indentation indent_
 
std::string curr_info_
 
std::string cached_info_
 
std::stack< std::size_t > sequence_sizes_
 
std::size_t curr_size_
 

Detailed Description

Definition at line 105 of file PrettifierAnnotated.h.

Member Typedef Documentation

using fhicl::ParameterSetWalker::any_t = std::any
inherited

Definition at line 79 of file ParameterSetWalker.h.

using fhicl::ParameterSetWalker::key_t = std::string
inherited

Definition at line 78 of file ParameterSetWalker.h.

Constructor & Destructor Documentation

PrettifierAnnotated::PrettifierAnnotated ( unsigned  initial_indent_level = 0)

Definition at line 12 of file PrettifierAnnotated.cc.

References cached_info_, curr_info_, curr_size_, and sequence_sizes_.

Member Function Documentation

void PrettifierAnnotated::after_action ( key_t const &  )
overrideprivatevirtual

Reimplemented from fhicl::ParameterSetWalker.

Definition at line 31 of file PrettifierAnnotated.cc.

References cached_info_, and curr_info_.

Referenced by result().

void PrettifierAnnotated::atom ( key_t const &  key,
any_t const &  a 
)
overrideprivatevirtual

Implements fhicl::ParameterSetWalker.

Definition at line 77 of file PrettifierAnnotated.cc.

References buffer_, cached_info_, curr_info_, curr_size_, indent_, fhicl::detail::nl(), fhicl::detail::print_annotated_info(), fhicl::detail::atom::printed_prefix(), fhicl::detail::printed_suffix(), and fhicl::detail::atom::value().

Referenced by result().

78 {
80  << printed_suffix(key, curr_size_)
82 }
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 value(std::any const &)
std::string printed_prefix(std::string const &key)
std::string nl(std::size_t i=1)
void PrettifierAnnotated::before_action ( key_t const &  key,
any_t const &  ,
ParameterSet const *  ps 
)
overrideprivatevirtual

Reimplemented from fhicl::ParameterSetWalker.

Definition at line 23 of file PrettifierAnnotated.cc.

References curr_info_, and fhicl::ParameterSet::get_src_info().

Referenced by result().

26 {
27  curr_info_ = ps->get_src_info(key);
28 }
void fhicl::ParameterSetWalker::do_after_action ( key_t const &  k)
inlineinherited

Definition at line 103 of file ParameterSetWalker.h.

References fhicl::ParameterSetWalker::after_action().

Referenced by fhicl::ParameterSet::walk().

104  {
105  after_action(k);
106  }
virtual void after_action(key_t const &)
void fhicl::ParameterSetWalker::do_atom ( key_t const &  k,
any_t const &  a 
)
inlineinherited

Definition at line 92 of file ParameterSetWalker.h.

References fhicl::ParameterSetWalker::atom().

Referenced by fhicl::ParameterSet::walk().

93  {
94  atom(k, a);
95  }
virtual void atom(key_t const &, any_t const &)=0
void fhicl::ParameterSetWalker::do_before_action ( key_t const &  k,
any_t const &  a,
ParameterSet const *  ps 
)
inlineinherited

Definition at line 98 of file ParameterSetWalker.h.

References fhicl::ParameterSetWalker::before_action().

Referenced by fhicl::ParameterSet::walk().

99  {
100  before_action(k, a, ps);
101  }
virtual void before_action(key_t const &, any_t const &, ParameterSet const *)
void fhicl::ParameterSetWalker::do_enter_sequence ( key_t const &  k,
any_t const &  a 
)
inlineinherited

Definition at line 87 of file ParameterSetWalker.h.

References fhicl::ParameterSetWalker::enter_sequence().

Referenced by fhicl::ParameterSet::walk().

88  {
89  enter_sequence(k, a);
90  }
virtual void enter_sequence(key_t const &, any_t const &)=0
void fhicl::ParameterSetWalker::do_enter_table ( key_t const &  k,
any_t const &  a 
)
inlineinherited

Definition at line 82 of file ParameterSetWalker.h.

References fhicl::ParameterSetWalker::enter_table().

Referenced by fhicl::ParameterSet::walk().

83  {
84  enter_table(k, a);
85  }
virtual void enter_table(key_t const &, any_t const &)=0
void fhicl::ParameterSetWalker::do_exit_sequence ( key_t const &  k,
any_t const &  a 
)
inlineinherited
void fhicl::ParameterSetWalker::do_exit_table ( key_t const &  k,
any_t const &  a 
)
inlineinherited

Definition at line 109 of file ParameterSetWalker.h.

References fhicl::ParameterSetWalker::exit_table().

Referenced by fhicl::ParameterSet::walk().

110  {
111  exit_table(k, a);
112  }
virtual void exit_table(key_t const &, any_t const &)
void PrettifierAnnotated::enter_sequence ( key_t const &  key,
any_t const &  a 
)
overrideprivatevirtual
void PrettifierAnnotated::enter_table ( key_t const &  key,
any_t const &   
)
overrideprivatevirtual

Implements fhicl::ParameterSetWalker.

Definition at line 39 of file PrettifierAnnotated.cc.

References buffer_, cached_info_, curr_info_, indent_, fhicl::detail::nl(), fhicl::detail::print_annotated_info(), fhicl::detail::table::printed_prefix(), and fhicl::detail::Indentation::push().

Referenced by result().

40 {
43  indent_.push();
44 }
std::string print_annotated_info(std::string const &curr_info, std::string const &cached_info)
std::string printed_prefix(std::string const &key)
std::string nl(std::size_t i=1)
void PrettifierAnnotated::exit_sequence ( key_t const &  key,
any_t const &   
)
overrideprivatevirtual
void PrettifierAnnotated::exit_table ( key_t const &  key,
any_t const &   
)
overrideprivatevirtual

Reimplemented from fhicl::ParameterSetWalker.

Definition at line 47 of file PrettifierAnnotated.cc.

References buffer_, fhicl::detail::table::closing_brace(), curr_size_, indent_, fhicl::detail::nl(), fhicl::detail::Indentation::pop(), and fhicl::detail::printed_suffix().

Referenced by result().

48 {
49  indent_.pop();
51  << printed_suffix(key, curr_size_) << nl();
52 }
std::string printed_suffix(std::string const &key, std::size_t const sz)
std::string nl(std::size_t i=1)
std::string closing_brace()
void PrettifierAnnotated::pop_size_ ( )
private

Definition at line 94 of file PrettifierAnnotated.cc.

References curr_size_, and sequence_sizes_.

Referenced by exit_sequence(), and result().

95 {
96  sequence_sizes_.pop();
98 }
std::stack< std::size_t > sequence_sizes_
void PrettifierAnnotated::push_size_ ( any_t const &  a)
private

Definition at line 87 of file PrettifierAnnotated.cc.

References curr_size_, sequence_sizes_, and util::size().

Referenced by enter_sequence(), and result().

88 {
89  sequence_sizes_.emplace(std::any_cast<ps_sequence_t>(a).size());
91 }
std::stack< std::size_t > sequence_sizes_
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:101
std::string fhicl::detail::PrettifierAnnotated::result ( ) const
inline

Member Data Documentation

std::ostringstream fhicl::detail::PrettifierAnnotated::buffer_
private
std::string fhicl::detail::PrettifierAnnotated::cached_info_
private
std::string fhicl::detail::PrettifierAnnotated::curr_info_
private
std::size_t fhicl::detail::PrettifierAnnotated::curr_size_
private
Indentation fhicl::detail::PrettifierAnnotated::indent_
private

Definition at line 133 of file PrettifierAnnotated.h.

Referenced by atom(), enter_sequence(), enter_table(), exit_sequence(), and exit_table().

std::stack<std::size_t> fhicl::detail::PrettifierAnnotated::sequence_sizes_
private

Definition at line 136 of file PrettifierAnnotated.h.

Referenced by pop_size_(), PrettifierAnnotated(), and push_size_().


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