// Copyright (c) 2012-2015, The CryptoNote developers, The Bytecoin developers // // This file is part of Bytecoin. // // Bytecoin is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Bytecoin is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with Bytecoin. If not, see . #pragma once #include #include #include namespace Common { class IInputStream; class IOutputStream; void read(IInputStream& in, void* data, std::size_t size); void read(IInputStream& in, int8_t& value); void read(IInputStream& in, int16_t& value); void read(IInputStream& in, int32_t& value); void read(IInputStream& in, int64_t& value); void read(IInputStream& in, uint8_t& value); void read(IInputStream& in, uint16_t& value); void read(IInputStream& in, uint32_t& value); void read(IInputStream& in, uint64_t& value); void read(IInputStream& in, std::vector& data, std::size_t size); void read(IInputStream& in, std::string& data, std::size_t size); void readVarint(IInputStream& in, uint8_t& value); void readVarint(IInputStream& in, uint16_t& value); void readVarint(IInputStream& in, uint32_t& value); void readVarint(IInputStream& in, uint64_t& value); void write(IOutputStream& out, const void* data, std::size_t size); void write(IOutputStream& out, int8_t value); void write(IOutputStream& out, int16_t value); void write(IOutputStream& out, int32_t value); void write(IOutputStream& out, int64_t value); void write(IOutputStream& out, uint8_t value); void write(IOutputStream& out, uint16_t value); void write(IOutputStream& out, uint32_t value); void write(IOutputStream& out, uint64_t value); void write(IOutputStream& out, const std::vector& data); void write(IOutputStream& out, const std::string& data); void writeVarint(IOutputStream& out, uint64_t value); template T read(IInputStream& in) { T value; read(in, value); return value; } template T read(IInputStream& in, std::size_t size) { T value; read(in, value, size); return value; } template T readVarint(IInputStream& in) { T value; readVarint(in, value); return value; } };