#ifndef SERIALIZE_BOOL_HPP_
#define SERIALIZE_BOOL_HPP_

#include <Serialize/Base.hpp>

template<>
struct SerialCodec<bool>
{
    static void encode(std::vector<uint8_t> &outBytes, const bool &value)
    {
        outBytes.push_back(value ? 1 : 0);
    }

    static size_t decode(const uint8_t *data, size_t size, bool &value)
    {
        if (size < 1) return 0;
        value = (*data) != 0;
        return 1;
    }
};

#endif