libgig  4.3.0
Serialization::Archive::Syncer Class Reference

Synchronizes 2 archives with each other. More...

#include <Serialization.h>

Public Member Functions

 Syncer (Archive &dst, Archive &src)
 
void syncObject (const Object &dst, const Object &src)
 
void syncPrimitive (const Object &dst, const Object &src)
 
void syncString (const Object &dst, const Object &src)
 
void syncArray (const Object &dst, const Object &src)
 
void syncSet (const Object &dst, const Object &src)
 
void syncMap (const Object &dst, const Object &src)
 
void syncPointer (const Object &dst, const Object &src)
 
void syncMember (const Member &dstMember, const Member &srcMember)
 

Static Protected Member Functions

static Member dstMemberMatching (const Object &dstObj, const Object &srcObj, const Member &srcMember)
 

Detailed Description

Synchronizes 2 archives with each other.

This class is used internally at final stage of deserialization. It is not used for serialization.

The deserialization algorithm of this framework works like this:

  1. The (currently running) application constructs an Archive object by passing a previously serialized raw data stream to the Archive constructor. At this stage, the raw data stream is decoded and this archive's object pool is populated with objects, which in turn are filled with data (at temporary storage location inside the respective Object instances) of the decoded data stream.
  2. A temporary (2nd) Archive object is constructed internally by this framework, reflecting the (currently running) application's latest data structre layout, without touching any actual data yet. The individual Object instances of this 2nd Archive are bound to the running application's native (target) C/C++ member variables to be updated (written to) next.

Note that at this point, the 2 archives might very well have quite different data structure layouts, due to potential software changes between the original serializing application and this currently deserializing software application.

  1. This Syncer class is used to transfer the actual data from the 1st to the 2nd (temporary) Archive object, it does so by traversing the 2 archives' object pools, trying to find the respective 2 objects on the two sides to be synchronized, and if found, it transfers the data from the 1st archive's object to the 2nd archive's object, effectively writing to the currently running application's final C/C++ memory locations.

This 3 staged approach allows to deserialize data in a much more relaxed, adaptive and flexible (while still automatic) way than traditional serialization frameworks would do.

Definition at line 1633 of file Serialization.h.


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