You are here: Start » Function Reference » All Functions » Binary Data » WriteRealToBuffer
This is Filter Equivalent. This function may be present in generated code, but should not be used in hand-written code.
Header: | STD.h |
---|---|
Namespace: | fil |
Module: | FoundationLite |
Converts real value into specified binary representation and writes it to a byte buffer.
Syntax
void fil::WriteRealToBuffer ( const fil::ByteBuffer& inBuffer, ftl::Optional<int> inOffset, float inValue, fil::RealBinaryFormat::Type inFormat, fil::ByteBuffer& outBuffer )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
![]() |
inBuffer | const ByteBuffer& | Initial buffer to be expanded | ||
![]() |
inOffset | Optional<int> | 0 - ![]() |
NIL | Write destination position |
![]() |
inValue | float | Value to be written | ||
![]() |
inFormat | RealBinaryFormat::Type | SinglePrecision_32Bit_LittleEndian.0f | Binary serialization format of floating point data | |
![]() |
outBuffer | ByteBuffer& | Resulting data |
In-place Processing
This function supports in-place data processing - you can pass the same reference to inBuffer and outBuffer
Read more about In-place Computation.
Description
This filter is intended for generating a raw binary data in the ByteBuffer by writing a properly serialized floating point value into it.
Resulting ByteBuffer data on the outBuffer output is created by expanding data from buffer on the inBuffer input. Data is written starting at the position specified by the inOffset input (in bytes). When written data spans beyond the end of the input buffer the resulting buffer length is expanded (event when inOffset points beyond the end of the input buffer). When the inOffset input is set to Auto data is written at the end of the input buffer.
Real value is converted into a binary representation according to the inFormat input value:
- SinglePrecision_32Bit_LittleEndian - single precision floating point value, 4 bytes long with little-endian byte order.
- DoublePrecision_64Bit_LittleEndian - double precision floating point value, 8 bytes long with little-endian byte order.
- SinglePrecision_32Bit_BigEndian - single precision floating point value, 4 bytes long with big-endian byte order.
- DoublePrecision_64Bit_BigEndian - double precision floating point value, 8 bytes long with big-endian byte order.
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Not supported floating point binary format. |
IoError | Resulting buffer size is too large. |
See Also
- ReadRealFromBuffer – Reads real value in specified binary format from a byte buffer.