athena/include/Athena/DNA.hpp

44 lines
866 B
C++
Raw Normal View History

2015-06-15 02:49:02 +00:00
#ifndef DNA_HPP
#define DNA_HPP
2015-06-16 02:29:53 +00:00
#include "Global.hpp"
#include "IStreamReader.hpp"
#include "IStreamWriter.hpp"
2015-06-15 02:49:02 +00:00
#include <vector>
2015-06-17 00:25:48 +00:00
#include <functional>
2015-06-15 02:49:02 +00:00
namespace Athena
{
namespace io
{
2015-06-16 02:29:53 +00:00
/**
* @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
*/
2015-06-17 00:25:48 +00:00
template <Endian DNAE>
2015-06-15 02:49:02 +00:00
struct DNA
{
2015-06-16 07:11:56 +00:00
template <typename T, Endian VE = DNAE>
2015-06-16 02:29:53 +00:00
using Value = T;
2015-06-15 02:49:02 +00:00
2015-06-17 00:25:48 +00:00
template <typename T, size_t cntVar, Endian VE = DNAE>
2015-06-16 02:29:53 +00:00
using Vector = std::vector<T>;
2015-06-15 02:49:02 +00:00
2015-06-16 02:29:53 +00:00
virtual void read(IStreamReader&)=0;
virtual void write(IStreamWriter&) const=0;
};
2015-06-15 02:49:02 +00:00
2015-06-17 00:25:48 +00:00
/** Macro to automatically declare read/write methods in subclasses */
#define DECL_DNA \
void read(Athena::io::IStreamReader&); \
void write(Athena::io::IStreamWriter&) const; \
2015-06-15 02:49:02 +00:00
}
}
#endif // DNA_HPP