libgig  4.4.1
Serialization::UID Class Reference

Unique identifier referring to one specific native C++ object, member, fundamental variable, or any other native C++ data. More...

#include <Serialization.h>

Public Member Functions

bool isValid () const
 Check whether this is a valid unique identifier. More...
 
 operator bool () const
 Same as calling isValid().
 
bool operator== (const UID &other) const
 
bool operator!= (const UID &other) const
 
bool operator< (const UID &other) const
 
bool operator> (const UID &other) const
 

Static Public Member Functions

template<typename T >
static UID from (const T &obj)
 Create an unique indentifier for a native C++ object/member/variable. More...
 

Public Attributes

ID id
 Abstract non-unique ID of the object or member in question.
 
size_t size
 Memory size of the object or member in question.
 

Detailed Description

Unique identifier referring to one specific native C++ object, member, fundamental variable, or any other native C++ data.

Reflects a unique identifier for one specific serialized C++ data, i.e. C++ class instance, C/C++ struct instance, member, primitive pointer, fundamental variables, or any other native C/C++ data originally being serialized.

A unique identifier is composed of an id (an identifier which is not necessarily unique) and a size. Since the underlying ID is derived from the original C++ object's memory location, such an ID is not sufficient to distinguish a particular C++ object from the first member of that C++ object, since both typically share the same memory address. So additionally the memory size of the respective object or member is bundled with UID objects to make them unique and distinguishable.

Definition at line 321 of file Serialization.h.

Member Function Documentation

◆ from()

template<typename T >
static UID Serialization::UID::from ( const T &  obj)
inlinestatic

Create an unique indentifier for a native C++ object/member/variable.

Creates and returns an unique identifier for the passed native C++ object, object member or variable. For the same C++ object/member/variable this function will always return the same UID. For all other ones, this function is guaranteed to return a different UID.

Definition at line 342 of file Serialization.h.

References Serialization::NO_UID.

Referenced by Serialization::Archive::deserialize(), Serialization::Archive::serialize(), Serialization::Archive::serializeHeapMember(), Serialization::Archive::serializeMember(), Serialization::Archive::setMinVersion(), and Serialization::Archive::setVersion().

◆ isValid()

bool Serialization::UID::isValid ( ) const

Check whether this is a valid unique identifier.

Returns false if this UID can be considered an invalid unique identifier. This is for example the case if this UID object was not explicitly set to some certain meaningful unique identifier value, or if this UID object was intentionally assigned the constant NO_UID value. Both represent essentially an UID object which is all zero.

Note that this class also implements the bool operator, both return the same boolean result.

Definition at line 66 of file Serialization.cpp.

References size.

Referenced by operator bool(), Serialization::DataType::operator bool(), Serialization::Member::operator bool(), Serialization::Object::operator bool(), Serialization::Archive::rootObject(), Serialization::Archive::setMinVersion(), and Serialization::DataType::size().


The documentation for this class was generated from the following files: