/Engine/Plugins/Animation/RigLogic/Source/RigLogicLib/Public/terse/types/ArchiveSize.h
ArchiveSizeis a type that stores an arbitrary size value (both in-memory and writes that value into the stream as well). It has two accompanying types:ProxyandAnchor, which are both virtual, utility types, and they work together to achieve the function ofArchiveSize. WhenArchiveSizeis encountered during the serialization process, at first an empty size (zero) value will be written into the stream and the position of that size value will be captured in an in-memory variable. Later, when its associatedAnchoris encountered, it will capture the current stream position as the base (start) offset, from which the size is going to be computed (size is relative to some base offset). Lastly, when its ArchiveSize::Proxy is encountered, the current stream position will be captured, and the earlier captured anchor base offset will be subtracted from it (resulting in the size value - the size betweenAnchoroffset andProxyoffset). With the size value computed, it will update the in-memory value stored inArchiveSizewith it. Then, it will seek the stream to the earlier captured position of the size value (where zeros were written initially), and it will write the size value into the stream at that position. With all that done, it will seek back to the position of the stream before the proxy was encountered, and resume serialization.
template<typename TSize, typename TOffset> struct ArchiveSize
std::size_t
position
The position of the marker itself in the stream (this is a runtime-only value which is not written to the file, needed only for the serializer to know where to seek within the stream when the marker's actual value needs to be written)
Proxy*
proxy
When size is moved, it's associated proxy must be updated about the new address.
ValueType
value
The size value itself (what is written to the file)