Software and Services, Portable Libraries  2019.Mar.01
A library for managing digital certificates
SoftwareAndServices::Library::Common::Serialize Class Referenceabstract

This is a pure abstract base class and it is used for serializing objects. More...

#include "<SaS/Common/Serialize.hpp>"

+ Inheritance diagram for SoftwareAndServices::Library::Common::Serialize:
+ Collaboration diagram for SoftwareAndServices::Library::Common::Serialize:

Public Types

enum  IOError {
  NoError_t, FileObjectNotOpen_t, RemoteEndClosedConnection_t, TimeOut_t,
  IoInterrupted_t
}
 An enumerated list of basic I/O errors. More...
 
typedef unsigned long long SerializeSize_t
 Used like size_t for octet counting. More...
 

Public Member Functions

 Serialize ()
 Serialize Constructor. More...
 
 Serialize (File *IoPath)
 Serialize Constructor. More...
 
virtual ~Serialize ()
 Serialize Destructor. More...
 
void Asynchronous (bool On)
 Set asynchronous mode on/off. More...
 
bool Asynchronous () const
 
virtual InstanceCount_t decInstance () const
 Decrement the instance. More...
 
virtual InstanceCount_t getInstance () const
 
virtual InstanceCount_t incInstance () const
 Increment the instance. More...
 
void operator delete (void *data)
 This class supports instance counting, so we override the delete() operator and only the final delete removes the class. More...
 
SerializeSize_t ReadCount () const
 When in asynchronous I/O mode, tell us how many octets have been read so far. More...
 
virtual bool readObject (File *file) const =0
 Read yourself from the File object. More...
 
virtual SerializeSize_t SerialRead (void *PutHere, SerializeSize_t OctetsToRead)=0
 Every derived object must have a SerialRead method. More...
 
virtual SerializeSize_t SerialWrite (void *GetHere, SerializeSize_t OctetsToWrite)=0
 Every derived object must have a SerialWrite method. More...
 
SerializeSize_t WriteCount () const
 When in asynchronous I/O mode, tell us how many octets have been written so far. More...
 
virtual bool writeObject (File *file) const =0
 Write yourself to the File object. More...
 

Detailed Description

This is a pure abstract base class and it is used for serializing objects.

Definition at line 86 of file Serialize.hpp.

Member Typedef Documentation

◆ SerializeSize_t

Used like size_t for octet counting.

Definition at line 121 of file Serialize.hpp.

Member Enumeration Documentation

◆ IOError

An enumerated list of basic I/O errors.

Enumerator
NoError_t 

No error occurred.

FileObjectNotOpen_t 

The File object is nullptr or not open.

RemoteEndClosedConnection_t 

The remote end closed the connection.

TimeOut_t 

The connection timed out.

No data can be transferred.

IoInterrupted_t 

Something sent an interrupt or signal that stopped the transfer - retry.

The read count (or write count) will tell you how much was successfully transferred. Resume and retry with any remaining data.

Definition at line 89 of file VBase.hpp.

Constructor & Destructor Documentation

◆ Serialize() [1/2]

SoftwareAndServices::Library::Common::Serialize::Serialize ( )

Serialize Constructor.

◆ Serialize() [2/2]

SoftwareAndServices::Library::Common::Serialize::Serialize ( File IoPath)

Serialize Constructor.

Parameters
IoPathAn open File object for I/O

◆ ~Serialize()

virtual SoftwareAndServices::Library::Common::Serialize::~Serialize ( )
virtual

Serialize Destructor.

Member Function Documentation

◆ Asynchronous() [1/2]

void SoftwareAndServices::Library::Common::Serialize::Asynchronous ( bool  On)

Set asynchronous mode on/off.

In asynchronous mode, all reads and writes I/O are done in the order called. All reads are in a read queue. All writes are in a write queue. Both reads and writes can occur at the same time and all reads will be in the order requested, and all writes will be in the order requested.

Parameters
OnWhen TRUE, set asynchronous I/O. When FALSE, set synchronous I/O.

◆ Asynchronous() [2/2]

bool SoftwareAndServices::Library::Common::Serialize::Asynchronous ( ) const
Returns
TRUE when in asynchronous I/O mode.

◆ decInstance()

virtual InstanceCount_t SoftwareAndServices::Library::Common::instance< Serialize >::decInstance ( ) const
inlinevirtualinherited

Decrement the instance.

Returns
The instance count, after decrementing it.

Definition at line 129 of file instance.hpp.

◆ getInstance()

virtual InstanceCount_t SoftwareAndServices::Library::Common::instance< Serialize >::getInstance ( ) const
inlinevirtualinherited
Returns
The current instance count.

Definition at line 118 of file instance.hpp.

◆ incInstance()

virtual InstanceCount_t SoftwareAndServices::Library::Common::instance< Serialize >::incInstance ( ) const
inlinevirtualinherited

Increment the instance.

Returns
The instance value, after incrementing it.

Definition at line 109 of file instance.hpp.

◆ operator delete()

void SoftwareAndServices::Library::Common::Serialize::operator delete ( void *  data)

This class supports instance counting, so we override the delete() operator and only the final delete removes the class.

Parameters
dataThe 'this' pointer'.

◆ ReadCount()

SerializeSize_t SoftwareAndServices::Library::Common::Serialize::ReadCount ( ) const

When in asynchronous I/O mode, tell us how many octets have been read so far.

The read is done when the results equals the desired read count, or an IOError is thrown.

Returns
The number of octets read so far in asynchronous mode. Always returns zero in synchronous mode.
Exceptions
IOErrorif the read had an IOError thrown.

◆ readObject()

virtual bool SoftwareAndServices::Library::Common::VBase::readObject ( File file) const
pure virtualinherited

Read yourself from the File object.

Parameters
fileAn open File object to read the data from.
Returns
TRUE if read okay.
Exceptions
IOErroron network read error.

◆ SerialRead()

virtual SerializeSize_t SoftwareAndServices::Library::Common::Serialize::SerialRead ( void *  PutHere,
SerializeSize_t  OctetsToRead 
)
pure virtual

Every derived object must have a SerialRead method.

Parameters
PutHereWhere to store the data.
OctetsToReadRead up to this many octets.
Exceptions
IoErrorif there is a read error.
Returns
The number of Octets read.

◆ SerialWrite()

virtual SerializeSize_t SoftwareAndServices::Library::Common::Serialize::SerialWrite ( void *  GetHere,
SerializeSize_t  OctetsToWrite 
)
pure virtual

Every derived object must have a SerialWrite method.

Parameters
GetHereWhere to get the data.
OctetsToWriteWrite up to this many octets.
Exceptions
IoErrorif there is a write error.
Returns
The number of Octets written.

◆ WriteCount()

SerializeSize_t SoftwareAndServices::Library::Common::Serialize::WriteCount ( ) const

When in asynchronous I/O mode, tell us how many octets have been written so far.

The write is done when the results equals the desired write count, or an IOError is thrown.

Returns
The number of octets written so far in asynchronous mode. Always returns zero in synchronous mode.
Exceptions
IOErrorif the write had an IOError thrown.

◆ writeObject()

virtual bool SoftwareAndServices::Library::Common::VBase::writeObject ( File file) const
pure virtualinherited

Write yourself to the File object.

Parameters
fileAn open File object to write the data from.
Returns
TRUE if write okay.
Exceptions
IOErroron network write error.

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