![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Header file for SWMM output API error handling. More...
Go to the source code of this file.
Classes | |
| struct | error_s |
| Structure for managing errors. More... | |
Macros | |
| #define | ERR_MAXMSG 256 |
| Maximum length of error message. | |
Typedefs | |
| typedef void(* | p_msg_lookup) (int errorcode, char *message, int length) |
| Describe a borrowed lookup callback used to format one error code. | |
| typedef struct error_s | error_handle_t |
Enumerations | |
| enum | OutputErrorTypes { ERR411 = 411 , ERR421 = 421 , ERR422 = 422 , ERR423 = 423 , ERR424 = 424 , ERR434 = 434 , ERR435 = 435 , ERR436 = 436 , ERR440 = 440 } |
| Error codes. More... | |
| enum | OutputWarningTypes { WARN10 = 10 } |
| Warning codes. More... | |
Functions | |
| error_handle_t * | new_error_manager (p_msg_lookup message_lookup) |
| Allocate a zero-status error manager and retain its lookup callback. | |
| void | dst_error_manager (error_handle_t *error_handle) |
| Release an error manager allocation. | |
| int | set_error (error_handle_t *error_handle, int errorcode) |
| Record a nonzero error without clearing a previous status on success. | |
| char * | check_error (error_handle_t *error_handle) |
| Allocate a copy of the current stored error message. | |
| void | clear_error (error_handle_t *error_handle) |
| Explicitly clear the sticky error status. | |
Header file for SWMM output API error handling.
| #define ERR_MAXMSG 256 |
Maximum length of error message.
| typedef struct error_s error_handle_t |
| typedef void(* p_msg_lookup) (int errorcode, char *message, int length) |
Describe a borrowed lookup callback used to format one error code.
Invoked synchronously by check_error. The manager retains the callback pointer until destruction, so its code must remain loaded for that lifetime.
| [in] | errorcode | Stored nonzero warning/error code to translate. |
| [out] | message | Writable caller-owned buffer of length bytes; write a bounded null-terminated message. |
| [in] | length | Positive writable buffer capacity in bytes, including its terminator. |
| enum OutputErrorTypes |
Error codes.
| enum OutputWarningTypes |
| char * check_error | ( | error_handle_t * | error_handle | ) |
Allocate a copy of the current stored error message.
Invokes lookup synchronously only when allocation succeeds. Does not clear status or retain the message; each call creates a separate allocation.
| [in] | error_handle | Live non-null manager with a callable lookup for nonzero status; manager is read only. |
| void clear_error | ( | error_handle_t * | error_handle | ) |
Explicitly clear the sticky error status.
| [in,out] | error_handle | Live non-null manager; error_status becomes zero, callback remains unchanged. |
| void dst_error_manager | ( | error_handle_t * | error_handle | ) |
Release an error manager allocation.
No message allocations are owned by the manager. Caller remains responsible for strings returned by check_error; the argument itself is not cleared.
| [in] | error_handle | Owned manager to destroy, or null (free accepts null); all aliases become invalid. |
| error_handle_t * new_error_manager | ( | p_msg_lookup | message_lookup | ) |
Allocate a zero-status error manager and retain its lookup callback.
| [in] | message_lookup | Callback kept in the manager; must remain callable for its lifetime and be non-null before checking a nonzero error. |
| int set_error | ( | error_handle_t * | error_handle, |
| int | errorcode ) |
Record a nonzero error without clearing a previous status on success.
| [in,out] | error_handle | Live manager; non-null is required only when errorcode is nonzero. |
| [in] | errorcode | Nonzero status replaces the stored code; zero leaves the previous code intact. |