Rosetta 3.3
Namespaces | Defines | Functions
src/utility/exit.hh File Reference

Program exit functions and macros. More...

#include <string>

Namespaces

namespace  utility
 

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


Defines

#define utility_exit()   utility::exit( __FILE__, __LINE__ )
 Macro function wrappers for utility::exit.
#define utility_exit_with_message(m)   utility::exit( __FILE__, __LINE__, m )
 Exit with file + line + message.
#define utility_exit_with_status(s)   utility::exit( __FILE__, __LINE__, s )
 Exit with file + line + status.
#define utility_exit_with_message_status(m, s)   utility::exit( __FILE__, __LINE__, m, s )
 Exit with file + line + message + status.
#define runtime_assert(_Expression)
 Assert that the condition holds. Evaluated for both debug and release builds.
#define runtime_assert_msg(_Expression, msg)
 Assert that the condition holds. Evaluated for both debug and release builds.

Functions

void utility::exit (std::string const &file, int const line, std::string const &message, int const status)
 Exit with file + line + message + optional status.
int utility::cond_exit (bool condition, std::string const &file, int const line, std::string const &message, int const status)
 Conditional Exit with file + line + message + optional status.
void utility::exit (std::string const &file, int const line, int const status=1)
 Exit with file + line + optional status.
void utility::exit (int const status, std::string const &file, int const line)
 Exit with file + line + status.
void utility::set_exit_callback (void(*my_callback)(void)=0)
 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 0, whicth mean no sys exit is called.

Detailed Description

Program exit functions and macros.

Author:
David Kim (dekim@u.washington.edu)
Sergey Lyskov (Sergey.Lyskov@jhu.edu)
Stuart G. Mentzer (Stuart_Mentzer@objexx.com)
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

Define Documentation

#define runtime_assert (   _Expression)
Value:
if ( !(_Expression) ) { \
    utility::cond_exit(_Expression, __FILE__, __LINE__, #_Expression); \
  }

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

Referenced by utility::options::VariantOption< VectorOption >::activate(), utility::options::VariantOption< VectorOption >::active(), DummyMover::apply(), MRMover::apply_makefrags(), utility::options::VariantOption< VectorOption >::cl_value(), utility::options::VariantOption< VectorOption >::clear(), basic::MetricValueBase::clone(), utility::options::VariantOption< VectorOption >::code(), numeric::MultiDimensionalHistogram::collapse(), composite_sequences_from_cmd_line(), utility::options::VariantOption< VectorOption >::deactivate(), utility::options::VariantOption< VectorOption >::default_size(), utility::options::VariantOption< VectorOption >::description(), utility::tag::Tag::getOption(), utility::tag::Tag::getTag(), utility::options::VariantOption< VectorOption >::id(), utility::options::VariantOption< VectorOption >::identifier(), UBQ_E2Mover::init_on_new_input(), numeric::jacobi(), utility::options::VariantOption< VectorOption >::key(), main(), match_main(), numeric::MultiDimensionalHistogram::mean_squared_error(), utility::options::VariantOption< VectorOption >::n_default_value(), utility::options::VariantOption< VectorOption >::n_value(), utility::options::VariantOption< VectorOption >::name(), utility::options::VariantOption< VectorOption >::operator Option &(), utility::options::VariantOption< VectorOption >::operator Option const &(), utility::options::VariantOption< VectorOption >::operator()(), utility::options::operator<(), utility::options::OptionCollection::operator[](), utility::options::OptionCollection::prefix(), utility::tag::Tag::read(), read_in_mutations(), set_ligpose_rotamer(), utility::options::VariantOption< VectorOption >::size(), basic::options::start_file(), utility::options::OptionCollection::suffix(), utility::options::OptionCollection::trim(), utility::options::OptionCollection::trimmed(), utility::options::VariantOption< VectorOption >::user(), utility::file::PathName::vol(), and utility::options::OptionCollection::wrapped().

#define runtime_assert_msg (   _Expression,
  msg 
)
Value:
if ( !(_Expression) ) { \
    utility::cond_exit(_Expression, __FILE__, __LINE__, #_Expression " MSG:" msg ); \
  }

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

#define utility_exit ( )    utility::exit( __FILE__, __LINE__ )

Macro function wrappers for utility::exit.

Note:
Convenience macros that fills in the file and line
These have to be macros to get the file and line from the point of call
Don't use variadic macros to reduce the "overloads": They aren't standard C++ Exit with file + line

Referenced by basic::check_cast(), utility::file::create_blank_file(), basic::options::int2afteroption(), basic::options::intafteroption(), main(), numeric::random::RandomGenerator::RandomGenerator(), APDBCMover::read_in_insert_loop_info(), basic::options::real2afteroption(), basic::options::real3afteroption(), basic::options::realafteroption(), numeric::sin_cos_range(), basic::options::start_files(), and basic::options::stringafteroption().

#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 AnchorFinderMover::AnchorFinderMover(), MRMover::apply_makefrags(), MRMover::apply_threading(), numeric::MathVector< core::Real >::assert_valid_position(), assure(), numeric::random::createRG(), numeric::interpolation::Histogram< X, Y >::derivative(), numeric::interpolation::Histogram< X, Y >::derivative_linear(), utility::tag::Tag::die_for_unaccessed_options(), utility::io::ozstream::enable_MPI_reroute(), extract_pdbs_test(), utility::factory::WidgetFactory< Creator >::factory_register(), basic::database::get_db_session(), get_file_vector_option(), get_option(), basic::options::get_option(), utility::sql_database::DatabaseSessionManager::get_session(), basic::svd::SVD_Solver::get_svd_solution(), numeric::interpolation::Histogram< X, Y >::interpolate(), numeric::interpolation::Histogram< X, Y >::interpolate_linear(), numeric::MathMatrix< core::Real >::IsValidPosition(), main(), make_sequence_change(), match_main(), numeric::interpolation::Histogram< X, Y >::maximum(), numeric::interpolation::Histogram< X, Y >::minimum(), basic::svd::SVD_Solver::operator=(), APDBCMover::read_in_insert_loop_info(), read_native_sequence_for_entity_elements(), utility::ReadFromFileOrDie(), utility::replace_environment_variables(), 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(), sequence_tolerance_main(), set_ligpose_rotamer(), basic::svd::SVD_Solver::set_matrix_A(), set_option(), basic::options::set_option(), numeric::interpolation::Histogram< X, Y >::set_params(), basic::svd::SVD_Solver::set_vector_b(), numeric::interpolation::spline_from_file(), basic::options::start_files(), and basic::svd::SVD_Solver::SVD_Solver().

#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 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
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines