![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Functions | |
| void | append_u8 (std::vector< uint8_t > &buf, uint8_t v) |
| Append 1 native representation byte. | |
| void | append_u32 (std::vector< uint8_t > &buf, uint32_t v) |
| Append 4 native representation bytes. | |
| void | append_f64 (std::vector< uint8_t > &buf, double v) |
| Append 8 native representation bytes. | |
| void | write_gp_header (std::vector< uint8_t > &buf, int32_t srs_id, double min_x, double min_y, double max_x, double max_y) |
| Append a version-zero nonempty GP header with XY envelope. | |
| void | write_gp_header_empty (std::vector< uint8_t > &buf, int32_t srs_id) |
| Append an empty GP header without an envelope. | |
| size_t | parse_gp_header (const uint8_t *data, size_t size, int32_t &srs_id) |
| Read GP magic and envelope kind to locate the WKB payload. | |
| template<typename T> | |
| T | read_val (const uint8_t *data, size_t &offset) |
| Read an unchecked native scalar and advance a byte offset. | |
|
inline |
Append 8 native representation bytes.
No endian conversion or size/range validation; vector allocation failures propagate.
| [in,out] | buf | Owned byte-vector sink; appends without clearing and can reallocate, invalidating old byte views. |
| [in] | v | Value to encode; requires little-endian host representation for the advertised WKB byte order. |
|
inline |
Append 4 native representation bytes.
No endian conversion or size/range validation; vector allocation failures propagate.
| [in,out] | buf | Owned byte-vector sink; appends without clearing and can reallocate, invalidating old byte views. |
| [in] | v | Value to encode; requires little-endian host representation for the advertised WKB byte order. |
|
inline |
Append 1 native representation byte.
No endian conversion or size/range validation; vector allocation failures propagate.
| [in,out] | buf | Owned byte-vector sink; appends without clearing and can reallocate, invalidating old byte views. |
| [in] | v | Value to encode. |
|
inline |
Read GP magic and envelope kind to locate the WKB payload.
Does not check version, byte-order/empty bits or whether the envelope/payload bytes exist. Caller validates the complete geometry before using this offset.
| std::runtime_error | For size<8, invalid magic or unknown envelope kind. |
| [in] | data | Borrowed readable block of at least size bytes; non-null whenever size>=8. |
| [in] | size | Block byte count; only the fixed eight-byte prefix is bounds-checked. |
| [out] | srs_id | Assigned from native 32-bit bytes after magic validation; may be assigned before an envelope-kind refusal. |
|
inline |
Read an unchecked native scalar and advance a byte offset.
Caller guarantees enough bytes and a valid object representation; this helper is not safe validation for arbitrary malformed geometry.
| [in] | data | Borrowed bytes containing a complete trivially copyable T at the current offset. |
| [in,out] | offset | Current byte offset; advanced by sizeof(T) after memcpy, with no bounds/overflow check. |
|
inline |
Append a version-zero nonempty GP header with XY envelope.
Advertises little endian and envelope kind XY; caller uses a compatible host and supplies ordered finite envelope values. Does not append a WKB payload.
| [in,out] | buf | Owned byte-vector sink; appends without clearing and can reallocate, invalidating old byte views. |
| [in] | srs_id | Signed spatial-reference identifier written in native 32-bit representation. |
| [in] | min_x | Envelope minimum X in the selected CRS units. |
| [in] | min_y | Envelope minimum Y in CRS units. |
| [in] | max_x | Envelope maximum X in CRS units. |
| [in] | max_y | Envelope maximum Y in CRS units. |
|
inline |
Append an empty GP header without an envelope.
Sets empty bit and little-endian flag; WKB geometry bytes are appended separately by the caller.
| [in,out] | buf | Owned byte-vector sink; appends without clearing and can reallocate, invalidating old byte views. |
| [in] | srs_id | Native 32-bit spatial-reference ID; little-endian host required for advertised encoding. |