Files
2026-09-07 21:22:01 +08:00

39 lines
1.2 KiB
C

#ifndef INCLUDED_C_INSTREAM_H
#define INCLUDED_C_INSTREAM_H
#ifndef INCLUDED_C_TYPES_H
#include <c_Types.h>
#endif /*INCLUDED_C_TYPES_H*/
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
typedef struct c_InStream_t c_InStream_t;
typedef struct {
c_err_t (*read)(c_InStream_t* self, void* buffer, c_size_t bytes_to_read, c_size_t* out_bytes_read);
void (*destroy)(c_InStream_t* self);
} c_InStreamVtbl_t;
struct c_InStream_t {
const c_InStreamVtbl_t* vtbl; /* Object vtable linkage tracking handle */
};
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
/* Base Public Routing Virtual Methods */
C_STATIC_FORCE_INLINE c_err_t c_InStream_Read(c_InStream_t* self, void* buffer, c_size_t bytes_to_read, c_size_t* out_bytes_read) {
if (!self || !self->vtbl || !self->vtbl->read) return C_ERR_PARAM;
return self->vtbl->read(self, buffer, bytes_to_read, out_bytes_read);
}
C_STATIC_FORCE_INLINE void c_InStream_Destroy(c_InStream_t* self) {
if (!self || !self->vtbl || !self->vtbl->destroy) return;
self->vtbl->destroy(self);
}
#endif /*INCLUDED_C_INSTREAM_H*/