w_rc_t Class Reference

Collaboration diagram for w_rc_t:

Collaboration graph
[legend]
List of all members.

Detailed Description

Return code for most functions and methods.

Note:
w_error_t::errcode_t sometimes used deep in storage manager rather than w_rc_t for one or more of these reasons:
An error code must be checked by some code, else it will report an "error-not-checked" when the system is built with
    configure --enable-checkrc
This is costly but useful for checking that code copes with errors. Of course, it does not do a static analysis; rather it is a dynamic check and so it cannot catch all code that ignores return codes.
Examples:

create_rec.cpp, init_config_options.cpp, log_exceed.cpp, sort_stream.cpp, startstop.cpp, and vtable_example.cpp.

Definition at line 130 of file w_rc.h.

Public Types

typedef w_error_t::err_num_t errcode_t
 w_error_t::errcode_t sometimes used deep in storage manager rather than w_rc_t. See detailed description, above.

Public Member Functions

NORET w_rc_t ()
 Default constructor: "no error".
NORET w_rc_t (w_error_t *e)
 Copy constructor: does a deep copy.
NORET w_rc_t (const char *const filename, w_base_t::uint4_t line_num, errcode_t err_num)
 Construct a return code with the given info. For use by macros.
NORET w_rc_t (const char *const filename, w_base_t::uint4_t line_num, errcode_t err_num, w_base_t::int4_t sys_err)
 Construct a return code with the given info. For use by macros.
 w_rc_t (const w_rc_t &other)
 Copy constructor: does a deep copy, does not delegate.
w_rc_toperator= (w_rc_t const &other)
 Copy operator: does a deep copy; does not delegate.
NORET ~w_rc_t ()
 Will croak if is_error() has not been called (configure --enable-checkrc).
bool is_error () const
 True if this return code is not rc_ok or equivalent.
errcode_t err_num () const
 return the integer error code, as found in the Perl-generated *_gen* header files
w_base_t::int4_t sys_err_num () const
 return the (optional) system error code, if there is one
w_rc_treset ()
 Re-initialize this return code to rc_ok equivalence.
w_rc_tadd_trace_info (const char *const filename, w_base_t::uint4_t line_num)
 Add tracing info on the stack for the top error number. Used by macros.
w_rc_tpush (const char *const filename, w_base_t::uint4_t line_num, errcode_t err_num)
 Push another error number onto the stack. Used by macros.
void verify ()
void error_not_checked ()
 Issue error when a return code leaves scope without being checked.
void fatal ()
 Choke.
w_error_t const * operator-> () const
w_error_toperator-> ()
 non-const needed for rc->append_more_info in the RC_APPEND macros
w_error_tdelegate ()
 public so that sm code and be explicit about delegating if need be
bool is_unchecked ()
 turned public for testing

Static Public Member Functions

static void set_return_check (bool on_off, bool fatal)
 Not for general use. Used by configure --enable-checkrc.

Static Public Attributes

static const w_rc_t rc_ok
 Static const return code meaning "no error".

Friends

ostream & operator<< (ostream &o, const w_rc_t &obj)


Member Function Documentation

bool w_rc_t::is_error (  )  const [inline]

True if this return code is not rc_ok or equivalent.

This must be called for every w_rc_t before destruction. The idiomatic macros W_DO and its companions do that check for you, and should be used most of the time.

See also the following macros:

Examples:
create_rec.cpp, init_config_options.cpp, log_exceed.cpp, sort_stream.cpp, startstop.cpp, and vtable_example.cpp.

Definition at line 444 of file w_rc.h.

References w_error_t::no_error.

Referenced by option_group_t::add_option(), devid_t::devid_t(), option_group_t::lookup_by_class(), option_group_t::parse_command_line(), option_stream_scan_t::scan(), and latch_t::upgrade_if_not_block().

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Wed Jul 7 17:22:44 2010 for Shore Storage Manager by  doxygen 1.4.7