22 #ifndef CO_DATAISTREAM_H 23 #define CO_DATAISTREAM_H 27 #include <lunchbox/array.h> 28 #include <lunchbox/bitOperation.h> 30 #include <boost/type_traits.hpp> 33 #include <unordered_map> 34 #include <unordered_set> 51 virtual size_t nRemainingBuffers()
const = 0;
53 virtual uint128_t getVersion()
const = 0;
54 virtual void reset() { _reset(); }
72 _read(value, boost::has_trivial_copy<T>());
80 _readArray(array, boost::has_trivial_copy<T>());
100 template <
class K,
class V>
108 template <
class K,
class V>
109 DataIStream& operator>>(std::unordered_map<K, V>&);
126 template <
typename O,
typename C>
127 void deserializeChildren(O*
object,
const std::vector<C*>& old,
128 std::vector<C*>& result);
149 CO_API
const void* getRemainingBuffer(
const uint64_t size);
155 CO_API uint64_t getRemainingBufferSize();
158 bool wasUsed()
const;
163 CO_API
virtual NodePtr getRemoteNode()
const = 0;
173 CO_API
virtual ~DataIStream();
175 virtual bool getNextBuffer(CompressorInfo& info, uint32_t& nChunks,
176 const void*& chunkData, uint64_t& size) = 0;
180 detail::DataIStream*
const _impl;
183 CO_API
void _read(
void* data, uint64_t size);
189 CO_API
bool _checkBuffer();
190 CO_API
void _reset();
192 const uint8_t* _decompress(
const void* data,
const CompressorInfo& info,
193 uint32_t nChunks, uint64_t dataSize);
197 DataIStream& _readFlatVector(std::vector<T>& value)
201 LBASSERTINFO(nElems < LB_BIT48,
202 "Out-of-sync DataIStream: " << nElems <<
" elements?");
203 value.resize(
size_t(nElems));
205 *
this >> Array<T>(&value.front(), nElems);
211 void _read(T& value,
const boost::true_type&)
213 _read(&value,
sizeof(value));
218 void _read(T& value,
const boost::false_type&)
220 _readSerializable(value, boost::is_base_of<servus::Serializable, T>());
225 void _readSerializable(T& value,
const boost::true_type&);
229 void _readArray(Array<T>,
const boost::true_type&);
233 void _readArray(Array<T>,
const boost::false_type&);
237 #include "dataIStream.ipp" 239 #endif // CO_DATAISTREAM_H
Defines export visibility macros for library Collage.
lunchbox::RefPtr< LocalNode > LocalNodePtr
A reference pointer for LocalNode pointers.
Object-oriented network library.
DataIStream & operator>>(T &value)
Read a plain data item.
A std::istream-like input data stream for binary data.
DataIStream & operator>>(Array< T > array)
Read a C array.
lunchbox::RefPtr< Node > NodePtr
A reference pointer for Node pointers.