#include "Def.h"

#define INST(T)                                                                                                        \
    template bool Save<T>(const T* obj, uint32_t count, Serializer& serializer);                                       \
    template bool Load<T>(T * obj, uint32_t count, Deserializer & serializer);

namespace Generated
{
    template <typename T> bool Save(const T* obj, uint32_t count, Serializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
            isOk = serializer.Write(&obj[i], sizeof(obj[i])) && isOk;
        }
        return isOk;
    }

    template <typename T> bool Load(T* obj, uint32_t count, Deserializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
            isOk = serializer.Read(&obj[i], sizeof(obj[i])) && isOk;
        }
        return isOk;
    }

    INST(uint8_t)
    INST(uint16_t)
    INST(uint32_t)
    INST(uint64_t)
    INST(int8_t)
    INST(int16_t)
    INST(int32_t)
    INST(int64_t)
    INST(float)
    INST(double)
    INST(bool)
    INST(char)
} // namespace Generated
