7#ifndef _STREAM_CLASS_HEADER_
8#define _STREAM_CLASS_HEADER_
20class DOEXPORT cStream :
public catwo::object<IInputStream, IOutputStream, IStream>
29 typedef enum : uint8_t
70 uint32_t ui32Flags=0);
146 tResult Read(
void* pvBuffer,
size_t nBufferSize,
size_t* pnBytesRead=
nullptr)
const override;
156 tResult Write(
const void* pvBuffer,
size_t nBufferSize,
size_t* pnBytesWritten=
nullptr)
override;
168 tResult Seek(tFilePos nPos, tSeekOrigin eOrigin, tFilePos* pNewPos=
nullptr)
const override;
216 const adtf_util::cString& strValue,
228 adtf_util::cString& strValue,
229 size_t& szReadCount);
244 T oValueToWrite = oValue;
245 if (IStream::m_ui8PlatformByteOrder == PLATFORM_BIG_ENDIAN_8)
247 RETURN_IF_FAILED(adtf_util::cSystem::SwapEndian(&oValueToWrite));
250 auto pReadPosition =
reinterpret_cast<const uint8_t*
>(&oValueToWrite);
251 size_t nBytesToWrite =
sizeof(oValueToWrite);
252 while (nBytesToWrite)
254 size_t szWrittenSize = 0;
255 RETURN_IF_FAILED(oOutStream.
Write(pReadPosition, nBytesToWrite, &szWrittenSize));
256 szCount += szWrittenSize;
257 pReadPosition += szWrittenSize;
258 nBytesToWrite -= szWrittenSize;
268 auto pWritePosition =
reinterpret_cast<uint8_t*
>(&oValue);
269 size_t nBytesToRead =
sizeof(oValue);
272 size_t szReadSize = 0;
273 RETURN_IF_FAILED(oInStream.
Read(pWritePosition, nBytesToRead, &szReadSize));
274 szCount += szReadSize;
275 pWritePosition += szReadSize;
276 nBytesToRead -= szReadSize;
291 const adtf_util::cString& strValue,
294 return ucom_write_to_stream_string(oOutStream, strValue, szCount);
297 adtf_util::cString& strValue,
300 return ucom_read_from_stream_string(oInStream, strValue, szReadCount);
308 return ucom_type_streamer<T>::Write(oOutStream, oValue, szCount);
314 return ucom_type_streamer<T>::Read(oInStream, oValue, szCount);
318IOutputStream& operator<<(IOutputStream& oWriteStream,
const T& oValue)
326const IInputStream& operator>>(
const IInputStream& oReadStream, T& oValue)
340using ant::ucom_write_to_stream;
341using ant::ucom_read_from_stream;
343using ant::ucom_write_to_stream_buffer;
344using ant::ucom_read_from_stream_buffer;
346using ant::ucom_write_to_stream_string;
347using ant::ucom_read_from_stream_string;
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
Definition result.h:29
Definition stream_intf.h:54
virtual tResult Write(const void *pvBuffer, size_t nBufferSize, size_t *pnBytesWritten=nullptr)=0
const void * GetCurrentPtr() const
tResult Read(void *pvBuffer, size_t nBufferSize, size_t *pnBytesRead=nullptr) const override
tResult Write(const void *pvBuffer, size_t nBufferSize, size_t *pnBytesWritten=nullptr) override
@ FLG_DONT_GROW
Will only have the at construction time decided size.
Definition stream.h:48
@ FLG_KEEP_POSITION
Sets correct end of file marker at.
Definition stream.h:46
tResult DetachReference()
tResult SetSize(tFileSize szBuffer, uint32_t ui32Flags=0)
tFileSize GetCurrentSize() const
tFileSize GetRemainingBytes() const
tResult CopyFrom(cStream &strmInput)
cStream(tStreamType eType, tFileSize szBuffer=0, uint32_t ui32Flags=0)
tStreamType
Definition stream.h:30
@ INPUT_STREAM
Is a Input Stream (can be read).
Definition stream.h:32
@ OUTPUT_STREAM
Is a Output Stream (can be written).
Definition stream.h:34
tFileSize GetHighestPosIndex() const
tResult AttachReference(void *pReferenceBuffer, tFileSize szBufferSize)
tResult CopyTo(cStream &strmOutput) const
tResult Seek(tFilePos nPos, tSeekOrigin eOrigin, tFilePos *pNewPos=nullptr) const override
tStreamType m_eType
Type of Stream, see tStreamType.
Definition stream.h:39
Namespace for all functionality of the ADTF UCOM SDK provided since v3.0.
Definition test_runtime.h:14
Namespace for the ADTF uCOM SDK.
Definition adtf_system.h:324
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14