#ifndef DNA_HPP #define DNA_HPP /* BIG FAT WARNING!!! * * The type-structure of this file is expected to remain consistent for 'atdna' * Any changes to the types or namespacing must be reflected in 'atdna/main.cpp' */ #include "Global.hpp" #include "IStreamReader.hpp" #include "IStreamWriter.hpp" #include #include namespace Athena { namespace io { /** * @brief Base DNA class used against 'atdna' * * Athena bundles a build-tool called 'atdna'. This tool functions * just like the 'clang' compiler, except it emits a full .cpp implementation * with all read/write calls necessary to marshal the DNA structure to/from * a streamed medium */ template struct DNA { template using Value = T; template using Vector = std::vector; template using Buffer = std::unique_ptr; template using String = std::string; template using WString = std::wstring; template using UTF8 = std::string; template struct Seek {}; template struct Align {}; virtual void read(IStreamReader&)=0; virtual void write(IStreamWriter&) const=0; }; /** Macro to automatically declare read/write methods in subclasses */ #define DECL_DNA \ void read(Athena::io::IStreamReader&); \ void write(Athena::io::IStreamWriter&) const; \ /** Macro to supply count variable to atdna and mute it for other compilers */ #ifdef __clang__ #define DNA_COUNT(cnt) sizeof(cnt) #else #define DNA_COUNT(cnt) 0 #endif } } #endif // DNA_HPP