Rosetta  2020.11
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces | Macros | Typedefs | Functions
exit.hh File Reference

Program exit functions and macros. More...

#include <string>

Classes

class  utility_exit_detail::Stringy
 
class  utility_exit_detail::Stringifier
 

Namespaces

 utility_exit_detail
 
 utility
 unresizable vector whose size is known at compile time, which may be allocated on the stack, and which indexes from 0.
 

Macros

#define user_fixable_issue_exit(...)   utility::exit_with_user_fixable_issue( __FILE__, __LINE__, utility_exit_detail::Stringifier{ __VA_ARGS__ }.get_string() )
 Macro for an exit with an issue which doesn't trigger the crash reporter system These need to have parameters, which are used to create the user message. More...
 
#define user_fixable_issue_assert(_Expression,...)   if ( !(_Expression) ) utility::exit_with_user_fixable_issue(__FILE__, __LINE__, utility_exit_detail::Stringifier{ __VA_ARGS__ }.get_string() )
 
#define utility_exit()   utility::exit( __FILE__, __LINE__ )
 Macro function wrappers for utility::exit. More...
 
#define utility_exit_with_message(m)   utility::exit( __FILE__, __LINE__, m )
 Exit with file + line + message. More...
 
#define utility_exit_with_status(s)   utility::exit( __FILE__, __LINE__, s )
 Exit with file + line + status. More...
 
#define utility_exit_with_message_status(m, s)   utility::exit( __FILE__, __LINE__, m, s )
 Exit with file + line + message + status. More...
 
#define runtime_assert(_Expression)   if ( !(_Expression) ) utility::exit(__FILE__, __LINE__, "Assertion `" #_Expression "` failed.")
 Assert that the condition holds. Evaluated for both debug and release builds. More...
 
#define runtime_assert_msg(_Expression, msg)   if ( !(_Expression) ) utility::exit(__FILE__, __LINE__, "Assertion `" #_Expression "` failed. MSG:" msg )
 Assert that the condition holds. Evaluated for both debug and release builds. More...
 
#define runtime_assert_string_msg(_Expression, msg)   if ( !(_Expression) ) utility::exit(__FILE__, __LINE__, msg )
 Assert that the condition holds. Evaluated for both debug and release builds. More...
 
#define NORETURN
 

Typedefs

typedef void(* utility::UtilityExitCallBack )()
 

Functions

void utility::exit_with_user_fixable_issue (char const *file, int line, std::string const &message) NORETURN
 Exit in cases where there's a clear issue the user can fix. More...
 
void utility::exit (char const *file, int const line, std::string const &message, int const )
 Exit with file + line + message + optional status. More...
 
int utility::cond_exit (bool condition, char const *file, int const line, std::string const &message, int const status)
 Conditional Exit with file + line + message + optional status. More...
 
void utility::exit (char const *file, int const line, int const status=1) NORETURN
 Exit with file + line + optional status. More...
 
void utility::exit (int const status, char const *file, int const line)
 Exit with file + line + status. More...
 
void utility::set_main_exit_callback (UtilityExitCallBack=nullptr)
 Set call back funtion that will be called on utility::exit. Use this function to overload default behavior of sys.exit to more appropriate to your application Defaut value for callback function is nullptr, whicth mean no sys exit is called. More...
 
void utility::add_exit_callback (UtilityExitCallBack)
 Add additional callback function that will be called before standard exit(…) is executed. [Note: do not confuse this function with 'set_main_exit_callback' which is replacing the end behavior of exit(…)]. More...
 
void utility::remove_exit_callback (UtilityExitCallBack)
 Remove additional callback function that was previously added by using add_exit_callback. More...
 

Detailed Description

Program exit functions and macros.

Author
David Kim (dekim.nosp@m.@u.w.nosp@m.ashin.nosp@m.gton.nosp@m..edu)
Sergey Lyskov (Serge.nosp@m.y.Ly.nosp@m.skov@.nosp@m.jhu..nosp@m.edu)
Stuart G. Mentzer (Stuar.nosp@m.t_Me.nosp@m.ntzer.nosp@m.@obj.nosp@m.exx.c.nosp@m.om)
Note
The point of these is:
  • Show the file and line number where the exit originates
  • Optionally show a message about why the exit occurred
  • Provide a core dump on Linux/UNIX so a post-mortem backtrace can be performed
  • Provide macro functions to add the file and line for you
Break on utility::exit when debugging to allow you to get a backtrace from the point of exit

Macro Definition Documentation

#define NORETURN
#define runtime_assert (   _Expression)    if ( !(_Expression) ) utility::exit(__FILE__, __LINE__, "Assertion `" #_Expression "` failed.")

Assert that the condition holds. Evaluated for both debug and release builds.

Referenced by numeric::access_Real_MathNTensor(), utility::options::VariantOption< VectorOption >::activate(), utility::options::VariantOption< VectorOption >::active(), RNA_DeNovoJobQueen::add_chem_shift_info(), add_protocols(), all_pair_energies(), MetalSiteFinderMover::apply(), FitMover::apply(), calc_scores(), calculate_res_map(), basic::citation_manager::CitationCollection::CitationCollection(), utility::options::VariantOption< VectorOption >::cl_value(), utility::options::VariantOption< VectorOption >::clear(), ScoreFragmentSetMover::closability_score(), utility::options::VariantOption< VectorOption >::code(), numeric::MultiDimensionalHistogram::collapse(), numeric::comma_seperated_string_to_xyz(), composite_sequences_from_cmd_line(), compute_folding_energies(), numeric::const_access_Real_MathNTensor(), count_analytically_cyclic(), count_analytically_improper_rotational(), count_numerically(), count_semi_analytically_improper_rotational(), numeric::MathNTensor< double, 2 >::data(), utility::options::VariantOption< VectorOption >::deactivate(), utility::options::VariantOption< VectorOption >::default_size(), densityTools(), utility::options::VariantOption< VectorOption >::description(), do_erraser2(), figure_out_which_sequence_is_template(), filter_combine_long_loop(), get_bps_seq(), basic::citation_manager::CitationCollection::get_enumerated_module_type_name(), get_mutations_from_file(), numeric::interpolation::get_patch(), numeric::interpolation::spline::get_PolycubicSpline_F(), numeric::interpolation::spline::get_PolycubicSpline_gradient(), numeric::get_Real_MathNTensor_dimension_size(), utility::get_resnum_and_segid_from_one_tag(), numeric::interpolation::get_val(), go_main(), utility::options::VariantOption< VectorOption >::id(), utility::options::VariantOption< VectorOption >::identifier(), UBQ_GTPase_disulfide_Mover::init_on_new_input(), UBQ_E2Mover::init_on_new_input(), utility::graph::LowMemNode::internal_find_edge(), invariants_for_cyclic_permutation(), utility::options::VariantOption< VectorOption >::key(), numeric::VoxelArray< _Float, _Value >::load(), main(), BuildFullModel::make_built_residues_repulsive(), utility::make_segtag_with_dashes(), utility::make_tag_with_dashes(), numeric::MathNTensor< double, 2 >::MathNTensor(), MC_run(), numeric::MultiDimensionalHistogram::mean_squared_error(), mg_modeler_test(), ExposedStrandMover::move_superimpose(), my_main(), utility::options::VariantOption< VectorOption >::n_default_value(), utility::options::VariantOption< VectorOption >::n_value(), utility::options::VariantOption< VectorOption >::name(), nucleobase_probe_score_test(), utility::options::VariantOption< VectorOption >::operator Option &(), utility::options::VariantOption< VectorOption >::operator Option *(), utility::options::VariantOption< VectorOption >::operator Option const &(), utility::options::VariantOption< VectorOption >::operator Option const *(), utility::options::VariantOption< VectorOption >::operator()(), numeric::MathNTensor< double, 2 >::operator()(), utility::options::OptionCollection::operator()(), utility::options::operator<(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::operator[](), utility::options::OptionCollection::operator[](), output_general_base_pair_steps(), post_rebuild_bulge_assembly(), utility::options::OptionCollection::prefix(), Prepare(), prepare_threaded_model(), DockFragmentsMover::process_fragfile(), read_in_mutations(), numeric::read_tensor_from_file(), rebuild_test(), numeric::MathNTensor< double, 2 >::replace_layer(), utility::options::ResidueChainVectorOption::resnum_and_chain(), reverse_convert(), rna_design_test(), rna_features_from_pose(), rna_sample_virtual_sugar(), rna_superimpose_and_graft_test(), rna_thread_test(), ScoreFragmentSetMover::run(), save_feature(), utility::options::OptionCollection::set_option_value_cl(), utility::options::OptionCollection::set_option_value_file(), numeric::MathNTensor< double, 2 >::set_value(), utility::options::VariantOption< VectorOption >::size(), basic::options::start_file(), utility::options::OptionCollection::suffix(), superimpose_pdb(), swa_rna_cluster(), thermal_sampler(), utility::options::OptionCollection::trim(), utility::options::OptionCollection::trimmed(), basic::citation_manager::UnpublishedModuleInfo::UnpublishedModuleInfo(), numeric::random::WeightedSampler::update_cumulative_distribution(), utility::options::VariantOption< VectorOption >::user(), numeric::MathNTensor< double, 2 >::value(), utility::file::PathName::vol(), and utility::options::OptionCollection::wrapped().

#define runtime_assert_msg (   _Expression,
  msg 
)    if ( !(_Expression) ) utility::exit(__FILE__, __LINE__, "Assertion `" #_Expression "` failed. MSG:" msg )
#define runtime_assert_string_msg (   _Expression,
  msg 
)    if ( !(_Expression) ) utility::exit(__FILE__, __LINE__, msg )

Assert that the condition holds. Evaluated for both debug and release builds.

Referenced by numeric::access_Real_MathNTensor(), basic::citation_manager::AuthorNames::AuthorNames(), basic::citation_manager::CitationCollection::CitationCollection(), numeric::const_access_Real_MathNTensor(), basic::thread_manager::RosettaThreadManager::do_multistage_work_vector_in_threads(), do_options_checks(), basic::thread_manager::RosettaThreadManager::do_work_vector_in_threads(), basic::thread_manager::RosettaThreadManager::do_work_vector_in_threads_no_locking(), numeric::MathNTensor< double, 2 >::get_mathmatrix(), numeric::get_Real_MathNTensor_dimension_size(), utility::xsd_util::get_rosetta_module_options_from_xsd(), basic::citation_manager::Citation::initialize_from_string(), main(), numeric::MathNTensor< double, 2 >::operator()(), basic::citation_manager::Citation::parse_authors(), utility::parse_boolean(), utility::parse_out(), basic::citation_manager::Citation::parse_string_entry(), basic::citation_manager::Citation::parse_year(), basic::citation_manager::CitationManager::populate_doi_rosetta_citation_map(), numeric::principal_components_and_eigenvalues_ndimensions(), basic::thread_manager::RosettaThreadManagerInitializationTracker::RosettaThreadManagerInitializationTracker(), basic::thread_manager::RosettaThreadManager::run_function_in_threads(), basic::citation_manager::Citation::set_year_and_article(), InteractionGraphPerformanceBenchmark::setup_for_current_default_sfxn(), utility::libsvm::Svm_rosetta::Svm_rosetta(), and basic::citation_manager::UnpublishedModuleAuthor::UnpublishedModuleAuthor().

#define user_fixable_issue_assert (   _Expression,
  ... 
)    if ( !(_Expression) ) utility::exit_with_user_fixable_issue(__FILE__, __LINE__, utility_exit_detail::Stringifier{ __VA_ARGS__ }.get_string() )
#define user_fixable_issue_exit (   ...)    utility::exit_with_user_fixable_issue( __FILE__, __LINE__, utility_exit_detail::Stringifier{ __VA_ARGS__ }.get_string() )

Macro for an exit with an issue which doesn't trigger the crash reporter system These need to have parameters, which are used to create the user message.

As a convenience, you can pass multiple parameters to these macros, all of which will be stringified and concatenated into the message. E.g.:

user_fixable_issue_exit( "Loops file `", filename, "` has only ", num_entry, " entries on line ", lineno, ". It needs at least 3.");

Note
Since C++11, variadic macros are part of C++
#define utility_exit ( )    utility::exit( __FILE__, __LINE__ )
#define utility_exit_with_message (   m)    utility::exit( __FILE__, __LINE__, m )

Exit with file + line + message.

Note
The m argument is a message string

Referenced by numeric::access_Real_MathNTensor(), numeric::expression_parser::ArithmeticScanner::add_function(), add_protocols(), numeric::expression_parser::ArithmeticScanner::add_variable(), numeric::expression_parser::SimpleExpressionCreator::add_variable(), align_pdbs(), align_pose_general(), AnchorFinderMover::AnchorFinderMover(), DummyMover::apply(), MPDomainAssembly::apply(), RNA_ScoreMover::apply(), numeric::MathVector< double >::assert_valid_position(), IAMover::assign_IA_mover(), assure(), HDmakerMover::bb_score(), utility::sql_database::session::begin_transaction(), basic::database::insert_statement_generator::InsertGenerator::bind_row_data(), build_full_model_test(), calc_dihedral_rms(), calculate_pairwise_RMSD(), check_alignment_RMSD_cutoff(), check_all_poses_have_the_same_sequence(), check_pose_size(), check_sequence(), check_single_chain(), basic::database::check_statement_sanity(), cluster_test(), utility::sql_database::session::commit_transaction(), RNA_DeNovoJobQueen::complete_larval_job_maturation(), compute_chem_shift_RMSD(), numeric::const_access_Real_MathNTensor(), count_analytically_cyclic(), count_semi_analytically_improper_rotational(), utility::graph::ArrayPool< T >::create_new_block(), basic::resource_manager::ResourceManagerFactory::create_resource_manager_from_options_system(), create_scorefxn(), numeric::random::createRG(), cs_rosetta_rna_pdb(), utility::file::cwd(), utility::sql_database::database_mode_from_name(), numeric::statistics::Dawson(), basic::database::db_partition_from_options(), utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::DenseBoolMap(), densityTools(), numeric::interpolation::Histogram< typename, typename >::derivative(), numeric::interpolation::Histogram< typename, typename >::derivative_linear(), basic::mpi::DbMoverMessageListener::deserialize_data(), utility::tag::Tag::die_for_unaccessed_options(), numeric::expression_parser::BinaryExpression::e1(), numeric::expression_parser::BinaryExpression::e2(), utility::io::ozstream::enable_MPI_reroute(), erraser2_test(), numeric::statistics::errf(), numeric::expression_parser::UnaryExpression::ex(), basic::execute(), extract_pdbs_test(), utility::factory::WidgetFactory< Creator >::factory_register(), basic::resource_manager::ResourceLocatorFactory::factory_register(), basic::resource_manager::ResourceLoaderFactory::factory_register(), figure_out_which_sequence_is_template(), basic::database::find_database_path(), utility::sql_database::session::force_commit_transaction(), utility::graph::RingEdgeAnnotationVisitor< Graph, EdgeMap, PathMap >::forward_or_cross_edge(), utility::from_string(), full_length_rmsd_over_reside_list_general(), numeric::expression_parser::ArithmeticASTFunction::function(), numeric::RocCurve::generate_roc_curve(), utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::get(), basic::citation_manager::CitationManager::get_citation_by_doi(), basic::database::get_db_session(), utility::sql_database::DatabaseSessionManager::get_db_session(), basic::citation_manager::Citation::get_formatted_citation(), utility::io::get_lines_from_file_data(), basic::mpi::MessageListenerFactory::get_listener(), basic::options::get_option(), numeric::interpolation::spline::get_PolycubicSpline_F(), numeric::interpolation::spline::get_PolycubicSpline_gradient(), numeric::get_Real_MathNTensor_dimension_size(), utility::sql_database::DatabaseSessionManager::get_session_mysql(), utility::sql_database::DatabaseSessionManager::get_session_postgres(), get_stepwise_score_function(), basic::svd::SVD_Solver::get_svd_solution(), numeric::interpolation::get_val(), numeric::expression_parser::SimpleExpressionCreator::get_variable(), numeric::expression_parser::ExpressionCreator::handle_function_expression(), numeric::expression_parser::BooleanExpressionCreator::handle_function_expression(), numeric::expression_parser::ExpressionCreator::handle_variable_expression(), numeric::expression_parser::SimpleExpressionCreator::handle_variable_expression(), harvest_motifs(), harvest_motifs_one(), harvest_scores(), import_and_dump_pdb(), apps::pilot::frankdt::import_motifs(), utility::vectorL< 1, std::string, A >::index_of(), numeric::geometry::hashing::xyzStripeHash::init(), numeric::geometry::hashing::xyzStripeHashWithMeta< float >::init(), initialize_native_pose(), basic::database::insert_or_ignore(), numeric::RocCurve::insert_point(), insert_stage_tag(), numeric::interpolation::Histogram< typename, typename >::interpolate(), numeric::interpolation::Histogram< typename, typename >::interpolate_linear(), apps::pilot::frankdt::invalid_motif(), numeric::MathMatrix< float >::IsValidPosition(), numeric::expression_parser::ArithmeticASTValue::literal_value(), main(), apps::pilot::frankdt::main(), make_sequence_change(), numeric::interpolation::make_spline(), match_main(), numeric::interpolation::Histogram< typename, typename >::maximum(), merge_motifs(), mg_modeler_test(), numeric::interpolation::Histogram< typename, typename >::minimum(), my_main(), utility::sql_database::name_from_database_mode(), utility::sql_database::name_from_transaction_mode(), basic::mpi::name_to_listener_tag(), utility::sql_database::session::open_mysql_session(), utility::sql_database::session::open_postgres_session(), utility::sql_database::session::open_sqlite3_session(), utility::options::OptionCollection::operator()(), basic::svd::SVD_Solver::operator=(), utility::options::OptionCollection::operator[](), output_superimposed_pdb(), numeric::expression_parser::ArithmeticASTExpression::parse(), numeric::expression_parser::ArithmeticASTFunction::parse(), numeric::expression_parser::ArithmeticASTTerm::parse(), numeric::expression_parser::ArithmeticASTFactor::parse(), numeric::expression_parser::ArithmeticASTOrClause::parse(), numeric::expression_parser::ArithmeticASTAndClause::parse(), numeric::expression_parser::ArithmeticASTValue::parse(), basic::database::parse_database_connection(), pdb_to_silent_file(), numeric::expression_parser::TokenSet::pop(), post_rebuild_bulge_assembly(), basic::database::schema_generator::Column::print(), basic::database::schema_generator::DbText::print(), basic::database::schema_generator::Index::print(), basic::database::schema_generator::DbTextKey::print(), basic::database::schema_generator::ForeignKey::print(), basic::database::schema_generator::DbBigInt::print(), basic::database::schema_generator::DbDouble::print(), basic::database::schema_generator::DbReal::print(), basic::database::schema_generator::DbUUID::print(), APDBCMover::read_in_insert_loop_info(), read_input_weights(), read_native_sequence_for_entity_elements(), numeric::read_probabilities_or_die(), read_rama_map_file(), read_structures(), numeric::read_tensor_from_file(), utility::replace_environment_variables(), basic::mpi::request_data_from_head_node(), numeric::expression_parser::ArithmeticASTRestExpression::rest_expression_token(), numeric::expression_parser::ArithmeticASTRestTerm::rest_term_token(), rna_build_helix_test(), rna_fullatom_minimize_test(), rna_thread_test(), numeric::xyzTransform< numeric::Real >::rotation_axis(), basic::svd::SVD_Solver::run_decomp_svd(), run_pep_prep(), basic::svd::SVD_Solver::run_score_svd_on_matrix(), basic::svd::SVD_Solver::run_score_svd_without_solving(), basic::svd::SVD_Solver::run_solve_svd(), RunPepSpec(), basic::database::safely_prepare_statement(), basic::database::safely_read_from_database(), basic::database::safely_write_to_database(), numeric::geometry::hashing::xyzStripeHash::sanity_check(), numeric::geometry::hashing::xyzStripeHashWithMeta< float >::sanity_check(), numeric::expression_parser::ArithmeticScanner::scan(), numeric::expression_parser::ArithmeticScanner::scan_identifier(), numeric::expression_parser::ArithmeticScanner::scan_literal(), basic::mpi::send_data_to_head_node(), sequence_tolerance_main(), utility::DenseBoolMap< NUM_ELEMS, BASE_INDEX >::set(), utility::graph::ArrayPool< T >::set_array_size(), utility::graph::ArrayPool< T >::set_block_size(), basic::TracerImpl::set_ios_hook(), basic::svd::SVD_Solver::set_matrix_A(), basic::TracerImpl::set_new_final_stream(), basic::options::set_option(), numeric::interpolation::Histogram< typename, typename >::set_params(), basic::svd::SVD_Solver::set_vector_b(), InteractionGraphPerformanceBenchmark::setUp(), slice_ellipsoid_envelope(), slice_sample_res_and_surrounding(), numeric::interpolation::spline_from_file(), basic::options::start_files(), apps::pilot::frankdt::store_segment_motif_match(), utility::string_split(), basic::svd::SVD_Solver::SVD_Solver(), basic::svd::SVD_Solver::svdcmp(), swa_rna_cluster(), basic::database::table_exists(), basic::database::schema_generator::Schema::table_init_statements(), basic::database::schema_generator::Schema::table_schema_statements(), numeric::expression_parser::TokenSet::top(), basic::TracerToFile::TracerToFile(), numeric::interpolation::spline::PolycubicSpline< 1 >::train(), numeric::interpolation::spline::PolycubicSpline< 2 >::train(), utility::sql_database::transaction_mode_from_name(), utility::py::Value::Value(), numeric::expression_parser::ArithmeticASTValue::variable_name(), numeric::expression_parser::ASTPrinter::visit(), numeric::expression_parser::ExpressionCreator::visit(), numeric::write_tensor_to_file(), basic::database::insert_statement_generator::InsertGenerator::write_to_database(), and utility::graph::ArrayPool< T >::~ArrayPool().

#define utility_exit_with_message_status (   m,
 
)    utility::exit( __FILE__, __LINE__, m, s )

Exit with file + line + message + status.

Note
The m argument is a message string
The s argument is a status value

Referenced by ExposedStrandMover::apply(), and main().

#define utility_exit_with_status (   s)    utility::exit( __FILE__, __LINE__, s )

Exit with file + line + status.

Note
The s argument is a status value