25#ifndef __BITPIT_BINARY_STREAM_HPP__
26#define __BITPIT_BINARY_STREAM_HPP__
32#include <unordered_map>
33#include <unordered_set>
42template<
typename T, std::
size_t d>
43IBinaryStream &operator>>(IBinaryStream &stream, std::array<T, d> &data);
44template<
typename T, std::
size_t d>
45OBinaryStream &
operator<<(OBinaryStream &stream,
const std::array<T, d> &data);
48IBinaryStream& operator>>(IBinaryStream &stream, std::vector<T> &data);
50OBinaryStream&
operator<<(OBinaryStream &stream,
const std::vector<T> &data);
52template<
typename K,
typename T>
53IBinaryStream &operator>>(IBinaryStream &stream, std::pair<K, T> &data);
54template<
typename K,
typename T>
55OBinaryStream &
operator<<(OBinaryStream &stream,
const std::pair<K, T> &data);
57template<
typename K,
typename T>
58IBinaryStream &operator>>(IBinaryStream &stream, std::map<K, T> &data);
59template<
typename K,
typename T>
60OBinaryStream &
operator<<(OBinaryStream &stream,
const std::map<K, T> &data);
62template<
typename K,
typename T>
63IBinaryStream &operator>>(IBinaryStream &stream, std::unordered_map<K, T> &data);
64template<
typename K,
typename T>
65OBinaryStream &
operator<<(OBinaryStream &stream,
const std::unordered_map<K, T> &data);
68IBinaryStream &operator>>(IBinaryStream &stream, std::unordered_set<T> &data);
70OBinaryStream &
operator<<(OBinaryStream &stream,
const std::unordered_set<T> &data);
73IBinaryStream & operator>>(IBinaryStream &stream, T &data);
75OBinaryStream &
operator<<(OBinaryStream &stream,
const T &data);
78IBinaryStream & operator>>(IBinaryStream &stream, std::string &data);
80OBinaryStream &
operator<<(OBinaryStream &stream,
const std::string &data);
90 std::streampos
tellg()
const;
91 bool seekg(std::size_t pos);
92 bool seekg(std::streamoff offset, std::ios_base::seekdir way);
95 const char *
data()
const;
97 virtual void setSize(std::size_t size);
106 std::vector<char> m_buffer;
115 void open(
const char *buffer, std::size_t capacity);
116 void open(std::size_t capacity);
136 void open(
const char *buffer, std::size_t size);
137 void open(std::size_t size);
139 void read(
char *
data, std::size_t size);
152 void open(std::size_t size);
154 void setSize(std::size_t size)
override;
157 void write(
const char *
data, std::size_t size);
167#include "binary_stream.tpp"
Base class for defining input and output binary streams.
std::streampos tellg() const
std::size_t getCapacity() const
void open(const char *buffer, std::size_t capacity)
bool seekg(std::size_t pos)
void setCapacity(std::size_t capacity)
virtual void setSize(std::size_t size)
std::size_t getSize() const
void read(char *data, std::size_t size)
void open(const char *buffer, std::size_t size)
void write(const char *data, std::size_t size)
void open(std::size_t size)
void setSize(std::size_t size) override
std::ostream & operator<<(std::ostream &, const std::vector< T > &)