Zero  0.1.0
Classes | Macros | Typedefs | Functions | Variables
w_rc.h File Reference
#include <cstdint>
#include <memory.h>
#include <ostream>
#include <iostream>
#include <sstream>
#include <cassert>
#include <cstdlib>
#include "w_error.h"

Go to the source code of this file.

Classes

class  w_rc_t
 Return code for most functions and methods. More...
 

Macros

#define RC(e)   w_rc_t(__FILE__, __LINE__, e)
 Normal error-case return. Create a return code with the current file, line, and error code x. This is the normal way to return from a method or function. More...
 
#define RC_AUGMENT(rc)   w_rc_t(rc, __FILE__, __LINE__)
 Augment stack trace. Add stack trace information (file, line) to a return code. This is the normal way to return from a method or function upon receiving an error from a method or function that it called. Used by W_DO(x), W_DO_MSG(x,m), and W_COERCE(x) e.g. w_rc_t rc = create_file(f); if (rc.is_error()) return RC_AUGMENT(rc); rc = close_file(f);. More...
 
#define RC_APPEND_MSG(rc, m)
 Appends more arbitrary string information to the return code. More...
 
#define W_RETURN_RC_MSG(e, m)
 Retrun with a return code that contains the given error code and additional message. More...
 
#define W_DO(x)
 Call a method or function x. This macro is the normal idiom for calling a method or function. Most methods and functions return a w_rc_t. This macro calls x and checks its returned value. If an error is encountered, it immediately returns from the current function or method, augmenting the stack trace held by the return code. More...
 
#define W_DO_MSG(x, m)
 Call a method or function x. More...
 
#define W_COERCE(x)
 Call a function or method x, fail catastrophically if error is returned. More...
 
#define W_COERCE_MSG(x, m)
 Same as W_COERCE(x) but adds a string message before croaking. More...
 
#define W_FATAL(e)   W_COERCE(RC(e))
 Croak with the error code e. More...
 
#define W_FATAL_MSG(e, m)   W_COERCE_MSG(RC(e), m)
 Croak with the error code e and message m. More...
 
#define W_IGNORE(x)   ((void) x.is_error())
 Invoke x and ignore its result. More...
 

Typedefs

typedef w_rc_t rc_t
 

Functions

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

Variables

const uint16_t MAX_RCT_STACK_DEPTH = 8
 Constant to define maximum stack trace depth for w_rc_t. More...
 
const w_rc_t RCOK
 

Typedef Documentation

§ rc_t

typedef w_rc_t rc_t

Function Documentation

§ operator<<()

std::ostream& operator<< ( std::ostream &  o,
const w_rc_t obj 
)
inline

Variable Documentation

§ RCOK

const w_rc_t RCOK