icedb  version 0.5.1
Snow particle scattering database API
Classes | Macros | Typedefs | Variables
Errors

Classes

struct  ICEDB_error_container_ftable
 A convenience wrapper for all error functions. More...
 
struct  ICEDB_error_context_var_val
 
struct  ICEDB_error_context
 
struct  ICEDB_error_context_container_ftable
 A convenience wrapper for all error functions. More...
 

Macros

#define ICEDB_error_context_create(x)   ICEDB_error_context_create_impl(x, (__FILE__), (int)__LINE__,(ICEDB_DEBUG_FSIG));
 
#define ICEDB_error_context_append   ICEDB_error_context_appendA
 
#define ICEDB_error_context_append_str   ICEDB_error_context_append_strA
 
#define ICEDB_error_context_add_string   ICEDB_error_context_add_stringA
 
#define ICEDB_error_context_add_string2   ICEDB_error_context_add_string2A
 

Typedefs

typedef int ICEDB_error_code
 
typedef size_t(* ICEDB_error_code_to_message_size_f) (ICEDB_error_code err)
 
typedef size_t(* ICEDB_error_code_to_message_f) (ICEDB_error_code err, size_t buf_size, char *buf)
 
typedef size_t(* ICEDB_error_code_to_stream_f) (ICEDB_error_code err, FILE *fp)
 
typedef struct ICEDB_error_context *(* ICEDB_get_error_context_thread_local_f) ()
 
typedef void(* ICEDB_error_context_deallocate_f) (struct ICEDB_error_context *)
 
typedef ICEDB_error_code(* ICEDB_error_context_to_code_f) (const struct ICEDB_error_context *)
 
typedef size_t(* ICEDB_error_context_to_message_size_f) (const struct ICEDB_error_context *)
 
typedef size_t(* ICEDB_error_context_to_message_f) (const struct ICEDB_error_context *err, size_t buf_size, char *buf)
 
typedef size_t(* ICEDB_error_context_to_stream_f) (const struct ICEDB_error_context *err, FILE *fp)
 
typedef ICEDB_error_code(* ICEDB_error_test_f) ()
 
typedef const char *(* ICEDB_error_getOSname_f) ()
 Convenience function that returns an immutable string describing the OS type. Staticly allocated. More...
 
typedef struct ICEDB_error_context *(* ICEDB_error_context_create_impl_f) (int, const char *, int, const char *)
 
typedef struct ICEDB_error_context *(* ICEDB_error_context_copy_f) (const struct ICEDB_error_context *)
 
typedef void(* ICEDB_error_context_appendA_f) (struct ICEDB_error_context *, size_t sz, const char *data)
 
typedef void(* ICEDB_error_context_append_strA_f) (struct ICEDB_error_context *, const char *data)
 
typedef void(* ICEDB_error_context_add_stringA_f) (struct ICEDB_error_context *, size_t var_sz, const char *var_name, size_t val_sz, const char *var_val)
 
typedef void(* ICEDB_error_context_add_string2A_f) (struct ICEDB_error_context *, const char *var_name, const char *var_val)
 
typedef void(* ICEDB_error_context_widen_f) (struct ICEDB_error_context *, size_t numNewSpaces)
 

Variables

DL_ICEDB ICEDB_error_code_to_message_size_f ICEDB_error_code_to_message_size
 
DL_ICEDB ICEDB_error_code_to_message_f ICEDB_error_code_to_message
 
DL_ICEDB ICEDB_error_code_to_stream_f ICEDB_error_code_to_stream
 
DL_ICEDB ICEDB_get_error_context_thread_local_f ICEDB_get_error_context_thread_local
 
DL_ICEDB ICEDB_error_context_deallocate_f ICEDB_error_context_deallocate
 
DL_ICEDB ICEDB_error_context_to_code_f ICEDB_error_context_to_code
 
DL_ICEDB ICEDB_error_context_to_message_size_f ICEDB_error_context_to_message_size
 
DL_ICEDB ICEDB_error_context_to_message_f ICEDB_error_context_to_message
 
DL_ICEDB ICEDB_error_context_to_stream_f ICEDB_error_context_to_stream
 
DL_ICEDB ICEDB_error_test_f ICEDB_error_test
 
DL_ICEDB ICEDB_error_getOSname_f ICEDB_error_getOSname
 
DL_ICEDB const struct ICEDB_error_container_ftable ICEDB_ct_error
 
ICEDB_THREAD_LOCAL ICEDB_error_context__ICEDB_LOCAL_THREAD_error_context
 
DL_ICEDB ICEDB_error_context_create_impl_f ICEDB_error_context_create_impl
 
DL_ICEDB ICEDB_error_context_copy_f ICEDB_error_context_copy
 
DL_ICEDB ICEDB_error_context_appendA_f ICEDB_error_context_appendA
 
DL_ICEDB ICEDB_error_context_append_strA_f ICEDB_error_context_append_strA
 
DL_ICEDB ICEDB_error_context_add_stringA_f ICEDB_error_context_add_stringA
 
DL_ICEDB ICEDB_error_context_add_string2A_f ICEDB_error_context_add_string2A
 
DL_ICEDB ICEDB_error_context_widen_f ICEDB_error_context_widen
 
DL_ICEDB const struct ICEDB_error_context_container_ftable ICEDB_ct_error_context
 

Detailed Description

Macro Definition Documentation

◆ ICEDB_error_context_add_string

#define ICEDB_error_context_add_string   ICEDB_error_context_add_stringA

Definition at line 62 of file error_context.h.

Referenced by error_context_add_string2().

◆ ICEDB_error_context_add_string2

#define ICEDB_error_context_add_string2   ICEDB_error_context_add_string2A

◆ ICEDB_error_context_append

#define ICEDB_error_context_append   ICEDB_error_context_appendA

Definition at line 60 of file error_context.h.

Referenced by error_context_append_str().

◆ ICEDB_error_context_append_str

#define ICEDB_error_context_append_str   ICEDB_error_context_append_strA

Definition at line 61 of file error_context.h.

Referenced by error_test().

◆ ICEDB_error_context_create

#define ICEDB_error_context_create (   x)    ICEDB_error_context_create_impl(x, (__FILE__), (int)__LINE__,(ICEDB_DEBUG_FSIG));

Typedef Documentation

◆ ICEDB_error_code

typedef int ICEDB_error_code

Defines an error condition. This is an integer. Zero (0) indicates that there is no error.

Definition at line 17 of file error.h.

◆ ICEDB_error_code_to_message_f

typedef size_t(* ICEDB_error_code_to_message_f) (ICEDB_error_code err, size_t buf_size, char *buf)

Support function to turn the general error code into a human-readable message. This function safely writes the error string. The buffer will always be null-terminated, either at the end of the written string, or at the end of the buffer. To query the necessary buffer size before writing, see the ICEDB_error_code_to_message_size function.

See also
ICEDB_error_code_to_message_size
Returns
The number of bytes actually written (including the NULL).
Parameters
erris the error code in question.
buf_sizeis the size of the output buffer.
bufis the buffer.

Definition at line 38 of file error.h.

◆ ICEDB_error_code_to_message_size_f

typedef size_t(* ICEDB_error_code_to_message_size_f) (ICEDB_error_code err)

Support function to turn the general error code into a human-readable message. This function allows you to determine the size of the output buffer necessary to write the entire error message.

Returns
The minimum size of the character array needed to hold the message.
Parameters
erris the error code in question.

Definition at line 24 of file error.h.

◆ ICEDB_error_code_to_stream_f

typedef size_t(* ICEDB_error_code_to_stream_f) (ICEDB_error_code err, FILE *fp)

Support function to write the error code to an output stream (C-style). This is a convenience function that allows for printing the error without an intermediate string copy, but streams are not thread-safe.

Returns
The number of bytes actually written (including the NULL).
Parameters
fpis the FILE pointer.
erris the error code in question.

Definition at line 47 of file error.h.

◆ ICEDB_error_context_add_string2A_f

typedef void(* ICEDB_error_context_add_string2A_f) (struct ICEDB_error_context *, const char *var_name, const char *var_val)

Definition at line 51 of file error_context.h.

◆ ICEDB_error_context_add_stringA_f

typedef void(* ICEDB_error_context_add_stringA_f) (struct ICEDB_error_context *, size_t var_sz, const char *var_name, size_t val_sz, const char *var_val)

Add a string to the error context.

Definition at line 48 of file error_context.h.

◆ ICEDB_error_context_append_strA_f

typedef void(* ICEDB_error_context_append_strA_f) (struct ICEDB_error_context *, const char *data)

Definition at line 43 of file error_context.h.

◆ ICEDB_error_context_appendA_f

typedef void(* ICEDB_error_context_appendA_f) (struct ICEDB_error_context *, size_t sz, const char *data)

Append extra information to the error context.

Definition at line 42 of file error_context.h.

◆ ICEDB_error_context_copy_f

typedef struct ICEDB_error_context*(* ICEDB_error_context_copy_f) (const struct ICEDB_error_context *)

Copies an error context. Used in reporting to application.

Definition at line 38 of file error_context.h.

◆ ICEDB_error_context_create_impl_f

typedef struct ICEDB_error_context*(* ICEDB_error_context_create_impl_f) (int, const char *, int, const char *)

Creates and stores an error context in the current thread. If another object is occupying the TLS, it is freed, so it is important to copy such objects using ICEDB_error_context_copy prior to read.

Definition at line 33 of file error_context.h.

◆ ICEDB_error_context_deallocate_f

typedef void(* ICEDB_error_context_deallocate_f) (struct ICEDB_error_context *)

Release the error context (this is the destructor, and frees the memory)

Definition at line 62 of file error.h.

◆ ICEDB_error_context_to_code_f

typedef ICEDB_error_code(* ICEDB_error_context_to_code_f) (const struct ICEDB_error_context *)

Get the error code from the context.

Definition at line 66 of file error.h.

◆ ICEDB_error_context_to_message_f

typedef size_t(* ICEDB_error_context_to_message_f) (const struct ICEDB_error_context *err, size_t buf_size, char *buf)

Support function to turn the general error code into a human-readable message. This function safely writes the error string. The buffer will always be null-terminated, either at the end of the written string, or at the end of the buffer. To query the necessary buffer size before writing, see the ICEDB_error_context_to_message_size function.

See also
ICEDB_error_context_to_message_size
Returns
The number of bytes actually written (including the NULL).
Parameters
erris the error context in question.
buf_sizeis the size of the output buffer.
bufis the buffer.

Definition at line 83 of file error.h.

◆ ICEDB_error_context_to_message_size_f

typedef size_t(* ICEDB_error_context_to_message_size_f) (const struct ICEDB_error_context *)

Determines the minimum buffer size for a human-readable representation of the ICEDB_error_context.

Definition at line 70 of file error.h.

◆ ICEDB_error_context_to_stream_f

typedef size_t(* ICEDB_error_context_to_stream_f) (const struct ICEDB_error_context *err, FILE *fp)

Support function to write the error code to an output stream (C-style). This is a convenience function that allows for printing the error without an intermediate string copy, but streams are not thread-safe.

Returns
The number of bytes actually written (including the NULL).
Parameters
fpis the FILE pointer.
erris the error context in question.

Definition at line 92 of file error.h.

◆ ICEDB_error_context_widen_f

typedef void(* ICEDB_error_context_widen_f) (struct ICEDB_error_context *, size_t numNewSpaces)

Widen the error_context var_vals array (safely and non-destructively)

Definition at line 56 of file error_context.h.

◆ ICEDB_error_getOSname_f

typedef const char*(* ICEDB_error_getOSname_f) ()

Convenience function that returns an immutable string describing the OS type. Staticly allocated.

Definition at line 100 of file error.h.

◆ ICEDB_error_test_f

typedef ICEDB_error_code(* ICEDB_error_test_f) ()

Testing function that raises an error.

Definition at line 96 of file error.h.

◆ ICEDB_get_error_context_thread_local_f

typedef struct ICEDB_error_context*(* ICEDB_get_error_context_thread_local_f) ()

Copy the last error context raised within the active thread. The resulting object should be freed once no longer needed. Returns NULL if no context exists.

Definition at line 58 of file error.h.

Variable Documentation

◆ __ICEDB_LOCAL_THREAD_error_context

ICEDB_THREAD_LOCAL ICEDB_error_context* __ICEDB_LOCAL_THREAD_error_context

Definition at line 8 of file error_context.cpp.

Referenced by error_context_create_impl(), and get_error_context_thread_local_c().

◆ ICEDB_ct_error

DL_ICEDB const struct ICEDB_error_container_ftable ICEDB_ct_error

Definition at line 212 of file error.cpp.

◆ ICEDB_ct_error_context

DL_ICEDB const struct ICEDB_error_context_container_ftable ICEDB_ct_error_context

Definition at line 135 of file error_context.cpp.

◆ ICEDB_error_code_to_message

DL_ICEDB ICEDB_error_code_to_message_f ICEDB_error_code_to_message

Definition at line 152 of file error.cpp.

◆ ICEDB_error_code_to_message_size

DL_ICEDB ICEDB_error_code_to_message_size_f ICEDB_error_code_to_message_size

Definition at line 141 of file error.cpp.

◆ ICEDB_error_code_to_stream

DL_ICEDB ICEDB_error_code_to_stream_f ICEDB_error_code_to_stream

Definition at line 162 of file error.cpp.

◆ ICEDB_error_context_add_string2A

DL_ICEDB ICEDB_error_context_add_string2A_f ICEDB_error_context_add_string2A

Definition at line 105 of file error_context.cpp.

◆ ICEDB_error_context_add_stringA

DL_ICEDB ICEDB_error_context_add_stringA_f ICEDB_error_context_add_stringA

Definition at line 95 of file error_context.cpp.

◆ ICEDB_error_context_append_strA

DL_ICEDB ICEDB_error_context_append_strA_f ICEDB_error_context_append_strA

Definition at line 85 of file error_context.cpp.

◆ ICEDB_error_context_appendA

DL_ICEDB ICEDB_error_context_appendA_f ICEDB_error_context_appendA

Definition at line 78 of file error_context.cpp.

◆ ICEDB_error_context_copy

DL_ICEDB ICEDB_error_context_copy_f ICEDB_error_context_copy

Definition at line 55 of file error_context.cpp.

◆ ICEDB_error_context_create_impl

DL_ICEDB ICEDB_error_context_create_impl_f ICEDB_error_context_create_impl

Definition at line 38 of file error_context.cpp.

◆ ICEDB_error_context_deallocate

DL_ICEDB ICEDB_error_context_deallocate_f ICEDB_error_context_deallocate

Definition at line 183 of file error.cpp.

◆ ICEDB_error_context_to_code

DL_ICEDB ICEDB_error_context_to_code_f ICEDB_error_context_to_code

Definition at line 21 of file error.cpp.

Referenced by icedb::error::error_context_to_code().

◆ ICEDB_error_context_to_message

DL_ICEDB ICEDB_error_context_to_message_f ICEDB_error_context_to_message

Definition at line 101 of file error.cpp.

Referenced by icedb::error::stringify().

◆ ICEDB_error_context_to_message_size

DL_ICEDB ICEDB_error_context_to_message_size_f ICEDB_error_context_to_message_size

Definition at line 61 of file error.cpp.

Referenced by icedb::error::stringify().

◆ ICEDB_error_context_to_stream

DL_ICEDB ICEDB_error_context_to_stream_f ICEDB_error_context_to_stream

Definition at line 124 of file error.cpp.

◆ ICEDB_error_context_widen

DL_ICEDB ICEDB_error_context_widen_f ICEDB_error_context_widen

Definition at line 131 of file error_context.cpp.

Referenced by error_context_add_string(), and error_context_create_impl().

◆ ICEDB_error_getOSname

DL_ICEDB ICEDB_error_getOSname_f ICEDB_error_getOSname

◆ ICEDB_error_test

DL_ICEDB ICEDB_error_test_f ICEDB_error_test

Definition at line 132 of file error.cpp.

◆ ICEDB_get_error_context_thread_local

DL_ICEDB ICEDB_get_error_context_thread_local_f ICEDB_get_error_context_thread_local

Definition at line 168 of file error.cpp.