OID.h
// OID.h
//
// Author David Barrett-Lennard
// (C)opyright Cedanet Pty Ltd 2006
#include "Ceda/cxLss/Seid2.h"
@import "cxPersistStore.h"
@import "Ceda/cxObject/Object.h"
@import "Ceda/cxObject/ThreadPtr.h"
namespace ceda
{
class Archive;
$typedef+ uint32 OidHigh;
$typedef+ uint32 OidLow;
$typedef+ uint32 SeidLow;
$typedef+ uint32 SeidHigh;
$struct Seid;
///////////////////////////////////////////////////////////////////////////////////////////////////
// OID
// OID must be a different type than Seid because it is serialised differently
$struct+ OID : public Seid
{
OID(NullInterface) {}
OID(std::nullptr_t) {}
OID(Seid s) : Seid(s) {}
OID(SeidLow low,SeidHigh high) : Seid(low,high) {}
OID() {}
bool operator==(const OID& other) const
{
return Seid::operator==(other);
}
bool operator!=(const OID& other) const
{
return Seid::operator!=(other);
}
bool operator<(const OID& other) const
{
return Seid::operator<(other);
}
};
// Special version of OID serialisation that achieves better compression
@api void SerialiseCompressedOidPart(Archive& ar, uint32 oidPart);
@api void DeserialiseCompressedOidPart(InputArchive& ar, uint32& oidPart);
///////////////////////////////////////////////////////////////////////////////////////////////////
// Functions that allow for OidHigh conversion
/*
The high 32 bits of an OID is called the OidHigh. Typically OidHighs are defined locally within a
process and must be mapped to different values in another process.
Normally we only perform OidHigh translation at the receiver. The sender never translates OIDs.
However the sender needs to monitor sent OIDs so it can send OidHigh-OidSpaceGuid pairs.
We may need OID transaction to implement cloning. Ceda1 used an interface to receive callbacks
for reading,writing prefs, rather than the underlying OIDs.
The following functions call the m_oidHighSerialiser or m_oidHighDeserialiser members defined in Archive for
allowing for customised reading and writing of OidHigh values.
*/
struct IOidHighDeserialiser
{
virtual void DeserialiseOidHigh(InputArchive& ar, OidHigh& x) = 0;
};
@api IOidHighDeserialiser* GetThreadOidHighDeserialiser();
@api void SetThreadOidHighDeserialiser(IOidHighDeserialiser* p);
@api void SerialiseOidHigh(Archive& ar, OidHigh x);
@api void DeserialiseOidHigh(InputArchive& ar, OidHigh& x);
@api void SerialiseOid(Archive& ar, OID oid);
@api void DeserialiseOid(InputArchive& ar, OID& oid);
template<typename Archive>
inline void Serialise(Archive& ar, const OID& oid)
{
SerialiseOid(ar,oid);
}
template<typename Archive>
inline void Deserialise(Archive& ar, OID& oid)
{
DeserialiseOid(ar,oid);
}
} // namespace ceda