Rosetta
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Private Attributes | List of all members
basic::Tracer Class Reference

Class for handling user debug/warnings/errors. Use instance of this class instead of 'std::cout' for all your regular io. Channel argument must be related to the location of the source file. For example if you create Tracer object in src/basic/scoring/myfile.cc, then channel must be something like 'basic.scoring.myfile'. More...

#include <Tracer.hh>

Inheritance diagram for basic::Tracer:
Inheritance graph
[legend]

Classes

class  TracerProxy
 

Public Member Functions

 Tracer (std::string const &channel="", TracerPriority priority=t_info, bool muted_by_default=false)
 Create Tracer object with given channel and priority. More...
 
 Tracer (std::string const &channel, utility::CSI::CSI_Enum const &channel_color, utility::CSI::CSI_Enum const &channel_name_color=utility::CSI::Nothing, TracerPriority priority=t_info, bool muted_by_default=false)
 Create Tracer object with channel color, channel name color and given channel and priority. More...
 
virtual ~Tracer ()
 
 Tracer (Tracer const &)=delete
 
Traceroperator= (Tracer const &)=delete
 
template<typename T >
TracerImploperator<< (T const &entry)
 output operator We return a TracerImpl instead of ourself to make subsequent access faster. More...
 
TracerImploperator<< (std::ostream &(*entry)(std::ostream &))
 
 operator std::ostream & ()
 Allow Tracer object to be passed to something expecting a std::ostream. More...
 
void flush ()
 
void flush_all_channels ()
 flush tracer buffer and flush buffers of all sub-channels ie: Fatal, Error, Warning, Info, Debug, Trace More...
 
bool visible ()
 
bool visible (int priority)
 
std::string const & channel ()
 
TracerImploperator() (int priority)
 
void set_local_print_channel_name (bool const setting)
 Set whether we're printing the channel name. More...
 
bool get_local_print_channel_name ()
 Get whether we're printing the channel name. More...
 
std::streamsize width ()
 
std::streamsize width (std::streamsize wide)
 
std::streamsize precision ()
 
std::streamsize precision (std::streamsize prec)
 
std::ios_base::fmtflags flags ()
 
std::ios_base::fmtflags flags (std::ios_base::fmtflags fmtfl)
 

Static Public Member Functions

static void set_ios_hook (otstreamOP tr, std::string const &monitoring_channels_list, bool raw=true)
 TODO: See if we can kill any usage of this, except for the esoteric. More...
 
static std::string const & get_all_channels_string ()
 
static bool super_mute ()
 global super mute flag that allow to mute all io no matter what. More...
 
static void super_mute (bool f)
 

Public Attributes

TracerProxy Fatal
 channels with predefined priority levels. More...
 
TracerProxy Error
 
TracerProxy Warning
 
TracerProxy Info
 
TracerProxy Debug
 
TracerProxy Trace
 

Static Public Attributes

static utility::CSI::CSI_Enum Reset
 
static utility::CSI::CSI_Enum Bold
 
static utility::CSI::CSI_Enum Underline
 
static utility::CSI::CSI_Enum Black
 
static utility::CSI::CSI_Enum Red
 
static utility::CSI::CSI_Enum Green
 
static utility::CSI::CSI_Enum Yellow
 
static utility::CSI::CSI_Enum Blue
 
static utility::CSI::CSI_Enum Magenta
 
static utility::CSI::CSI_Enum Cyan
 
static utility::CSI::CSI_Enum White
 
static utility::CSI::CSI_Enum bgBlack
 
static utility::CSI::CSI_Enum bgRed
 
static utility::CSI::CSI_Enum bgGreen
 
static utility::CSI::CSI_Enum bgYellow
 
static utility::CSI::CSI_Enum bgBlue
 
static utility::CSI::CSI_Enum bgMagenta
 
static utility::CSI::CSI_Enum bgCyan
 
static utility::CSI::CSI_Enum bgWhite
 

Protected Member Functions

TracerImpltracer_impl ()
 The function which handles the construct-on-first use Not virtual for speed in the usual (non-creation) case. More...
 
virtual std::unique_ptr< TracerImplcreate_impl ()
 

Private Attributes

std::string channel_
 
utility::CSI::CSI_Enum channel_color_
 
utility::CSI::CSI_Enum channel_name_color_
 
TracerPriority priority_
 
bool muted_by_default_
 

Detailed Description

Class for handling user debug/warnings/errors. Use instance of this class instead of 'std::cout' for all your regular io. Channel argument must be related to the location of the source file. For example if you create Tracer object in src/basic/scoring/myfile.cc, then channel must be something like 'basic.scoring.myfile'.

Intended usage is as a global-scope static object. If you need a heap/stack allocated object, use the TracerImpl class directly.

The funky indirection to TracerImpl here is so that the heavy-weight TracerImpl object is only constructed on first use, and isn't static or thread_local

Constructor & Destructor Documentation

◆ Tracer() [1/3]

basic::Tracer::Tracer ( std::string const &  channel = "",
TracerPriority  priority = t_info,
bool  muted_by_default = false 
)

Create Tracer object with given channel and priority.

◆ Tracer() [2/3]

basic::Tracer::Tracer ( std::string const &  channel,
utility::CSI::CSI_Enum const &  channel_color,
utility::CSI::CSI_Enum const &  channel_name_color = utility::CSI::Nothing,
TracerPriority  priority = t_info,
bool  muted_by_default = false 
)

Create Tracer object with channel color, channel name color and given channel and priority.

Ex: static basic::Tracer Blue("blue", utility::CSI::Blue);

◆ ~Tracer()

basic::Tracer::~Tracer ( )
virtualdefault

Ideally, we'd clean ourselves up from the tracer_impl_map, but that's complicated by it being a) thread-dependent, and b) subject to static initialization order fiasco (static destruction order fiasco) issues. Regardless, the associated TracerImpl will be flushed when the static tracer_impl_map gets destroyed. The one tricky bit is that the TracerImpl for non-static tracers stick around, and may accidentally be re-used if we re-use the same pointer ... so avoid non-static Tracer objects: use a TracerImpl directly instead.

◆ Tracer() [3/3]

basic::Tracer::Tracer ( Tracer const &  )
delete

Member Function Documentation

◆ channel()

std::string const& basic::Tracer::channel ( )
inline

◆ create_impl()

std::unique_ptr< TracerImpl > basic::Tracer::create_impl ( )
protectedvirtual

◆ flags() [1/2]

std::ios_base::fmtflags basic::Tracer::flags ( )
inline

References tracer_impl().

◆ flags() [2/2]

std::ios_base::fmtflags basic::Tracer::flags ( std::ios_base::fmtflags  fmtfl)
inline

References tracer_impl().

◆ flush()

void basic::Tracer::flush ( )
inline

◆ flush_all_channels()

void basic::Tracer::flush_all_channels ( )
inline

flush tracer buffer and flush buffers of all sub-channels ie: Fatal, Error, Warning, Info, Debug, Trace

References basic::TracerImpl::flush_all_channels(), and tracer_impl().

Referenced by main().

◆ get_all_channels_string()

static std::string const& basic::Tracer::get_all_channels_string ( )
inlinestatic

◆ get_local_print_channel_name()

bool basic::Tracer::get_local_print_channel_name ( )
inline

Get whether we're printing the channel name.

This looks at the local setting, but does not check the global setting.

Note
In practice, if the local setting is true then the global setting is used. If the local setting is false, it overrides the global setting.
Author
Vikram K. Mulligan (vmull.nosp@m.igan.nosp@m.@flat.nosp@m.iron.nosp@m.insti.nosp@m.tute.nosp@m..org)

References basic::TracerImpl::get_local_print_channel_name(), and tracer_impl().

◆ operator std::ostream &()

basic::Tracer::operator std::ostream & ( )
inline

Allow Tracer object to be passed to something expecting a std::ostream.

References tracer_impl().

◆ operator()()

TracerImpl& basic::Tracer::operator() ( int  priority)
inline

References tracer_impl().

◆ operator<<() [1/2]

TracerImpl& basic::Tracer::operator<< ( std::ostream &(*)(std::ostream &)  entry)
inline

References tracer_impl().

◆ operator<<() [2/2]

template<typename T >
TracerImpl& basic::Tracer::operator<< ( T const &  entry)
inline

output operator We return a TracerImpl instead of ourself to make subsequent access faster.

References tracer_impl().

◆ operator=()

Tracer& basic::Tracer::operator= ( Tracer const &  )
delete

◆ precision() [1/2]

std::streamsize basic::Tracer::precision ( )
inline

References tracer_impl().

Referenced by main(), print_tree(), and test_Random().

◆ precision() [2/2]

std::streamsize basic::Tracer::precision ( std::streamsize  prec)
inline

References tracer_impl().

◆ set_ios_hook()

static void basic::Tracer::set_ios_hook ( otstreamOP  tr,
std::string const &  monitoring_channels_list,
bool  raw = true 
)
inlinestatic

◆ set_local_print_channel_name()

void basic::Tracer::set_local_print_channel_name ( bool const  setting)
inline

Set whether we're printing the channel name.

This overrides the local setting, but does not alter the global setting.

Note
In practice, if the local setting is true then the global setting is used. If the local setting is false, it overrides the global setting.
Author
Vikram K. Mulligan (vmull.nosp@m.igan.nosp@m.@flat.nosp@m.iron.nosp@m.insti.nosp@m.tute.nosp@m..org)

References basic::TracerImpl::set_local_print_channel_name(), and tracer_impl().

◆ super_mute() [1/2]

static bool basic::Tracer::super_mute ( )
inlinestatic

global super mute flag that allow to mute all io no matter what.

References basic::TracerImpl::super_mute().

◆ super_mute() [2/2]

static void basic::Tracer::super_mute ( bool  f)
inlinestatic

◆ tracer_impl()

TracerImpl & basic::Tracer::tracer_impl ( )
protected

The function which handles the construct-on-first use Not virtual for speed in the usual (non-creation) case.

References create_impl(), and THREAD_LOCAL.

Referenced by channel(), flags(), flush(), flush_all_channels(), get_local_print_channel_name(), operator std::ostream &(), operator()(), operator<<(), precision(), set_local_print_channel_name(), basic::Tracer::TracerProxy::tracer_proxy_impl(), visible(), and width().

◆ visible() [1/2]

bool basic::Tracer::visible ( )
inline

References tracer_impl(), and basic::TracerImpl::visible().

Referenced by main().

◆ visible() [2/2]

bool basic::Tracer::visible ( int  priority)
inline

◆ width() [1/2]

std::streamsize basic::Tracer::width ( )
inline

References tracer_impl().

Referenced by main().

◆ width() [2/2]

std::streamsize basic::Tracer::width ( std::streamsize  wide)
inline

References tracer_impl().

Member Data Documentation

◆ bgBlack

utility::CSI::CSI_Enum basic::Tracer::bgBlack
static

◆ bgBlue

utility::CSI::CSI_Enum basic::Tracer::bgBlue
static

◆ bgCyan

utility::CSI::CSI_Enum basic::Tracer::bgCyan
static

◆ bgGreen

utility::CSI::CSI_Enum basic::Tracer::bgGreen
static

◆ bgMagenta

utility::CSI::CSI_Enum basic::Tracer::bgMagenta
static

◆ bgRed

utility::CSI::CSI_Enum basic::Tracer::bgRed
static

Referenced by main().

◆ bgWhite

utility::CSI::CSI_Enum basic::Tracer::bgWhite
static

Referenced by main().

◆ bgYellow

utility::CSI::CSI_Enum basic::Tracer::bgYellow
static

◆ Black

utility::CSI::CSI_Enum basic::Tracer::Black
static

Referenced by main().

◆ Blue

utility::CSI::CSI_Enum basic::Tracer::Blue
static

◆ Bold

utility::CSI::CSI_Enum basic::Tracer::Bold
static

◆ channel_

std::string basic::Tracer::channel_
private

◆ channel_color_

utility::CSI::CSI_Enum basic::Tracer::channel_color_
private

Referenced by create_impl().

◆ channel_name_color_

utility::CSI::CSI_Enum basic::Tracer::channel_name_color_
private

Referenced by create_impl().

◆ Cyan

utility::CSI::CSI_Enum basic::Tracer::Cyan
static

◆ Debug

TracerProxy basic::Tracer::Debug

Referenced by add_side_chains_partialthread(), ThisApplication::analyze_tree(), ConstraintToolMover::apply(), CenRelaxMover::apply(), apps::pilot::CustomStarTreeMover::apply(), apps::pilot::SampleSecondaryStructureAlignmentMover::apply(), MyScoreMover::apply(), MinCenrotMover::apply(), CenRotRelaxMover::apply(), BacksideHbondFinderMover::apply(), DetectSymmetry::apply(), CenRotRBRelaxMover::apply(), build_full_model_test(), calc_scores(), calculate_helical_parameters(), basic::database::schema_generator::Schema::check_table_and_perform_write(), DockFragmentsMover::cluster_frags(), compare_cartesian_rmsd(), compare_frags_pose(), determine_residues_to_rebuild(), drrafter_error_estimation(), evaluate_score(), apps::pilot::momeara::HBondConformation::example_OH_pose(), basic::database::find_cache_file(), protocols::abinitio::JumpSpecificAbrelax::fold(), SetupHotspotMover::generate_csts(), generate_dunbrack_binaries(), protocols::abinitio::JumpSpecificAbrelax::generate_extended_pose(), basic::mpi::MessageListenerFactory::get_listener(), get_median_structure(), get_simple_RNA_protein_fold_tree(), apps::pilot::momeara::HBondConformation::hbond_param_sweep(), InstantiateModulesBenchmark::instantiate_filters(), InstantiateModulesBenchmark::instantiate_movers(), InstantiateModulesBenchmark::instantiate_packer_palettes(), InstantiateModulesBenchmark::instantiate_res_selectors(), InstantiateModulesBenchmark::instantiate_reslvl_taskops(), InstantiateModulesBenchmark::instantiate_simple_metrics(), InstantiateModulesBenchmark::instantiate_taskops(), ChallengeMover::jumps_from_pose(), basic::citation_manager::CitationManager::load_rosetta_citations_from_database(), main(), apps::pilot::momeara::HBondConformation::make_conformation(), make_mutations(), mutate_and_score_RNP(), BacksideHbondFinderMover::mutate_residue(), my_main(), basic::citation_manager::CitationManager::populate_doi_rosetta_citation_map(), read_in_mutations(), read_pose(), read_RDC_file(), read_structures(), read_thickness(), recover_clustered_frags(), apps::pilot::momeara::HBondConformation::relax_pose_around_hbond(), basic::mpi::request_data_from_head_node(), resample_full_model(), ScoreFragmentSetMover::run(), ConsensusFragmentMover::run(), SolutionRescoreMover::run(), DomainAssemblerNDocker::setup_cen_domains(), protocols::abinitio::JumpSpecificAbrelax::setup_fold(), apps::pilot::SampleSecondaryStructureAlignmentMover::setup_startree(), SphereGrinder(), apps::pilot::AlignChunkMover::steal_torsion_from_template(), test_Tracer(), apps::pilot::SampleSecondaryStructureAlignmentMover::translate_virt_to_CoM(), FragMonteCarlo::updated_covered_rsds(), basic::database::schema_generator::Schema::write(), and basic::thread_manager::RosettaThreadAllocation::~RosettaThreadAllocation().

◆ Error

TracerProxy basic::Tracer::Error

◆ Fatal

TracerProxy basic::Tracer::Fatal

◆ Green

utility::CSI::CSI_Enum basic::Tracer::Green
static

◆ Info

TracerProxy basic::Tracer::Info

Referenced by protocols::abinitio::JumpSpecificAbrelax::add_constraints(), protocols::abinitio::ApplicationContext::ApplicationContext(), MinToolMover::apply(), ScoreMover::apply(), ConstraintToolMover::apply(), RDCToolMover::apply(), SetupHotspotMover::apply(), LoopHashRelax_Sampler::apply(), attach_abego_pools(), attach_simple_abego_pools(), protocols::abinitio::JumpSpecificAbrelax::check_filters(), check_jump(), compute_chi(), compute_intrinsic_deviation(), protocols::abinitio::Application::copy_native_structure(), protocols::abinitio::JumpSpecificAbrelax::copy_native_structure(), protocols::abinitio::JumpSpecificAbrelax::copy_structure(), protocols::abinitio::JumpSpecificAbrelax::do_distributed_rerun(), protocols::abinitio::JumpSpecificAbrelax::do_rerun(), filter_frags(), find_disulfides(), protocols::abinitio::JumpSpecificAbrelax::fold(), SetupHotspotMover::generate_csts(), InjectorMover::hash(), protocols::abinitio::JumpSpecificAbrelax::initialize_constraint_forest(), FragMonteCarlo::initialize_frag_assignment(), FragMonteCarlo::load_scorefiles(), LoopBuild_main(), main(), read_RDC_file(), FragMonteCarlo::report_results(), FragMonteCarlo::report_score(), protocols::abinitio::Application::run(), run(), ThisApplication::run(), run_sandbox(), run_tyr_his(), sequence_tolerance_mf_main(), protocols::abinitio::JumpSpecificAbrelax::setup(), ThisApplication::setup(), setup_favor_native(), protocols::abinitio::JumpSpecificAbrelax::setup_fold(), protocols::abinitio::JumpSpecificAbrelax::setup_fragments(), setup_hotspot_filter(), protocols::abinitio::JumpSpecificAbrelax::setup_jumps(), protocols::abinitio::JumpSpecificAbrelax::setup_templates(), show_dna_geometry(), test_Tracer(), and write_cluster_frags().

◆ Magenta

utility::CSI::CSI_Enum basic::Tracer::Magenta
static

◆ muted_by_default_

bool basic::Tracer::muted_by_default_
private

Referenced by create_impl().

◆ priority_

TracerPriority basic::Tracer::priority_
private

◆ Red

utility::CSI::CSI_Enum basic::Tracer::Red
static

◆ Reset

utility::CSI::CSI_Enum basic::Tracer::Reset
static

◆ Trace

TracerProxy basic::Tracer::Trace

◆ Underline

utility::CSI::CSI_Enum basic::Tracer::Underline
static

◆ Warning

TracerProxy basic::Tracer::Warning

Referenced by protocols::abinitio::JumpSpecificAbrelax::add_constraints(), RescoreSAXS::apply(), CenRotRelaxMover::apply(), ConstraintConfig::apply_fa_csts(), build_full_model_test(), check_interface_symmetry(), check_number_of_poses(), protocols::abinitio::JumpSpecificAbrelax::close_loops(), cluster_silent(), count_analytically(), basic::thread_manager::RosettaThreadManager::do_multistage_work_vector_in_threads(), do_options_checks(), basic::thread_manager::RosettaThreadManager::do_work_vector_in_threads(), filter_combine_long_loop(), basic::database::full_name(), get_angles(), PoseWrap::get_closest_res_for_sc_attach(), basic::database::get_db_session(), get_distance(), get_distance_endpoint(), get_distance_midCA(), MPInterfaceStatistics::get_number_pi_stacking(), get_options_from_options_collection(), TCDock::init(), main(), my_main(), output_residue_types(), ConstraintConfig::parse_config_file(), basic::database::parse_database_connection(), PoseWrap::PoseWrap(), read_ERMS(), recover_clustered_frags(), reroot_restype(), run_aio(), set_basic_dock_options(), basic::database::set_cache_size(), ScoreEachBenchmark::setUp(), InteractionGraphPerformanceBenchmark::setup_for_sc12he(), InteractionGraphPerformanceBenchmark::setup_for_sc12sp2(), InteractionGraphPerformanceBenchmark::setup_for_score12(), InteractionGraphPerformanceBenchmark::setup_for_sp2hecart(), protocols::abinitio::JumpSpecificAbrelax::setup_fragments(), protocols::abinitio::JumpSpecificAbrelax::setup_jumps(), protocols::abinitio::JumpSpecificAbrelax::setup_templates(), HubDenovo::stupid_ddg(), swa_rna_cluster(), PoseWrap::switch_to_cen(), PoseWrap::switch_to_fa(), test_Tracer(), thread_fxn(), trim_back_t033_pose(), and write_cluster_frags().

◆ White

utility::CSI::CSI_Enum basic::Tracer::White
static

◆ Yellow

utility::CSI::CSI_Enum basic::Tracer::Yellow
static

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