Description
Base class for all BINARY OUTPUT streams.
Implemented in a way such that the stream is platform independent (see the 'little endian' stuff in 'floating point to persistent data' topics). Defines some << operators from basic types, converting all them into calls to the Output() function. At least some inherited class should be used by the user in order to get some practical effect (file saving, etc.)
#include <ChStream.h>
Public Member Functions | |
template<class T > | |
ChStreamOutBinary & | operator< (T &obj) |
Generic << operator for all classes which implement serialization by means of a method named 'void StreamOut(ChStreamOutBinary&)' OBSOLETE use ChArchive << operator and ArchiveOut() | |
ChStreamOutBinary & | operator<< (char Val) |
Specialized operators for basic primitives (numbers like long, double, int. More... | |
ChStreamOutBinary & | operator<< (bool Val) |
ChStreamOutBinary & | operator<< (int Val) |
ChStreamOutBinary & | operator<< (unsigned int Val) |
ChStreamOutBinary & | operator<< (double Val) |
ChStreamOutBinary & | operator<< (float Val) |
ChStreamOutBinary & | operator<< (const std::string &str) |
ChStreamOutBinary & | operator<< (long Val) |
ChStreamOutBinary & | operator<< (unsigned long Val) |
ChStreamOutBinary & | operator<< (unsigned long long Val) |
ChStreamOutBinary & | operator<< (const char *str) |
Specialized operator for C strings. | |
ChStreamOutBinary & | operator<< (char *str) |
template<class T > | |
void | GenericBinaryOutput (T &ogg) |
Generic operator for binary streaming of generic objects. More... | |
template<class t > | |
t * | AbstractWrite (t *pObj) |
Stores an object, given the pointer, into the archive. More... | |
template<class t > | |
t * | AbstractWriteAll (t *pObj) |
Stores an object, given the pointer, into the archive. More... | |
void | VersionWrite (int mver) |
Some objects may write class version at the beginning of the streamed data, using this function. | |
Public Member Functions inherited from chrono::ChBinaryArchive | |
bool | IsBigEndianMachine () |
Returns true if the machine where the code runs has big endian byte ordering, returns false otherwise. | |
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... | |
Additional Inherited Members | |
Public Types inherited from chrono::ChStream | |
enum | eChMode { CHFILE_NORMAL = 0, CHFILE_NOWRITE, CHFILE_SAFEWRITE, CHFILE_OPENLATER } |
[Obsolete] Modes for chrono files (the ch-modes). More... | |
enum | eChStreamError { CHSTREAM_OK = 0, CHSTREAM_EOF, CHSTREAM_FAIL } |
Errors for chrono files (the ch-modes). More... | |
Protected Member Functions inherited from chrono::ChStreamOut | |
virtual void | Output (const char *data, size_t n)=0 |
Outputs a raw chunk of data, from pointer 'data' up to 'n' chars (bytes). More... | |
Protected Attributes inherited from chrono::ChBinaryArchive | |
bool | big_endian_machine |
std::vector< void * > | objects_pointers |
Vector of pointers to stored/retrieved objects. | |
Member Function Documentation
◆ AbstractWrite()
|
inline |
Stores an object, given the pointer, into the archive.
This function can be used to serialize objects from nontrivial class trees, where at load time one may wonder which was the class type of the saved object. Note: the object must be load with ChStreamInBinary::AbstractReadCreate() Also, the AbstractWrite()-AbstractReadCreate() mechanism avoids storing/creating multiple times the shared objects. Supports only objects with Chrono RTTI and serializer member StreamOut(). OBSOLETE use ChArchive << operator
◆ AbstractWriteAll()
|
inline |
Stores an object, given the pointer, into the archive.
This function can be used to serialize objects from nontrivial class trees, where at load time one may wonder which was the class type of the saved object. Note: the object must be load with ChStreamInBinary::AbstractReadCreate() Also, the AbstractWrite()-AbstractReadCreate() mechanism avoids storing/creating multiple times the shared objects. Supports only objects with Chrono RTTI and serializer member StreamOut(). OBSOLETE use ChArchive << operator
◆ GenericBinaryOutput()
|
inline |
Generic operator for binary streaming of generic objects.
WARNING!!! raw byte streaming! If class 'T' contains double, int, long, etc, these may give problems when loading on another platform which has big-endian ordering, if generated on a little-endian platform...
◆ operator<<()
ChStreamOutBinary & chrono::ChStreamOutBinary::operator<< | ( | char | Val | ) |
Specialized operators for basic primitives (numbers like long, double, int.
etc., and booleans) Handle byte ordering issues in little.endian/big.endian representations, for cross platform portability.
The documentation for this class was generated from the following files:
- /builds/uwsbel/chrono/src/chrono/core/ChStream.h
- /builds/uwsbel/chrono/src/chrono/core/ChStream.cpp