#include "Def.h"
#include "Generated.h"

namespace Gen
{
    bool Save(const KnownType::Enum* obj, uint32_t count, Serializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
            auto val = (uint8_t)obj[i];
            isOk = Save(&val, 1, serializer) && isOk;
        }
        return isOk;
    }
    bool Load(KnownType::Enum* obj, uint32_t count, Deserializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
            uint8_t& val = (uint8_t&)obj[i];
            isOk = Load(&val, 1, serializer) && isOk;
        }
        return isOk;
    }
    bool Save(const int8_t* obj, uint32_t count, Serializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Load(int8_t* obj, uint32_t count, Deserializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Save(const int16_t* obj, uint32_t count, Serializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Load(int16_t* obj, uint32_t count, Deserializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Save(const int32_t* obj, uint32_t count, Serializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Load(int32_t* obj, uint32_t count, Deserializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Save(const int64_t* obj, uint32_t count, Serializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Load(int64_t* obj, uint32_t count, Deserializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Save(const uint8_t* obj, uint32_t count, Serializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Load(uint8_t* obj, uint32_t count, Deserializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Save(const uint16_t* obj, uint32_t count, Serializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Load(uint16_t* obj, uint32_t count, Deserializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Save(const uint32_t* obj, uint32_t count, Serializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Load(uint32_t* obj, uint32_t count, Deserializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Save(const uint64_t* obj, uint32_t count, Serializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Load(uint64_t* obj, uint32_t count, Deserializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Save(const bool* obj, uint32_t count, Serializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Load(bool* obj, uint32_t count, Deserializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Save(const float* obj, uint32_t count, Serializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Load(float* obj, uint32_t count, Deserializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Save(const double* obj, uint32_t count, Serializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Load(double* obj, uint32_t count, Deserializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Save(const char* obj, uint32_t count, Serializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Load(char* obj, uint32_t count, Deserializer& serializer)
    {
        bool isOk = true;
        for (uint32_t i = 0; i < count; ++i)
        {
        }
        return isOk;
    }
    bool Save(const Test* 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;
    }
    bool Load(Test* 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;
    }
    bool Save(const Texture* 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;
            isOk = serializer.Write(&obj[i], sizeof(obj[i])) && isOk;
            isOk = serializer.Write(&obj[i], sizeof(obj[i])) && isOk;
            isOk = Save(&obj[i].T, 1, serializer) && isOk;
        }
        return isOk;
    }
    bool Load(Texture* 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;
            isOk = serializer.Read(&obj[i], sizeof(obj[i])) && isOk;
            isOk = serializer.Read(&obj[i], sizeof(obj[i])) && isOk;
            isOk = Load(&obj[i].T, 1, serializer) && isOk;
        }
        return isOk;
    }
}
