eVision C++ API 26.10.0-beta.2.dev
Loading...
Searching...
No Matches
eVision::ESerializer Class Referenceabstract

Abstract interface for file-like objects. More...

#include <eVision/Easy/ESerializer.h>

Inheritance diagram for eVision::ESerializer:
Collaboration diagram for eVision::ESerializer:

Public Member Functions

virtual ~ESerializer () throw ()
virtual eVision::ESerializerMode GetMode () const =0
 The current mode of the serializer.
virtual void Close ()
 Closes the ESerializer object and frees any underlying ressource it could have reserved.
virtual bool GetClosed () const =0
 Indicates if the ESerializer is closed or not.
virtual bool GetWriting () const
 Returns true if the ESerializer object has been created for writing and false otherwise.
 ESerializer (CppWrapperInternal::InternalConstructor)

Static Public Member Functions

static std::unique_ptr< eVision::ESerializer > CreateFileWriter (const std::string &filePath, eVision::ESerializerFileWriterMode mode)
 Returns an ESerializer object suitable for opening a file and writing into it.
static std::unique_ptr< eVision::ESerializer > CreateFileWriter (const std::string &filePath)
 Returns an ESerializer object suitable for opening a file and writing into it.
static std::unique_ptr< eVision::ESerializer > CreateFileReader (const std::string &filePath)
 Returns an ESerializer object suitable for reading from a file.
static std::unique_ptr< eVision::ESerializer > CreateMemoryWriter ()
 Returns an ESerializer object suitable for serializing into a buffer.
static std::unique_ptr< eVision::ESerializer > CreateMemoryWriter (uint32_t initialBufferSize)
 Returns an ESerializer object suitable for serializing into a buffer.
static std::unique_ptr< eVision::ESerializer > CreateMemoryWriter (void *buffer, uint32_t size)
 Returns an ESerializer object suitable for serializing into a buffer.
static std::unique_ptr< eVision::ESerializer > CreateMemoryReader (void *buffer, uint32_t size)
 Returns an ESerializer object suitable for reading from a buffer.
static std::unique_ptr< eVision::ESerializer > CreateMemoryReader (const std::vector< uint8_t > &bytes)
 Returns an ESerializer object suitable for reading from a buffer.
static std::unique_ptr< eVision::ESerializer > CreateCallbackWriter (void *isEOS, void *setCurrentPos, void *getCurrentPos, void *serializeMemory, void *close, void *cookie)
static std::unique_ptr< eVision::ESerializer > CreateCallbackReader (void *isEOS, void *setCurrentPos, void *getCurrentPos, void *serializeMemory, void *close, void *cookie)

Public Attributes

CppWrapperInternal::WrappedClass wrappedClass_

Detailed Description

Abstract interface for file-like objects.

The ESerializer object manages operations of reading from and writing to an archive (a file on the system hard disk, for instance). ESerializer objects cannot be instantiated directly. To create an ESerializer object, one of the following static factory methods has to be used:

Note
An ESerializer object can not be used in the same time for reading and writing. So, ESerializer::CreateFileWriter creates an ESerializer object that should be used with Save methods and ESerializer::CreateFileReader creates an ESerializer object that should be used with Load methods.

License(s): None

Constructor & Destructor Documentation

◆ ~ESerializer()

eVision::ESerializer::~ESerializer ( )
throw ( )
virtual

◆ ESerializer()

eVision::ESerializer::ESerializer ( CppWrapperInternal::InternalConstructor )

Member Function Documentation

◆ Close()

void eVision::ESerializer::Close ( )
virtual

Closes the ESerializer object and frees any underlying ressource it could have reserved.

This method is always called implicitly during the destruction of the object. It is still recommended to call it explicitly in programming languages other than C++ to ensure the underlying ressources are correctly released.

This method never throws exceptions.

Reimplemented in eVision::ECallbackSerializer, eVision::EFileSerializer, and eVision::EMemorySerializer.

◆ CreateCallbackReader()

std::unique_ptr< eVision::ESerializer > eVision::ESerializer::CreateCallbackReader ( void * isEOS,
void * setCurrentPos,
void * getCurrentPos,
void * serializeMemory,
void * close,
void * cookie )
static

◆ CreateCallbackWriter()

std::unique_ptr< eVision::ESerializer > eVision::ESerializer::CreateCallbackWriter ( void * isEOS,
void * setCurrentPos,
void * getCurrentPos,
void * serializeMemory,
void * close,
void * cookie )
static

◆ CreateFileReader()

std::unique_ptr< eVision::ESerializer > eVision::ESerializer::CreateFileReader ( const std::string & filePath)
static

Returns an ESerializer object suitable for reading from a file.

Parameters
filePathFull path and name specification of the file to be used to create the ESerializer object.

If the call does not succeed, it returns NULL. Please check the eVision error code to get further informations.

Call to ESerializer::Close is mandatory after usage to ensure the file handle used by this object is properly released.

Deprecated

Instantiate directly EFileSerializer using its constructor instead.

Deprecated in version 25.2. Scheduled to be removed in version 27.6.

◆ CreateFileWriter() [1/2]

std::unique_ptr< eVision::ESerializer > eVision::ESerializer::CreateFileWriter ( const std::string & filePath)
static

Returns an ESerializer object suitable for opening a file and writing into it.

Parameters
filePathFull path and name specification of the file to be used to create the ESerializer object.

The ESerializerFileWriterMode parameter is an enumerated type that allows to control what happens when the file already exists:

  • If mode is Create, the call will not succeed if the file already exists.
  • If mode is Overwrite, the existing file will be overwritten.
  • If mode is Append, the new data will be appended to the existing file content.

If the call does not succeed, it returns NULL. Please check the eVision error code to get further information.

Call to ESerializer::Close is mandatory after usage to ensure the file handle used by this object is properly released.

Deprecated

Instantiate directly EFileSerializer using its constructor instead.

Deprecated in version 25.2. Scheduled to be removed in version 27.6.

◆ CreateFileWriter() [2/2]

std::unique_ptr< eVision::ESerializer > eVision::ESerializer::CreateFileWriter ( const std::string & filePath,
eVision::ESerializerFileWriterMode mode )
static

Returns an ESerializer object suitable for opening a file and writing into it.

Parameters
filePathFull path and name specification of the file to be used to create the ESerializer object.
modeCreation mode of the storage file, as defined by ESerializerFileWriterMode (by default, Overwrite).

The ESerializerFileWriterMode parameter is an enumerated type that allows to control what happens when the file already exists:

  • If mode is Create, the call will not succeed if the file already exists.
  • If mode is Overwrite, the existing file will be overwritten.
  • If mode is Append, the new data will be appended to the existing file content.

If the call does not succeed, it returns NULL. Please check the eVision error code to get further information.

Call to ESerializer::Close is mandatory after usage to ensure the file handle used by this object is properly released.

Deprecated

Instantiate directly EFileSerializer using its constructor instead.

Deprecated in version 25.2. Scheduled to be removed in version 27.6.

◆ CreateMemoryReader() [1/2]

std::unique_ptr< eVision::ESerializer > eVision::ESerializer::CreateMemoryReader ( const std::vector< uint8_t > & bytes)
static

Returns an ESerializer object suitable for reading from a buffer.

Parameters
bytesA vector containing a list of bytes to read.

Those bytes will be copied into the returned object's internal buffer.

It is up to users to delete the ESerializer object when they have done using it in Load calls.

Deprecated

Instantiate directly a EMemorySerializer using its constructor instead.

Deprecated in version 25.2. Scheduled to be removed in version 27.6.

◆ CreateMemoryReader() [2/2]

std::unique_ptr< eVision::ESerializer > eVision::ESerializer::CreateMemoryReader ( void * buffer,
uint32_t size )
static

Returns an ESerializer object suitable for reading from a buffer.

Parameters
bufferAddress of an external buffer to be used by the memory serializer.

Those bytes will be copied into the returned object's internal buffer.

Parameters
sizeSize of the external buffer.

It is up to users to delete the ESerializer object when they have done using it in Load calls.

Deprecated

Instantiate directly a EMemorySerializer using its constructor instead.

Deprecated in version 25.2. Scheduled to be removed in version 27.6.

◆ CreateMemoryWriter() [1/3]

std::unique_ptr< eVision::ESerializer > eVision::ESerializer::CreateMemoryWriter ( )
static

Returns an ESerializer object suitable for serializing into a buffer.

If a buffer is not provided, a buffer will be automatically created and managed internally by the object.

Please note that, in this case, if you didn't provide a size, the buffer will be automatically resized as needed.

It is up to users to delete the ESerializer object when they have done using it in Save calls.

The returned serializer underlying type is EMemorySerializer, for more information, see the class documentation.

Deprecated

Instantiate directly EMemorySerializer using its constructor instead.

Deprecated in version 25.2. Scheduled to be removed in version 27.6.

◆ CreateMemoryWriter() [2/3]

std::unique_ptr< eVision::ESerializer > eVision::ESerializer::CreateMemoryWriter ( uint32_t initialBufferSize)
static

Returns an ESerializer object suitable for serializing into a buffer.

Parameters
initialBufferSizeSize to which allocate the buffer used internally by the memory serializer.

If a buffer is not provided, a buffer will be automatically created and managed internally by the object.

Please note that, in this case, if you didn't provide a size, the buffer will be automatically resized as needed.

It is up to users to delete the ESerializer object when they have done using it in Save calls.

The returned serializer underlying type is EMemorySerializer, for more information, see the class documentation.

Deprecated

Instantiate directly EMemorySerializer using its constructor instead.

Deprecated in version 25.2. Scheduled to be removed in version 27.6.

◆ CreateMemoryWriter() [3/3]

std::unique_ptr< eVision::ESerializer > eVision::ESerializer::CreateMemoryWriter ( void * buffer,
uint32_t size )
static

Returns an ESerializer object suitable for serializing into a buffer.

Parameters
bufferAddress of the buffer to be used by the memory serializer.
sizeSize of the buffer to be used by the memory serializer.

If a buffer is not provided, a buffer will be automatically created and managed internally by the object.

Please note that, in this case, if you didn't provide a size, the buffer will be automatically resized as needed.

It is up to users to delete the ESerializer object when they have done using it in Save calls.

The returned serializer underlying type is EMemorySerializer, for more information, see the class documentation.

Deprecated

Instantiate directly EMemorySerializer using its constructor instead.

Deprecated in version 25.2. Scheduled to be removed in version 27.6.

◆ GetClosed()

virtual bool eVision::ESerializer::GetClosed ( ) const
pure virtual

Indicates if the ESerializer is closed or not.

Implemented in eVision::ECallbackSerializer, eVision::EFileSerializer, and eVision::EMemorySerializer.

◆ GetMode()

virtual eVision::ESerializerMode eVision::ESerializer::GetMode ( ) const
pure virtual

The current mode of the serializer.

Implemented in eVision::ECallbackSerializer, eVision::EFileSerializer, and eVision::EMemorySerializer.

◆ GetWriting()

bool eVision::ESerializer::GetWriting ( ) const
virtual

Returns true if the ESerializer object has been created for writing and false otherwise.

Deprecated

Use ESerializer::GetMode instead.

Deprecated in version 25.2. Scheduled to be removed in version 27.6.

Reimplemented in eVision::EFileSerializer.

Member Data Documentation

◆ wrappedClass_

CppWrapperInternal::WrappedClass eVision::ESerializer::wrappedClass_