#ifndef INCLUDED_C_BINARYOUTSTREAM_H #define INCLUDED_C_BINARYOUTSTREAM_H #ifndef INCLUDED_C_OUTSTREAM_H #include #endif /*INCLUDED_C_OUTSTREAM_H*/ /* ------------------------------------------------------------------------------------------------------------------ */ /* */ typedef struct { c_OutStream_t* base_io; /* Underlying core polymorphically bound I/O driver ports backend link */ int buffer; /* 8-bit buffer of bits to write out */ int n; /* Number of bits currently remaining active in buffer */ } c_BinaryOutStream_t; /* ------------------------------------------------------------------------------------------------------------------ */ /* */ c_err_t c_BinaryOutStream_Init(c_BinaryOutStream_t* self, c_OutStream_t* underlying_io_port); c_err_t c_BinaryOutStream_WriteBits(c_BinaryOutStream_t* self, uint32_t value, int bit_count); c_err_t c_BinaryOutStream_Flush(c_BinaryOutStream_t* self); c_err_t c_BinaryOutStream_WriteBit(c_BinaryOutStream_t* self, int x); c_err_t c_BinaryOutStream_WriteByte(c_BinaryOutStream_t* self, int x); c_err_t c_BinaryOutStream_WriteChar(c_BinaryOutStream_t* self, char x); c_err_t c_BinaryOutStream_WriteUInt16(c_BinaryOutStream_t* self, uint16_t x); c_err_t c_BinaryOutStream_WriteUInt32(c_BinaryOutStream_t* self, uint32_t x); c_err_t c_BinaryOutStream_WriteUInt64(c_BinaryOutStream_t* self, uint64_t x); c_err_t c_BinaryOutStream_WriteFloat(c_BinaryOutStream_t* self, float x); c_err_t c_BinaryOutStream_WriteDouble(c_BinaryOutStream_t* self, double x); c_err_t c_BinaryOutStream_WriteString(c_BinaryOutStream_t* self, const char* s); #endif /*INCLUDED_C_BINARYOUTSTREAM_H*/