qCC_db version 2.13.alpha (Qt) - 31 May 2022
CloudCompare 3D entities
Public Types | Public Member Functions | Static Public Member Functions | List of all members
ccSerializableObject Class Reference

Serializable object interface. More...

#include <ccSerializableObject.h>

Inheritance diagram for ccSerializableObject:
Inheritance graph
[legend]

Public Types

enum  DeserializationFlags { DF_POINT_COORDS_64_BITS = 1 , DF_SCALAR_VAL_32_BITS = 2 }
 Deserialization flags (bit-field) More...
 
typedef QMultiMap< unsigned, unsigned > LoadedIDMap
 Map of loaded unique IDs (old ID --> new ID)
 

Public Member Functions

virtual ~ccSerializableObject ()=default
 Destructor.
 
virtual bool isSerializable () const
 Returns whether object is serializable of not. More...
 
virtual bool toFile (QFile &out) const
 Saves data to binary stream. More...
 
virtual bool fromFile (QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap)
 Loads data from binary stream. More...
 

Static Public Member Functions

static bool WriteError ()
 Sends a custom error message (write error) and returns 'false'. More...
 
static bool ReadError ()
 Sends a custom error message (read error) and returns 'false'. More...
 
static bool MemoryError ()
 Sends a custom error message (not enough memory) and returns 'false'. More...
 
static bool CorruptError ()
 Sends a custom error message (corrupted file) and returns 'false'. More...
 

Detailed Description

Serializable object interface.

Member Enumeration Documentation

◆ DeserializationFlags

Deserialization flags (bit-field)

Enumerator
DF_POINT_COORDS_64_BITS 

Point coordinates are stored as 64 bits double (otherwise 32 bits floats)

DF_SCALAR_VAL_32_BITS 

Scalar values are stored as 32 bits floats (otherwise 64 bits double)

Member Function Documentation

◆ CorruptError()

static bool ccSerializableObject::CorruptError ( )
inlinestatic

Sends a custom error message (corrupted file) and returns 'false'.

Shortcut for returning a standardized error message in the fromFile method.

Returns
always false

◆ fromFile()

virtual bool ccSerializableObject::fromFile ( QFile &  in,
short  dataVersion,
int  flags,
LoadedIDMap oldToNewIDMap 
)
inlinevirtual

Loads data from binary stream.

Parameters
ininput file (already opened)
dataVersionfile version
flagsdeserialization flags (see ccSerializableObject::DeserializationFlags)
oldToNewIDMapmap to link old IDs with new IDs
Returns
success

Reimplemented in ccColorScale, ccGLMatrixTpl< T >, ccGLMatrixTpl< float >, ccGLMatrixTpl< double >, ccHObject, ccIndexedTransformation, ccMaterial, ccObject, ccScalarField, ccViewportParameters, WaveformDescriptor, and ccWaveform.

◆ isSerializable()

virtual bool ccSerializableObject::isSerializable ( ) const
inlinevirtual

◆ MemoryError()

static bool ccSerializableObject::MemoryError ( )
inlinestatic

Sends a custom error message (not enough memory) and returns 'false'.

Shortcut for returning a standardized error message in the fromFile method.

Returns
always false

◆ ReadError()

static bool ccSerializableObject::ReadError ( )
inlinestatic

Sends a custom error message (read error) and returns 'false'.

Shortcut for returning a standardized error message in the fromFile method.

Returns
always false

◆ toFile()

virtual bool ccSerializableObject::toFile ( QFile &  out) const
inlinevirtual

Saves data to binary stream.

Parameters
outoutput file (already opened)
Returns
success

Reimplemented in ccColorScale, ccGLMatrixTpl< T >, ccGLMatrixTpl< float >, ccGLMatrixTpl< double >, ccHObject, ccIndexedTransformation, ccMaterial, ccObject, ccScalarField, ccViewportParameters, WaveformDescriptor, and ccWaveform.

◆ WriteError()

static bool ccSerializableObject::WriteError ( )
inlinestatic

Sends a custom error message (write error) and returns 'false'.

Shortcut for returning a standardized error message in the toFile method.

Returns
always false

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