OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::runoff::CompletedSourceArchive Class Reference

#include <CompletedSourceArchive.hpp>

Collaboration diagram for openswmm::runoff::CompletedSourceArchive:

Public Member Functions

 CompletedSourceArchive ()=default
 Create an empty write-mode same-platform byte archive.
 
 CompletedSourceArchive (std::string bytes)
 Own a byte string and enter read mode at offset zero.
 
bool reading () const
 Test archive direction.
 
const std::string & bytes () const
 Borrow the complete owned byte buffer.
 
void finish () const
 Reject trailing unconsumed bytes after read-mode field visitation.
 
template<class... T>
void operator() (T &... values)
 Visit fields in argument order using their supported archive encodings.
 
template<class... T>
void fixed (T &... values)
 Visit vectors while requiring saved lengths to match current destination shapes.
 
void fixedStrided (std::vector< double > &value, std::size_t extent, std::size_t first, std::size_t stride)
 Visit one fixed logical double vector inside interleaved owned storage.
 
void fixedColumnMajor (std::vector< double > &value, std::size_t columns)
 Stream a row-major owned double matrix in legacy column-major wire order. columns is the stable model-derived row width, not decoded input. Nonempty matrices with columns>=2 must have a size divisible by columns. Empty or single-column storage uses fixed() directly, including the empty zero-width case. Preserves one vector count, allocation budget, diagnostics and partial-prefix mutation. Does not resize, allocate a transpose or provide independent rollback.
 
void fixedColumnMajorBlocks (std::vector< double > &value, std::size_t blocks, std::size_t columns)
 Stream equal owned row-major matrix blocks in legacy block/column/row order. blocks and columns are stable prepared-model extents, never decoded input. A nonempty multi-column buffer requires positive blocks and a size divisible by blocks*columns. Empty/single-column buffers retain fixed() semantics. One original vector count/budget/shape diagnostic and partial logical prefix are preserved. Does not resize, allocate a transpose or roll back on failure.
 
template<class T, class F>
void sequence (std::vector< T > &value, F visit, bool fixed_size=false)
 Visit a vector count and then each element through a supplied visitor.
 

Constructor & Destructor Documentation

◆ CompletedSourceArchive() [1/2]

openswmm::detail::CompletedSourceArchive::CompletedSourceArchive ( )
default

Create an empty write-mode same-platform byte archive.

◆ CompletedSourceArchive() [2/2]

openswmm::detail::CompletedSourceArchive::CompletedSourceArchive ( std::string bytes)
inlineexplicit

Own a byte string and enter read mode at offset zero.

The caller supplies/version-checks the surrounding checkpoint schema. Encoding uses host arithmetic representation/endianness, with no padding or raw pointers.

Parameters
[in]bytesArchive bytes passed by value and moved into owned storage; no validation occurs until fields are consumed.

Member Function Documentation

◆ bytes()

const std::string & openswmm::detail::CompletedSourceArchive::bytes ( ) const
inline

Borrow the complete owned byte buffer.

Returns
Owned string reference; character views may be invalidated by subsequent writes or archive destruction.

◆ finish()

void openswmm::detail::CompletedSourceArchive::finish ( ) const
inline

Reject trailing unconsumed bytes after read-mode field visitation.

Write mode is a no-op. Does not undo previously decoded fields.

Exceptions
std::runtime_errorWhen read offset differs from owned byte length.

◆ fixed()

template<class... T>
void openswmm::detail::CompletedSourceArchive::fixed ( T &... values)
inline

Visit vectors while requiring saved lengths to match current destination shapes.

Shape mismatches throw rather than resize. Successfully consumed earlier vectors are not rolled back.

Parameters
[in,out]valuesCaller-owned vectors whose read-mode sizes must already equal the saved lengths.

◆ fixedColumnMajor()

void openswmm::detail::CompletedSourceArchive::fixedColumnMajor ( std::vector< double > & value,
std::size_t columns )
inline

Stream a row-major owned double matrix in legacy column-major wire order. columns is the stable model-derived row width, not decoded input. Nonempty matrices with columns>=2 must have a size divisible by columns. Empty or single-column storage uses fixed() directly, including the empty zero-width case. Preserves one vector count, allocation budget, diagnostics and partial-prefix mutation. Does not resize, allocate a transpose or provide independent rollback.

◆ fixedColumnMajorBlocks()

void openswmm::detail::CompletedSourceArchive::fixedColumnMajorBlocks ( std::vector< double > & value,
std::size_t blocks,
std::size_t columns )
inline

Stream equal owned row-major matrix blocks in legacy block/column/row order. blocks and columns are stable prepared-model extents, never decoded input. A nonempty multi-column buffer requires positive blocks and a size divisible by blocks*columns. Empty/single-column buffers retain fixed() semantics. One original vector count/budget/shape diagnostic and partial logical prefix are preserved. Does not resize, allocate a transpose or roll back on failure.

◆ fixedStrided()

void openswmm::detail::CompletedSourceArchive::fixedStrided ( std::vector< double > & value,
std::size_t extent,
std::size_t first,
std::size_t stride )
inline

Visit one fixed logical double vector inside interleaved owned storage.

Parameters
[in,out]valueStable owned buffer; indexed elements must exist for every row.
extentLogical vector count, encoded exactly like fixed(vector<double>).
firstFirst logical element's index; unused for zero extent.
stridePositive element stride; caller supplies a valid indexed layout. Charges the same logical allocation budget and preserves fixed-vector read diagnostics. Read failure can leave earlier logical elements mutated; no independent rollback.

◆ operator()()

template<class... T>
void openswmm::detail::CompletedSourceArchive::operator() ( T &... values)
inline

Visit fields in argument order using their supported archive encodings.

Decoding mutates destinations incrementally; exceptions leave prior fields consumed/modified. Unsupported types fail at compile time.

Parameters
[in,out]valuesLvalue fields: arithmetic/enums, strings, vectors, arrays or pairs. Units and semantic validation belong to the caller.

◆ reading()

bool openswmm::detail::CompletedSourceArchive::reading ( ) const
inline

Test archive direction.

Returns
True for construction from bytes; false for default write construction.

◆ sequence()

template<class T, class F>
void openswmm::detail::CompletedSourceArchive::sequence ( std::vector< T > & value,
F visit,
bool fixed_size = false )
inline

Visit a vector count and then each element through a supplied visitor.

Charges count*sizeof(T) to a cumulative 64 MiB logical-allocation budget in both directions; on read also requires count<=remaining bytes. Visitor/resize exceptions propagate with partial state.

Exceptions
std::runtime_errorFor excessive count/budget, insufficient bytes or fixed-shape mismatch.
Parameters
[in,out]valueCaller-owned field: source bytes are read when writing; overwritten as decoding succeeds when reading.
[in]visitCopied callable invoked synchronously for each element; generally captures this archive and consumes element fields.
[in]fixed_sizeWhen reading, true refuses a saved size differing from current vector length; false resizes before visiting.

The documentation for this class was generated from the following file: