2021-06-27 21:25:29 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
|
|
|
File: Data.hpp
|
|
|
|
Date: 2021-6-10
|
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
|
2021-10-24 09:04:02 +00:00
|
|
|
#include "EDataType.hpp"
|
|
|
|
#include "PrimitiveValue.hpp"
|
|
|
|
#include "Value.hpp"
|
|
|
|
#include "TypedValue.hpp"
|
|
|
|
|
2021-06-27 21:25:29 +00:00
|
|
|
namespace Aurora::Data
|
|
|
|
{
|
2021-09-06 10:58:08 +00:00
|
|
|
#if !defined(_CPPSHARP)
|
2021-10-24 09:04:02 +00:00
|
|
|
template<EDataType type>
|
2021-06-27 21:25:29 +00:00
|
|
|
static constexpr AuUInt GetDatatypeLength()
|
|
|
|
{
|
|
|
|
switch /*constexpr*/ (type)
|
|
|
|
{
|
2021-10-24 09:04:02 +00:00
|
|
|
case EDataType::kTypeBoolean: return 1;
|
|
|
|
case EDataType::kTypeStructFloat: return 4;
|
|
|
|
case EDataType::kTypeStructDouble: return 8;
|
|
|
|
case EDataType::kTypeVec3: return 3 * 4;
|
|
|
|
case EDataType::kTypeVec4: return 4 * 4;
|
|
|
|
case EDataType::kTypeStructUInt8: return 1;
|
|
|
|
case EDataType::kTypeStructInt8: return 1;
|
|
|
|
case EDataType::kTypeStructUInt16: return 2;
|
|
|
|
case EDataType::kTypeStructInt16: return 2;
|
|
|
|
case EDataType::kTypeStructUInt32: return 4;
|
|
|
|
case EDataType::kTypeStructInt32: return 4;
|
|
|
|
case EDataType::kTypeStructUInt64: return 8;
|
|
|
|
case EDataType::kTypeStructInt64: return 8;
|
2021-10-02 16:07:33 +00:00
|
|
|
default: return 0;//static_assert(false, "invalid datatype");
|
2021-06-27 21:25:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-24 09:04:02 +00:00
|
|
|
static AuUInt GetDatatypeLength(EDataType type)
|
2021-06-27 21:25:29 +00:00
|
|
|
{
|
|
|
|
switch /*constexpr*/ (type)
|
|
|
|
{
|
2021-10-24 09:04:02 +00:00
|
|
|
case EDataType::kTypeBoolean: return 1;
|
|
|
|
case EDataType::kTypeStructFloat: return 4;
|
|
|
|
case EDataType::kTypeStructDouble: return 8;
|
|
|
|
case EDataType::kTypeVec3: return 3 * 4;
|
|
|
|
case EDataType::kTypeVec4: return 4 * 4;
|
|
|
|
case EDataType::kTypeStructUInt8: return 1;
|
|
|
|
case EDataType::kTypeStructInt8: return 1;
|
|
|
|
case EDataType::kTypeStructUInt16: return 2;
|
|
|
|
case EDataType::kTypeStructInt16: return 2;
|
|
|
|
case EDataType::kTypeStructUInt32: return 4;
|
|
|
|
case EDataType::kTypeStructInt32: return 4;
|
|
|
|
case EDataType::kTypeStructUInt64: return 8;
|
|
|
|
case EDataType::kTypeStructInt64: return 8;
|
2021-11-05 17:34:23 +00:00
|
|
|
default: return 0;
|
2021-06-27 21:25:29 +00:00
|
|
|
}
|
|
|
|
}
|
2021-09-06 10:58:08 +00:00
|
|
|
#endif
|
2021-10-02 16:07:33 +00:00
|
|
|
}
|