21 #ifndef INCLUDE_OLA_IO_INPUTSTREAM_H_
22 #define INCLUDE_OLA_IO_INPUTSTREAM_H_
25 #include <ola/io/InputBuffer.h>
42 virtual bool operator>>(int8_t &val) = 0;
43 virtual bool operator>>(uint8_t &val) = 0;
44 virtual bool operator>>(int16_t &val) = 0;
45 virtual bool operator>>(uint16_t &val) = 0;
46 virtual bool operator>>(int32_t &val) = 0;
47 virtual bool operator>>(uint32_t &val) = 0;
53 virtual unsigned int ReadString(std::string *output,
unsigned int size) = 0;
69 bool operator>>(int8_t &val) {
return Extract(&val); }
70 bool operator>>(uint8_t &val) {
return Extract(&val); }
71 bool operator>>(int16_t &val) {
return Extract(&val); }
72 bool operator>>(uint16_t &val) {
return Extract(&val); }
73 bool operator>>(int32_t &val) {
return Extract(&val); }
74 bool operator>>(uint32_t &val) {
return Extract(&val); }
76 unsigned int ReadString(std::string *output,
unsigned int size) {
77 return m_buffer->
Read(output, size);
84 bool Extract(T *val) {
85 unsigned int length = m_buffer->
Read(reinterpret_cast<uint8_t*>(val),
87 return length ==
sizeof(*val);
95 #endif // INCLUDE_OLA_IO_INPUTSTREAM_H_