OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::gpkg::detail Namespace Reference

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.
 

Function Documentation

◆ append_f64()

void openswmm::gpkg::detail::append_f64 ( std::vector< uint8_t > & buf,
double v )
inline

Append 8 native representation bytes.

No endian conversion or size/range validation; vector allocation failures propagate.

Parameters
[in,out]bufOwned byte-vector sink; appends without clearing and can reallocate, invalidating old byte views.
[in]vValue to encode; requires little-endian host representation for the advertised WKB byte order.
Here is the caller graph for this function:

◆ append_u32()

void openswmm::gpkg::detail::append_u32 ( std::vector< uint8_t > & buf,
uint32_t v )
inline

Append 4 native representation bytes.

No endian conversion or size/range validation; vector allocation failures propagate.

Parameters
[in,out]bufOwned byte-vector sink; appends without clearing and can reallocate, invalidating old byte views.
[in]vValue to encode; requires little-endian host representation for the advertised WKB byte order.
Here is the caller graph for this function:

◆ append_u8()

void openswmm::gpkg::detail::append_u8 ( std::vector< uint8_t > & buf,
uint8_t v )
inline

Append 1 native representation byte.

No endian conversion or size/range validation; vector allocation failures propagate.

Parameters
[in,out]bufOwned byte-vector sink; appends without clearing and can reallocate, invalidating old byte views.
[in]vValue to encode.
Here is the caller graph for this function:

◆ parse_gp_header()

size_t openswmm::gpkg::detail::parse_gp_header ( const uint8_t * data,
size_t size,
int32_t & srs_id )
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.

Exceptions
std::runtime_errorFor size<8, invalid magic or unknown envelope kind.
Parameters
[in]dataBorrowed readable block of at least size bytes; non-null whenever size>=8.
[in]sizeBlock byte count; only the fixed eight-byte prefix is bounds-checked.
[out]srs_idAssigned from native 32-bit bytes after magic validation; may be assigned before an envelope-kind refusal.
Returns
Computed payload offset 8+envelope bytes, which can exceed size.
Here is the caller graph for this function:

◆ read_val()

template<typename T>
T openswmm::gpkg::detail::read_val ( const uint8_t * data,
size_t & offset )
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.

Parameters
[in]dataBorrowed bytes containing a complete trivially copyable T at the current offset.
[in,out]offsetCurrent byte offset; advanced by sizeof(T) after memcpy, with no bounds/overflow check.
Returns
Native T representation copied from data; no endian conversion.
Here is the caller graph for this function:

◆ write_gp_header()

void openswmm::gpkg::detail::write_gp_header ( std::vector< uint8_t > & buf,
int32_t srs_id,
double min_x,
double min_y,
double max_x,
double max_y )
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.

Parameters
[in,out]bufOwned byte-vector sink; appends without clearing and can reallocate, invalidating old byte views.
[in]srs_idSigned spatial-reference identifier written in native 32-bit representation.
[in]min_xEnvelope minimum X in the selected CRS units.
[in]min_yEnvelope minimum Y in CRS units.
[in]max_xEnvelope maximum X in CRS units.
[in]max_yEnvelope maximum Y in CRS units.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_gp_header_empty()

void openswmm::gpkg::detail::write_gp_header_empty ( std::vector< uint8_t > & buf,
int32_t srs_id )
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.

Parameters
[in,out]bufOwned byte-vector sink; appends without clearing and can reallocate, invalidating old byte views.
[in]srs_idNative 32-bit spatial-reference ID; little-endian host required for advertised encoding.
Here is the call graph for this function:
Here is the caller graph for this function: