eVision .NET API
Loading...
Searching...
No Matches
eVision.ESerializer Class Referenceabstract

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

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

Public Member Functions

virtual void Close ()
 Closes the ESerializer object and frees any underlying ressource it could have reserved.

Static Public Member Functions

static eVision.ESerializer CreateFileWriter (string filePath, eVision.ESerializerFileWriterMode mode)
 Returns an ESerializer object suitable for opening a file and writing into it.
static eVision.ESerializer CreateFileWriter (string filePath)
 Returns an ESerializer object suitable for opening a file and writing into it.
static eVision.ESerializer CreateFileReader (string filePath)
 Returns an ESerializer object suitable for reading from a file.
static eVision.ESerializer CreateMemoryWriter ()
 Returns an ESerializer object suitable for serializing into a buffer.
static eVision.ESerializer CreateMemoryWriter (uint initialBufferSize)
 Returns an ESerializer object suitable for serializing into a buffer.
static eVision.ESerializer CreateMemoryWriter (IntPtr buffer, uint size)
 Returns an ESerializer object suitable for serializing into a buffer.
static eVision.ESerializer CreateMemoryReader (IntPtr buffer, uint size)
 Returns an ESerializer object suitable for reading from a buffer.
static eVision.ESerializer CreateMemoryReader (byte[] bytes)
 Returns an ESerializer object suitable for reading from a buffer.
static eVision.ESerializer CreateCallbackWriter (IntPtr isEOS, IntPtr setCurrentPos, IntPtr getCurrentPos, IntPtr serializeMemory, IntPtr close, IntPtr cookie)
static eVision.ESerializer CreateCallbackReader (IntPtr isEOS, IntPtr setCurrentPos, IntPtr getCurrentPos, IntPtr serializeMemory, IntPtr close, IntPtr cookie)

Properties

eVision.ESerializerMode Mode [get]
 The current mode of the serializer.
bool Closed [get]
 Indicates if the ESerializer is closed or not.
virtual bool Writing [get]
 Returns true if the ESerializer object has been created for writing and false otherwise.

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

Member Function Documentation

◆ Close()

virtual 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()

eVision.ESerializer eVision.ESerializer.CreateCallbackReader ( IntPtr isEOS,
IntPtr setCurrentPos,
IntPtr getCurrentPos,
IntPtr serializeMemory,
IntPtr close,
IntPtr cookie )
static

◆ CreateCallbackWriter()

eVision.ESerializer eVision.ESerializer.CreateCallbackWriter ( IntPtr isEOS,
IntPtr setCurrentPos,
IntPtr getCurrentPos,
IntPtr serializeMemory,
IntPtr close,
IntPtr cookie )
static

◆ CreateFileReader()

eVision.ESerializer eVision.ESerializer.CreateFileReader ( 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]

eVision.ESerializer eVision.ESerializer.CreateFileWriter ( 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]

eVision.ESerializer eVision.ESerializer.CreateFileWriter ( 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]

eVision.ESerializer eVision.ESerializer.CreateMemoryReader ( byte[] 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]

eVision.ESerializer eVision.ESerializer.CreateMemoryReader ( IntPtr buffer,
uint 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]

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]

eVision.ESerializer eVision.ESerializer.CreateMemoryWriter ( IntPtr buffer,
uint 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.

◆ CreateMemoryWriter() [3/3]

eVision.ESerializer eVision.ESerializer.CreateMemoryWriter ( uint 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.

Property Documentation

◆ Closed

bool eVision.ESerializer.Closed
getabstract

Indicates if the ESerializer is closed or not.

◆ Mode

eVision.ESerializerMode eVision.ESerializer.Mode
getabstract

The current mode of the serializer.

◆ Writing

virtual bool eVision.ESerializer.Writing
get

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

Deprecated

Use ESerializer.Mode instead.

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