C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2
io_tape.h File Reference

Serialization: utilities for reading and writing of stream classes. More...

#include <io_tape_define.h>
#include <io_memory_buffer.h>
#include <templ_pointer.h>
#include <templ_sfdp_array.h>
#include <alg_indicator.h>
#include <tool_cstring.h>
#include <hash32.h>
#include <tool_mutex.h>
#include <map>
#include <typeinfo>

Classes

class  TapeRegistrator
 Compile with the given preprocessor define for control of reading/writing char* and TCHAR* only via ReadTCHAR/WriteTCHAR(), not via illegally operator << and >>. More...
 
class  TapeRegistratorEx
 Array for registration of objects with information about reading/writing position. More...
 
class  ScopedReadProgress
 Scoped progress indicator for reader. More...
 
class  ClassDescriptor
 Packed class name. More...
 
class  TapeClass
 "Wrapper" for one stream class. More...
 
class  TapeManager
 Stream manager. More...
 
struct  TapeClassContainer
 Array of stream classes registration. More...
 
class  rw
 Stream for reading and writing. More...
 
class  C3DLocaleSwitcher
 Local setting of the locale. More...
 

Namespaces

 c3d
 C3D namespace declaration.
 

Macros

#define C3D_IO_CATCH_START    try {
 Start try-catch region for I/O operations.
 
#define C3D_IO_CATCH_END(iostrm)
 Complete try-catch region for I/O operations (argument iostrm - reading or writing stream).
 
#define IMP_PERSISTENT_OPS_BASE(Class, DLLFUNC)
 Implementation of friend operators of reading and writing of pointers and references declared in DECLARE_PERSISTENT_OPS_BASE macro.
 
#define IMP_CLASS_DESC_FUNC(AppID, Class)
 Implementation of DECLARE_CLASS_DESC_FUNC marco.
 
#define IMP_PERSISTENT_REGISTRATION(AppID, Class)
 Construction of a new instance of the class. More...
 
#define IMP_PERSISTENT_NEW_DELETE_CLASS(Class)
 Implementation of functions new, delete and access operators (declared в DECLARE_NEW_DELETE_CLASS).
 
#define IMP_PERSISTENT_NEW_DELETE_CLASS_EX(Class)
 Implementation of new and delete operators which provides sequential access to the allocation/deallocation functions from different threads (declared in DECLARE_NEW_DELETE_CLASS_EX).
 
#define IMP_PERSISTENT_CLASS_OPS(AppID, Class, DLLFUNC)
 Implementation of DECLARE_PERSISTENT_CLASS_BASE declaration. More...
 
#define IMP_A_PERSISTENT_CLASS_OPS(AppID, Class, DLLFUNC)
 Implementation of DECLARE_PERSISTENT_CLASS_BASE declaration for an abstract stream class. More...
 
#define IMP_PERSISTENT_CLASS_NEW_DEL_OPS(AppID, Class, DLLFUNC)
 Implementation of DECLARE_PERSISTENT_CLASS_NEW_DEL_BASE declaration. More...
 
#define IMP_PERSISTENT_CLASS_FROM_BASE_NEW_DEL(AppID, Class, Base)
 Analog of IMP_PERSISTENT_CLASS_FROM_BASE macro with support of new/delete operators overloading which provides sequential access to the allocation/deallocation functions from different threads. More...
 
#define IMP_PERSISTENT_CLASS_WD_NEW_DEL(AppID, Class)
 Analog of IMP_PERSISTENT_CLASS_WD macro with support of new/delete operators overloading which provides sequential access to the allocation/deallocation functions from different threads. More...
 
#define IMP_PERSISTENT_CLASS(AppID, Class)
 Implementation of DECLARE_PERSISTENT_CLASS declaration. More...
 
#define IMP_PERSISTENT_CLASS_NEW_DEL(AppID, Class)
 Analog of IMP_PERSISTENT_CLASS macro with support of new/delete operators overloading which provides sequential access to the allocation/deallocation functions from different threads. More...
 
#define IMP_PERSISTENT_RO_REGISTRATION(AppID, Class)
 Construction of a new instance of the class for a class without writing.
 
#define IMP_PERSISTENT_RO_CLASS_NEW_DEL(AppID, Class)
 Analog of IMP_PERSISTENT_RO_CLASS macro with support of new/delete operators overloading which provides sequential access to the allocation/deallocation functions from different threads. More...
 
#define DECLARE_PERSISTENT_OPS_B(Class)
 Declaration of operators of reading and writing of pointers and references. More...
 
#define DECLARE_PERSISTENT_RO_OPS(Class)
 Operators of reading pointers and references for a class without writing. More...
 
#define DECLARE_PERSISTENT_RO_FUNCS(Class)
 Function of reading for class without writing. More...
 
#define IMP_PERSISTENT_CTOR(Class)    Class::Class( TapeInit ) {}
 Constructor for a stream class.
 
#define IMP_PERSISTENT_CTOR1(Class, Base)    Class::Class( TapeInit ) : Base( tapeInit ) {}
 Constructor for a class with one stream base.
 
#define IMP_PERSISTENT_CTOR2(Class, Base1, Base2)    Class::Class( TapeInit ) : Base1( tapeInit ), Base2( tapeInit ) {}
 Constructor for a class with two stream bases.
 

Typedefs

typedef TapeBase *CALL_DECLARATIONBUILD_FUNC(void)
 Template of function of a new instance creation.
 
typedef void *CALL_DECLARATIONCAST_FUNC(const TapeBase *)
 Template of conversion function. More...
 
typedef void *typedef void(CALL_DECLARATION *WRITE_FUNC) (writer &out
 Template of instance writing function. More...
 

Functions

template<class Base >
void ReadBase (reader &in, Base *base)
 Function of reading the base class.
 
template<class Base >
void WriteBase (writer &out, const Base *base)
 Function of writing the base class.
 
template<class Base >
void ReadVBase (reader &in, Base *base)
 Function of reading of a virtual base class.
 
template<class Base >
void WriteVBase (writer &out, const Base *base)
 Function of writing of a virtual base class.
 
uint16 hash (const char *name)
 Pack the string (class name) into uint16.
 
writeroperator<< (writer &ps, bool i)
 Writing bool to the stream.
 
readeroperator>> (reader &ps, bool &i)
 Reading of bool to the stream.
 
writeroperator<< (writer &ps, signed int i)
 Writing signed int to the stream.
 
writeroperator<< (writer &ps, unsigned int i)
 Writing unsigned int to the stream.
 
readeroperator>> (reader &ps, signed int &i)
 Reading signed int to the stream.
 
readeroperator>> (reader &ps, unsigned int &i)
 Reading unsigned int to the stream.
 
writeroperator<< (writer &ps, int64 val)
 Writing int32 to the stream. More...
 
readeroperator>> (reader &ps, int64 &val)
 Reading int64 to the stream.
 
readeroperator>> (reader &ps, signed char &ch)
 Reading signed char to the stream.
 
readeroperator>> (reader &ps, unsigned char &ch)
 Reading unsigned char to the stream.
 
readeroperator>> (reader &ps, char &ch)
 Reading char to the stream.
 
readeroperator>> (reader &ps, signed short &sh)
 Reading signed short to the stream.
 
readeroperator>> (reader &ps, unsigned short &sh)
 Reading unsigned short to the stream.
 
readeroperator>> (reader &ps, wchar_t &sh)
 Reading wchar_t to the stream.
 
readeroperator>> (reader &ps, float &f)
 Reading float to the stream.
 
readeroperator>> (reader &ps, double &d)
 Reading double to the stream.
 
readeroperator>> (reader &ps, long double &l)
 Reading long double from the stream.
 
template<class _Class >
readeroperator>> (reader &ps, SPtr< _Class > &sPtr)
 Reading a smart pointer from the stream.
 
template<class _Class >
writeroperator<< (writer &ps, const SPtr< _Class > &sPtr)
 Writing a smart pointer to the stream.
 
writeroperator<< (writer &ps, signed char ch)
 Write signed char to the stream.
 
writeroperator<< (writer &ps, unsigned char ch)
 Write unsigned char to the stream.
 
writeroperator<< (writer &ps, char ch)
 Write char to the stream.
 
writeroperator<< (writer &ps, signed short sh)
 Write signed short to the stream.
 
writeroperator<< (writer &ps, unsigned short sh)
 Write unsigned short to the stream.
 
writeroperator<< (writer &ps, wchar_t sh)
 Write wchar_t to the stream.
 
writeroperator<< (writer &ps, float f)
 Write float to the stream.
 
writeroperator<< (writer &ps, const double &d)
 Write double to the stream.
 
writeroperator<< (writer &ps, const long double &l)
 Write long double to the stream.
 
void WriteTCHAR (writer &out, const TCHAR *ts, bool directSingleByte=false)
 Write TCHAR string to the stream.
 
void ReadTCHAR (reader &in, TCHAR *&ts, bool directSingleByte=false)
 Read TCHAR string from the stream.
 
void WriteWcharT (writer &out, const wchar_t *ts)
 Write wchar_t string to the stream.
 
void ReadWcharT (reader &in, wchar_t *&ts)
 Read TCHAR string from the stream.
 
void WriteCOUNT (writer &out, size_t count)
 Write size_t subject to the stream version.
 
void WriteINT_T (writer &out, ptrdiff_t count)
 Writing ptrdiff_t subject to the stream version.
 
size_t ReadCOUNT (reader &in, bool uint_val=true)
 Reading size_t subject to the stream version.
 
ptrdiff_t ReadINT_T (reader &in, bool uint_val=true)
 Reading ptrdiff_t subject to the stream version.
 
void WriteCOUNT (void *out, VERSION version, size_t count)
 Writing size_t to the memory subject to the stream version.
 
void WriteCOUNT (void *out, VERSION version, ptrdiff_t count)
 Writing ptrdiff_t to the memory subject to the stream version.
 
size_t ReadCOUNT (void *in, VERSION version)
 Reading of size_t to the memory subject to the stream version.
 
ClassDescriptor GetPackedClassName (const ClassDescriptor &classDescr, const VersionContainer &ver)
 Get the packed class name from the hash value written to the stream. More...
 
void AddPackedClassNameForVersion (const ClassDescriptor &newClassName, const ClassDescriptor &oldClassName, uint appIndex, VERSION lowVersion, VERSION highVersion)
 Add a new mapping of the hash value written to the stream to the packed class name. More...
 
bool IsValidStreamClassName (const char *className, const MbUuid &appID)
 Diagnostics of collisions of new class name with registered classes. More...
 
void WriteSimpleName (writer &out, const SimpleName &s)
 Writing of a simple name.
 
SimpleName ReadSimpleName (reader &in)
 Reading of a simple name.
 
writerc3d::operator<< (writer &out, const StrHash &strHash)
 Operator of writing hash. More...
 
readerc3d::operator>> (reader &in, c3d::StrHash &strHash)
 Operator of hash reading. More...
 
writeroperator<< (writer &ps, const std::string &s)
 Writing a string to the stream.
 
readeroperator>> (reader &ps, std::string &s)
 Reading a string from the stream.
 
writeroperator<< (writer &ps, const std::wstring &s)
 Writing a string to the stream.
 
readeroperator>> (reader &ps, std::wstring &s)
 Reading a string from the stream.
 
writeroperator<< (writer &ps, const std::wstring *s)
 Writing a string to the stream.
 
void ReadCluster (reader &in, uint16 clusterSize, Cluster &cl)
 Read the cluster. More...
 
void WriteCluster (writer &out, const Cluster &cl, uint16)
 Write the cluster, the clusterSize parameter is used to checking the cluster length. More...
 
size_t WriteClusterInfo (void *out, VERSION version, const Cluster &obj)
 Write the information about the cluster.
 
size_t ReadClusterInfo (void *in, VERSION version, Cluster &obj)
 Read the information about the cluster.
 

Detailed Description

Serialization: utilities for reading and writing of stream classes.

Function Documentation

◆ WriteCluster()

void WriteCluster ( writer out,
const Cluster cl,
uint16   
)
inline

Write the cluster, the clusterSize parameter is used to checking the cluster length.

Read the cluster.