chrono::ChBinaryArchive Class Reference

Description

Base class for streams (either in or out) based on binary formats.

This class implements a basic functionality about platform-independent treatment of data (the big-endian/little-endian issue). Also this class implements functionality to avoid storing multiple times the same object (persistent data archive).

#include <ChStream.h>

Inheritance diagram for chrono::ChBinaryArchive:

Public Member Functions

bool IsBigEndianMachine ()
 Returns true if the machine where the code runs has big endian byte ordering, returns false otherwise. More...
 
void Init ()
 Reinitialize the vector of pointers to loaded/saved objects.
 
int PutPointer (void *object)
 Put a pointer in pointer vector, but only if it was not previously inserted. More...
 

Protected Attributes

bool big_endian_machine
 
std::vector< void * > objects_pointers
 vector of pointers to stored/retrieved objects, to avoid saving duplicates or deadlocks
 

Member Function Documentation

bool chrono::ChBinaryArchive::IsBigEndianMachine ( )

Returns true if the machine where the code runs has big endian byte ordering, returns false otherwise.

int chrono::ChBinaryArchive::PutPointer ( void *  object)

Put a pointer in pointer vector, but only if it was not previously inserted.

Returns position of pointer if already existing, otherwise -1.