33 #include "../System/cl_platform.h"
42 class IODeviceProvider;
126 int send(
const void *data,
int len,
bool send_all =
true);
135 int receive(
void *data,
int len,
bool receive_all =
true);
158 int read(
void *data,
int len,
bool receive_all =
true);
167 int write(
const void *data,
int len,
bool send_all =
true);
307 std::string
read_string_text(
const char *skip_initial_chars,
const char *read_until_chars,
bool allow_eof =
true);
317 std::shared_ptr<IODevice_Impl>
impl;
void write_float(float data)
Writes a float to output source.
bool is_little_endian() const
Returns true if the input source is in little endian mode.
void set_big_endian_mode()
Changes input data endianess to big endian mode. (Default is little endian)
int write(const void *data, int len, bool send_all=true)
Alias for send(data, len, send_all)
@ seek_set
Set to a specific value from the start.
Definition: iodevice.h:60
void write_uint16(uint16_t data)
Writes an unsigned 16 bit integer to output source.
int send(const void *data, int len, bool send_all=true)
Send data to device.
int get_size() const
Returns the size of data stream.
void write_string_text(const std::string &str)
Writes a text string to the output source.
void write_int16(int16_t data)
Writes a signed 16 bit integer to output source.
int64_t read_int64()
Reads a signed 64 bit integer from input source.
IODevice duplicate()
Create a new IODevice referencing the same resource.
int8_t read_int8()
Reads a signed 8 bit integer from input source.
void write_int64(int64_t data)
Writes a signed 64 bit integer to output source.
int peek(void *data, int len)
Peek data from device (data is left in the buffer).
void write_string_a(const std::string &str)
Writes a string to the output source.
IODevice(IODeviceProvider *provider)
Constructs a IODevice.
I/O Device interface.
Definition: iodevice.h:51
void write_int32(int32_t data)
Writes a signed 32 bit integer to output source.
int read(void *data, int len, bool receive_all=true)
Alias for receive(data, len, receive_all)
const IODeviceProvider * get_provider() const
Returns the provider for this object.
void write_uint32(uint32_t data)
Writes an unsigned 32 bit integer to output source.
void write_uint8(uint8_t data)
Writes an unsigned 8 bit integer to output source.
@ seek_end
Set to a specific value from the end (use negative position)
Definition: iodevice.h:66
uint8_t read_uint8()
Reads an unsigned 8 bit integer from input source.
std::string read_string_a()
Reads a string from the input source.
bool is_null() const
Returns true if this object is invalid.
Definition: iodevice.h:90
bool seek(int position, SeekMode mode=seek_set)
Seek in data stream.
float read_float()
Reads a float from input source.
int16_t read_int16()
Reads a signed 16 bit integer from input source.
std::string read_string_text(const char *skip_initial_chars, const char *read_until_chars, bool allow_eof=true)
Reads a string from the input source where the source is a text file.
IODeviceProvider * get_provider()
Returns the provider for this object.
@ seek_cur
Set relative to the current position.
Definition: iodevice.h:63
I/O device provider interface.
Definition: iodevice_provider.h:41
IODevice()
Constructs a null instance.
std::string read_string_nul()
Reads a nul terminated string from the input source.
void set_system_mode()
Changes input data endianess to the local systems mode.
uint32_t read_uint32()
Reads an unsigned 32 bit integer from input source.
uint64_t read_uint64()
Reads an unsigned 64 bit integer from input source.
void set_little_endian_mode()
Changes input data endianess to little endian mode. This is the default setting.
std::shared_ptr< IODevice_Impl > impl
Definition: iodevice.h:317
SeekMode
Seeking modes.
Definition: iodevice.h:58
void throw_if_null() const
Throw an exception if this object is invalid.
void write_uint64(uint64_t data)
Writes an unsigned 64 bit integer to output source.
void write_int8(int8_t data)
Writes a signed 8 bit integer to output source.
int32_t read_int32()
Reads a signed 32 bit integer from input source.
int receive(void *data, int len, bool receive_all=true)
Receive data from device.
uint16_t read_uint16()
Reads an unsigned 16 bit integer from input source.
void write_string_nul(const std::string &str)
Writes a nul terminated string to the output source.
int get_position() const
Returns the position in the data stream.