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

A type of ESerializer suitable for serialization and deserialization to and from memory buffers. More...

#include <eVision/Easy/ESerializer.h>

Inheritance diagram for eVision::EFileSerializer:
Collaboration diagram for eVision::EFileSerializer:

Public Member Functions

 EFileSerializer (eVision::ESerializerMode mode, const std::string &filePath, eVision::ESerializerFileWriterMode fileWriterMode)
 Creates an instance of EFileSerializer either in read mode or write mode.
 EFileSerializer (eVision::ESerializerMode mode, const std::string &filePath)
 Creates an instance of EFileSerializer either in read mode or write mode.
virtual ~EFileSerializer () throw ()
virtual eVision::ESerializerMode GetMode () const
 The current mode of the serializer.
virtual void Close ()
 Closes the EFileSerializer::EFileSerializer object and frees the file handle created during the construction of this object.
virtual bool GetClosed () const
 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.
 EFileSerializer (CppWrapperInternal::InternalConstructor)
Public Member Functions inherited from eVision::ESerializer
virtual ~ESerializer () throw ()
 ESerializer (CppWrapperInternal::InternalConstructor)

Additional Inherited Members

Static Public Member Functions inherited from eVision::ESerializer
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 inherited from eVision::ESerializer
CppWrapperInternal::WrappedClass wrappedClass_

Detailed Description

A type of ESerializer suitable for serialization and deserialization to and from memory buffers.

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

License(s): None

Constructor & Destructor Documentation

◆ EFileSerializer() [1/3]

eVision::EFileSerializer::EFileSerializer ( eVision::ESerializerMode mode,
const std::string & filePath,
eVision::ESerializerFileWriterMode fileWriterMode )

Creates an instance of EFileSerializer either in read mode or write mode.

Parameters
modeThe serializer mode, read or write.
filePathFull path and name specification of the file to be used to create the EFileSerializer object.
fileWriterModeUsed only in write mode. Creation mode of the storage file, as defined by ESerializerFileWriterMode (defaults to overwrite mode).

The ESerializerFileWriterMode parameter is an enumerated type that allows to control what happens when the EFileSerializer is used in write mode and 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.

◆ EFileSerializer() [2/3]

eVision::EFileSerializer::EFileSerializer ( eVision::ESerializerMode mode,
const std::string & filePath )

Creates an instance of EFileSerializer either in read mode or write mode.

Parameters
modeThe serializer mode, read or write.
filePathFull path and name specification of the file to be used to create the EFileSerializer object.

The ESerializerFileWriterMode parameter is an enumerated type that allows to control what happens when the EFileSerializer is used in write mode and 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.

◆ ~EFileSerializer()

eVision::EFileSerializer::~EFileSerializer ( )
throw ( )
virtual

◆ EFileSerializer() [3/3]

eVision::EFileSerializer::EFileSerializer ( CppWrapperInternal::InternalConstructor )

Member Function Documentation

◆ Close()

void eVision::EFileSerializer::Close ( )
virtual

Closes the EFileSerializer::EFileSerializer object and frees the file handle created during the construction of this object.

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 from eVision::ESerializer.

◆ GetClosed()

bool eVision::EFileSerializer::GetClosed ( ) const
virtual

Indicates if the ESerializer is closed or not.

Implements eVision::ESerializer.

◆ GetMode()

eVision::ESerializerMode eVision::EFileSerializer::GetMode ( ) const
virtual

The current mode of the serializer.

Implements eVision::ESerializer.

◆ GetWriting()

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

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

Reimplemented from eVision::ESerializer.