SerialiseReflectedVariable.h

// SerialiseReflectedVariable.h
//
// Author David Barrett-Lennard
// (C)opyright Cedanet Pty Ltd 2007

@import "cxObject.h"
@import "ReflectionByteCode.h"

/*
Reflection information allows the framework to serialise / deserialise an object in an efficient,
platform independent binary format.

This is needed by the operational transform system to serialise the keys of maps.

Type Restriction
----------------

The following restriction is imposed on types that may be serialised:  As the reflected type is
recursed the debug build will assert if it comes across any of the following

        FT_INTERFACE_POINTER
        FT_INTERFACE
        FT_POINTER
        FT_FUNCTION_PTR
        FT_REFERENCE

*/

namespace ceda
{
/*
struct ReflectedInterface;
struct ReflectedGlobalFunction;
struct ReflectedGlobalVariable;
struct ReflectedTypedef;
struct ReflectedEnum;

template<typename T>
@api SerialiseReflectedObject(Archive& ar, ptr<T> x);

template<typename T>
@api DeserialiseReflectedObject(Archive& ar, ptr<T> x);
*/

struct ReflectedClass;

// Callbacks for serialising/deserialising a pref/cref member
class prefbase;
@api extern void (*g_SerialisePrefArray)(Archive& ar, const prefbase* p, ssize_t count);
@api extern void (*g_DeserialisePrefArray)(InputArchive& ar, prefbase* p, ssize_t count);


///////////////////////////////////////////////////////////////////////////////////////////////////
// Serialisation

@api void SerialiseReflectedVariable(Archive& ar, ReflectionByteCode rbc, const void* data);
@api void SerialiseReflectedArrayVariable(Archive& ar, ReflectionByteCode rbc, ssize_t count, const void* data);
@api void SerialiseReflectedVectorVariable(Archive& ar, ReflectionByteCode rbcElement, const void* data);
@api void SerialiseReflectedClassVariable(Archive& ar, const ReflectedClass& rc, const void* data);
@api void SerialiseReflectedVariantVariable(Archive& ar, const ReflectedVariant& rv, const void* data);
@api void SerialiseReflectedClassArrayVariable(Archive& ar, const ReflectedClass& rc, ssize_t count, const void* data);
@api void SerialiseReflectedVariantArrayVariable(Archive& ar, const ReflectedVariant& rv, ssize_t count, const void* data);

///////////////////////////////////////////////////////////////////////////////////////////////////
// Deserialisation

@api void DeserialiseReflectedVariable(InputArchive& ar, ReflectionByteCode rbc, void* data);
@api void DeserialiseReflectedArrayVariable(InputArchive& ar, ReflectionByteCode rbc, ssize_t count, void* data);
@api void DeserialiseReflectedVectorVariable(InputArchive& ar, ReflectionByteCode rbcElement, void* data);
@api void DeserialiseReflectedClassVariable(InputArchive& ar, const ReflectedClass& rc, void* data);
@api void DeserialiseReflectedVariantVariable(InputArchive& ar, const ReflectedVariant& rv, void* data);
@api void DeserialiseReflectedClassArrayVariable(InputArchive& ar, const ReflectedClass& rc, ssize_t count, void* data);
@api void DeserialiseReflectedVariantArrayVariable(InputArchive& ar, const ReflectedVariant& rv, ssize_t count, void* data);

///////////////////////////////////////////////////////////////////////////////////////////////////
// Scan over the archive without setting the value of a variable

@api void ScanOverReflectedVariable(InputArchive& ar, ReflectionByteCode rbc);
@api void ScanOverReflectedArrayVariable(InputArchive& ar, ReflectionByteCode rbc, ssize_t count);
@api void ScanOverReflectedVectorVariable(InputArchive& ar, ReflectionByteCode rbcElement);
@api void ScanOverReflectedClassVariable(InputArchive& ar, const ReflectedClass& rc);
@api void ScanOverReflectedVariantVariable(InputArchive& ar, const ReflectedVariant& rv);
@api void ScanOverReflectedClassArrayVariable(InputArchive& ar, const ReflectedClass& rc, ssize_t count);
@api void ScanOverReflectedVariantArrayVariable(InputArchive& ar, const ReflectedVariant& rv, ssize_t count);

} // namespace ceda