ArchiveMagic.h
// ArchiveMagic.h
//
// Author David Barrett-Lennard
// (C)opyright Cedanet Pty Ltd 2019
#pragma once
#ifndef Ceda_cxUtils_ArchiveMagic_H
#define Ceda_cxUtils_ArchiveMagic_H
#include "Archive.h"
#include "Tracer.h"
namespace ceda
{
#define CEDA_ENABLE_ARCHIVE_MAGIC 0
template <typename Archive>
inline void SerialiseMagic(Archive& ar, int32 magic)
{
#if CEDA_ENABLE_ARCHIVE_MAGIC
//Tracer() << "------------------------ Writing magic : " << magic << '\n';
ar << (magic ^ 0x5A6A7A00);
#endif
}
template <typename Archive>
inline void DeserialiseMagic(Archive& ar, int32 magic)
{
#if CEDA_ENABLE_ARCHIVE_MAGIC
uint32 m;
ar >> m;
if (m != (magic ^ 0x5A6A7A00))
{
Tracer() << "------------------------ Failure reading magic : " << magic << '\n';
}
cxAssert(m == (magic ^ 0x5A6A7A00));
//Tracer() << "------------------------ Success reading magic : " << magic << '\n';
#endif
}
} // namespace ceda
#endif // include guard