AuroraRuntime/Include/Aurora/Data/Data.hpp
Reece 99c5e1fa65 A pretty large patch not worth breaking up into separate commits
[*] Split up Aurora Async
[*] Split Async app into seperate ThreadPool concept
[*] Fix various OSThread bugs and tls transfer issues
[*] Set default affinity to 0xFFFFFFFF
[*] Update Build script
[+] Add AuTuplePopFront
[+] New Network Interface (unimplemented)
[*] Stub out the interfaces required for a better logger
[*] Fix Win32 ShellExecute bug; windows 11 struggles without explicit com init per the docs - now deferring to thread pool
[*] Update gitignore
[*] Follow XDG home standard
[*] Refactor some namespaces to use the shorthand aliases
[*] Various stability fixes
2021-11-05 17:34:23 +00:00

62 lines
2.1 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: Data.hpp
Date: 2021-6-10
Author: Reece
***/
#pragma once
#include "EDataType.hpp"
#include "PrimitiveValue.hpp"
#include "Value.hpp"
#include "TypedValue.hpp"
namespace Aurora::Data
{
#if !defined(_CPPSHARP)
template<EDataType type>
static constexpr AuUInt GetDatatypeLength()
{
switch /*constexpr*/ (type)
{
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;
default: return 0;//static_assert(false, "invalid datatype");
}
}
static AuUInt GetDatatypeLength(EDataType type)
{
switch /*constexpr*/ (type)
{
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;
default: return 0;
}
}
#endif
}