athena/atdna/test.hpp

74 lines
1.9 KiB
C++
Raw Normal View History

2016-03-04 23:00:12 +00:00
#include <athena/DNAYaml.hpp>
2015-08-03 01:42:47 +00:00
2016-03-04 23:00:12 +00:00
using namespace athena;
typedef io::DNA<Endian::Big> BigDNA;
2015-08-03 01:42:47 +00:00
2018-12-08 05:18:17 +00:00
enum ETest : atUint8 { ZERO, ONE, TWO, THREE };
template <ETest EVal>
2018-12-08 05:18:17 +00:00
struct AT_SPECIALIZE_PARMS(ETest::ZERO, ETest::ONE, ETest::TWO, ETest::THREE) TESTSubFile : public BigDNA {
AT_DECL_DNA
Value<ETest> varE = EVal;
Value<atUint32> sub1;
Value<atUint32> sub2;
2015-08-03 01:42:47 +00:00
};
2018-12-08 05:18:17 +00:00
struct TESTSubClassFile : public TESTSubFile<ETest::ONE> {
AT_DECL_DNA
Value<atUint32> sub3;
Value<atUint16> sub4;
2015-08-03 01:42:47 +00:00
};
2018-12-08 05:18:17 +00:00
struct TESTSubSubClassFile : public TESTSubClassFile {
AT_DECL_DNA
Value<atUint32> sub5;
Value<atUint32> sub6;
2015-08-03 01:42:47 +00:00
};
template <class Var32Tp, int Var32Val>
2018-12-08 05:18:17 +00:00
struct AT_SPECIALIZE_PARMS(atUint16, 42, atUint32, 87, atUint32, 2) TESTFile : public BigDNA {
AT_DECL_DNA
Value<bool> varBool;
AT_OVERRIDE_RCRC32(12345678) Value<Var32Tp> x4_var32 = Var32Val;
AT_OVERRIDE_RCRC32(deadbabe) Value<atUint16> x8_var16;
Value<atVec3f> vec3;
Value<atVec4f> vec4;
struct TESTNestedSubFile : public BigDNA {
AT_DECL_DNA
2018-12-08 05:18:17 +00:00
Value<atUint32> nestSub1;
Value<atUint32> nestSub2;
} nestedSubFile;
using TESTSubFileUsing = TESTSubFile<ETest::TWO>;
TESTSubFileUsing subFile;
2015-08-03 01:42:47 +00:00
2018-12-08 05:18:17 +00:00
Align<4> align;
template <class NestedTp, int NestedVal>
struct AT_SPECIALIZE_PARMS(atInt32, 36, atInt64, 96) TESTTemplateSubFile : public BigDNA {
AT_DECL_DNA
Value<NestedTp> explSub1 = NestedVal;
Value<Var32Tp> explSub2 = Var32Val;
};
Value<TESTTemplateSubFile<atInt32, 36>> nestedTemplate1;
Value<TESTTemplateSubFile<atInt64, 96>> nestedTemplate2;
Value<atUint32, Endian::Little> arrCount[2];
2018-12-08 05:18:17 +00:00
Vector<atUint32, AT_DNA_COUNT(arrCount[0])> array;
Value<atUint32> arrAltCount;
Vector<atUint32, AT_DNA_COUNT(arrAltCount)> arrayAlt;
Seek<21, SeekOrigin::Current> seek;
2018-12-08 05:18:17 +00:00
Value<atUint32> arrCount2;
Vector<TESTSubFile<ETest::ZERO>, AT_DNA_COUNT(arrCount[1] + arrCount2)> array2;
Value<atUint32> bufSz;
Buffer<AT_DNA_COUNT(bufSz)> buf;
String<32> str;
WString<64> wstr;
};