guards Namespace Reference

guards is a collection of methods for reporting errors. More...


Functions

void write_to_console (const char *message)
 Prints out a message to the standard error file stream.
void alert_message (const char *info, const char *title="Alert Message")
 shows the message in "info", with an optional "title" on the message.
void alert_message (const istring &info)
void alert_message (const istring &info, const istring &title)
void make_error_message (const char *file, int line, const char *error_class, const char *error_function, const char *info, char *guards_message_space)
 Used to build our particular type of error message.
void FL_deadly_error (const char *file, int line, const char *classname, const char *function_name, const char *info)
 Prints out an error message and then exits the program.
void FL_deadly_error (const istring &file, int line, const istring &classname, const istring &function_name, const istring &info)
 A version that takes strings instead of char pointers.
void FL_continuable_error_real (const char *file, int line, const char *error_class, const char *error_function, const char *info, const char *title)
void FL_continuable_error (const char *file, int line, const char *classname, const char *function_name, const char *info, const char *title)
 Describes an error like deadly_error, but does not exit the program.
void FL_continuable_error (const istring &file, int line, const istring &classname, const istring &function_name, const istring &info, const istring &title)
 A version using istring instead of char pointers.
void FL_non_continuable_error (const char *file, int line, const char *classname, const char *function_name, const char *info, const char *title)
 Shows the same information as continuable_error, but causes an exit.
void FL_non_continuable_error (const istring &file, int line, const istring &classname, const istring &function_name, const istring &info, const istring &title)
 A version using istring instead of char pointers.
void FL_console_error (const char *file, int line, const char *error_class, const char *error_function, const char *info)
 Prints out an error message to the standard error file stream.
void FL_out_of_memory_now (const char *file, int line, const char *classname, const char *function_name)
 Causes the program to exit due to a memory allocation failure.
void implement_bounds_halt (const char *the_class_name, const char *func, const char *value, const char *low, const char *high, const char *error_addition)
 Provides the real implementation of bounds_halt to save code space.
template<class contents>
bool in_range (const contents &value, const contents &low, const contents &high)
 Returns true if the value is within the range specified.

Variables

const int MESSAGE_SPACE_PROVIDED = 4096


Detailed Description

guards is a collection of methods for reporting errors.

It also provides checking of boundary conditions, macros for causing immediate program exit, and other sentinels for constructing preconditions and postconditions.


Function Documentation

void guards::alert_message ( const istring info,
const istring title 
)

Definition at line 64 of file guards.cpp.

References alert_message(), and istring::s().

void guards::alert_message ( const istring info  ) 

Definition at line 62 of file guards.cpp.

References alert_message(), and istring::s().

void guards::alert_message ( const char *  info,
const char *  title = "Alert Message" 
)

shows the message in "info", with an optional "title" on the message.

the message is sent to the program wide logger, if one is expected to exist in this program.

Definition at line 40 of file guards.cpp.

References log_base::log(), NIL, log_base::platform_ending(), and program_wide_logger().

Referenced by alert_message(), FL_continuable_error_real(), formal(), main(), version_ini::one_stop_version_stamp(), and test_string_table().

void guards::FL_console_error ( const char *  file,
int  line,
const char *  error_class,
const char *  error_function,
const char *  info 
)

Prints out an error message to the standard error file stream.

Definition at line 162 of file guards.cpp.

References make_error_message(), MESSAGE_SPACE_PROVIDED, and write_to_console().

void guards::FL_continuable_error ( const istring file,
int  line,
const istring error_class,
const istring error_function,
const istring info,
const istring title 
)

A version using istring instead of char pointers.

Definition at line 136 of file guards.cpp.

References FL_continuable_error_real(), and istring::s().

void guards::FL_continuable_error ( const char *  file,
int  line,
const char *  error_class,
const char *  error_function,
const char *  info,
const char *  title 
)

Describes an error like deadly_error, but does not exit the program.

Definition at line 128 of file guards.cpp.

References FL_continuable_error_real().

Referenced by FL_deadly_error().

void guards::FL_continuable_error_real ( const char *  file,
int  line,
const char *  error_class,
const char *  error_function,
const char *  info,
const char *  title 
)

Definition at line 112 of file guards.cpp.

References alert_message(), make_error_message(), and MESSAGE_SPACE_PROVIDED.

Referenced by FL_continuable_error(), and FL_non_continuable_error().

void guards::FL_deadly_error ( const istring file,
int  line,
const istring error_class,
const istring error_function,
const istring info 
)

A version that takes strings instead of char pointers.

Definition at line 104 of file guards.cpp.

References FL_deadly_error(), and istring::s().

void guards::FL_deadly_error ( const char *  file,
int  line,
const char *  classname,
const char *  function_name,
const char *  info 
)

Prints out an error message and then exits the program.

The parameters describe the location where the error was detected. This call should only be used in test programs or where absolutely necessary because it causes an almost immediate exit from the program! deadly_error should be reserved for when the program absolutely has to exit right then, because this function will actually enforce a crash / abort / break into debugger action rather than just calling exit().

Definition at line 92 of file guards.cpp.

References CAUSE_BREAKPOINT, and FL_continuable_error().

Referenced by FL_deadly_error().

void guards::FL_non_continuable_error ( const istring file,
int  line,
const istring error_class,
const istring error_function,
const istring info,
const istring title 
)

A version using istring instead of char pointers.

Definition at line 153 of file guards.cpp.

References FL_continuable_error_real(), and istring::s().

void guards::FL_non_continuable_error ( const char *  file,
int  line,
const char *  classname,
const char *  function_name,
const char *  info,
const char *  title 
)

Shows the same information as continuable_error, but causes an exit.

This is a friendlier program exit than deadly_error. This version can be used when the program must stop, possibly because of a precondition failure or a problem in input data or basically whatever. it is not intended to abort or break into the debugger, but to simply exit().

Definition at line 144 of file guards.cpp.

References FL_continuable_error_real().

Referenced by FL_out_of_memory_now().

void guards::FL_out_of_memory_now ( const char *  file,
int  line,
const char *  the_class_name,
const char *  the_func 
)

Causes the program to exit due to a memory allocation failure.

Definition at line 171 of file guards.cpp.

References FL_non_continuable_error().

void guards::implement_bounds_halt ( const char *  the_class_name,
const char *  the_func,
const char *  value,
const char *  low,
const char *  high,
const char *  error_addition 
)

Provides the real implementation of bounds_halt to save code space.

Definition at line 179 of file guards.cpp.

References continuable_error, and deadly_error.

template<class contents>
bool guards::in_range ( const contents &  value,
const contents &  low,
const contents &  high 
) [inline]

Returns true if the value is within the range specified.

Definition at line 33 of file guards.h.

void guards::make_error_message ( const char *  file,
int  line,
const char *  error_class,
const char *  error_function,
const char *  info,
char *  guards_message_space 
)

Used to build our particular type of error message.

It writes an error message into "guards_message_space" using our stylized object::method formatting.

Definition at line 67 of file guards.cpp.

References utility::timestamp().

Referenced by FL_console_error(), and FL_continuable_error_real().

void guards::write_to_console ( const char *  guards_message_space  ) 

Prints out a message to the standard error file stream.

Definition at line 37 of file guards.cpp.

Referenced by FL_console_error().


Variable Documentation

const int guards::MESSAGE_SPACE_PROVIDED = 4096

Definition at line 33 of file guards.cpp.

Referenced by FL_console_error(), and FL_continuable_error_real().


Generated on Fri Nov 28 04:31:06 2008 for HOOPLE Libraries by  doxygen 1.5.1