PrevNextUpHome SophiaFramework UNIVERSE 5.3
SFXStorage
Base class which represents the storage.
#include <SFXStorage.h.hpp>
class SFXStorage;
SFMTYPEDEFCLASS(SFXStorage)

Inheritance diagram

 Inheritance diagram of SFXStorageClass

Description

The SFXStorage class is the base class for the Storage classes that reads data from or writes data to the storage such as memory, file, network, etc. And the input and output streams are available for the Storage classes.

The Storage classes is for reading / writing data from / into file, network, memory and so on using the stream. In SophiaFramework UNIVERSE, 6 kinds of storage classes are available as follows:

Table 195. Storage Classes

Class Name Description
SFXFile Class for operating a file.
SFXHTTPConnection Class for the HTTP communication.
SFXTCPSocket Class for the TCP socket communication.
SFXSSLSocket Class for the SSL socket communication.
SFXMemory Storage class for the memory stream.
SFXSource Storage class for reading data from the ISource interface.
SFXZIPDecoder Storage class for decompressing the DEFLATE compressed data by gzip.
[Note] Note

All storage classes above inherit from the SFXStorage class.

Since the input/output method using the stream is almost same with all storages except the following differences, generic programming independent of storage devices can be implemented in SophiaFramework UNIVERSE.

  • There are some differences in initiation and termination.
  • Only either read or write function is supported.
  • Only read and write functions using the callback functions are supported.

Table 196. Table for Read/Write Function with or without Callback Function on Storage Classes

  read without callback function read with callback function write without callback function write with callback function
SFXFile O O O X
SFXHTTPConnection X O X O
SFXTCPSocket X O X O
SFXSSLSocket X O X O
SFXMemory O X O X
SFXSource Depend on the BREW ISource O X X
SFXZIPDecoder Depend on the registered storage O X X
[Note] Note

In the SFXSource / SFXZIPDecoder class, read function without callback function is not available for some kinds of source and registered storage.

For instance, since read function without callback function on SFXTCPSocket is not available, gzipped data from SFXTCPSocket cannot be decompressed by registering it in SFXZIPDecoder without callback function.

Reference

Storage | Stream | SFXFile | SFXTCPSocket | SFXSSLSocket | SFXMemory | SFXSource | SFXZIPDecoder

member

Constructor/Destructor
SFXStorage( Void )
Constructor of the SFXStorage class.
~SFXStorage( Void )
Destructor of the SFXStorage class.
Public Functions
SFCError AsSFBAStream( SFBAStreamSmpPtr result )
Convert the storage instance internally managed by this storage into the SFBAStream instance.
SFCError AsSFBSource( SFBSourceSmpPtr result )
Convert the storage instance internally managed by this storage into the SFBSource instance.
Void Cancel( Void )
Cancel reading data from or writing data to the storage.
SFCError GetStreamReader( UInt32 size , SFXStreamReaderPtr result )
Get the input stream for reading data from the storage.
SFCError GetStreamReader( SFXStreamReaderPtr result )
Get the input stream for reading data from the storage.
SFCError GetStreamWriter( UInt32 size , SFXStreamWriterPtr result )
Get the output stream for writing data to the storage.
SFCError GetStreamWriter( SFXStreamWriterPtr result )
Get the output stream for writing data to the storage.
SFCError Read( VoidPtr buffer , UInt32Ptr size )
Read data from the storage without using the input stream.
SFCError ScheduleRead( CallbackSPP spp , VoidPtr reference )
Schedule to read data from the storage without using the input stream.
SFCError ScheduleWrite( CallbackSPP spp , VoidPtr reference )
Schedule to write data to the storage without using the output stream.
SFCError Write( VoidConstPtr buffer , UInt32Ptr size )
Write data to the storage without using the output stream.
Types
CallbackSPP
Type of the callback function for the Storage class.

SFXStorage::SFXStorage
Constructor of the SFXStorage class.
[ protected, explicit ]
SFXStorage(Void);

SFXStorage::~SFXStorage
Destructor of the SFXStorage class.
[ public, pure-virtual ]
virtual ~SFXStorage(Void);

Description

This function is a pure virtual function.


SFXStorage::AsSFBAStream
Convert the storage instance internally managed by this storage into the SFBAStream instance.
[ public, virtual, const ]
SFCError AsSFBAStream(
    SFBAStreamSmpPtr result   // pointer to the SFBAStream instance
);

Description

This function is a pure virtual function.

Reference

SFBAStream


SFXStorage::AsSFBSource
Convert the storage instance internally managed by this storage into the SFBSource instance.
[ public, pure-virtual, const ]
SFCError AsSFBSource(
    SFBSourceSmpPtr result   // pointer to the SFBSource instance
);

Description

This function is a pure virtual function.

Reference

SFBSource


SFXStorage::Cancel
Cancel reading data from or writing data to the storage.
[ public, pure-virtual ]
Void Cancel(Void);

Description

This function is a pure virtual function.


SFXStorage::GetStreamReader
Get the input stream for reading data from the storage.
[ public, pure-virtual ]
SFCError GetStreamReader(
    UInt32 size                 // buffer size
    SFXStreamReaderPtr result   // pointer to the input stream for reading data from the storage
);
[ public, pure-virtual ]
SFCError GetStreamReader(
    SFXStreamReaderPtr result   //pointer to the input stream for reading data from the storage
);

Description

This function is a pure virtual function.


SFXStorage::GetStreamWriter
Get the output stream for writing data to the storage.
[ public, pure-virtual ]
SFCError GetStreamWriter(
    UInt32 size                 // size
    SFXStreamWriterPtr result   // pointer to the output stream for writing data to the storage
);
[ public, pure-virtual ]
SFCError GetStreamWriter(
    SFXStreamWriterPtr result   // pointer to the output stream for writing data to the storage
);

Description

This function is a pure virtual function.


SFXStorage::Read
Read data from the storage without using the input stream.
[ public, pure-virtual ]
SFCError Read(
    VoidPtr buffer   // buffer to read data from the storage into
    UInt32Ptr size   // buffer size
);

Argument

buffer

Specify the buffer to read data from the storage into.

size

Specify the size of buffer when calling this function. When this function ends, the size of data that is actually read is stored.

Description

This function is a pure virtual function.


SFXStorage::ScheduleRead
Schedule to read data from the storage without using the input stream.
[ public ]
SFCError ScheduleRead(
    CallbackSPP spp     // callback function
    VoidPtr reference   // data passed to the callback function
);

Description

This function is a pure virtual function.

Reference

SFXStorage::CallbackSPP


SFXStorage::ScheduleWrite
Schedule to write data to the storage without using the output stream.
[ public, pure-virtual ]
SFCError ScheduleWrite(
    CallbackSPP spp     // callback function
    VoidPtr reference   // data passed to callback function
);

Description

This function is a pure virtual function.

Reference

SFXStorage::CallbackSPP


SFXStorage::Write
Write data to the storage without using the output stream.
[ public, pure-virtual ]
SFCError Write(
    VoidConstPtr buffer   // buffer to write data to the storage
    UInt32Ptr size        // size of data to write to the storage
);

Argument

buffer

Specify the buffer to write data to the storage.

size

Specify the size of data to write to the storage when calling this function. When this function ends, the size of data that is actually written is stored.

Description

This function is a pure virtual function.


SFXStorage::CallbackSPP
Type of the callback function for the Storage class.
typedef Void(* SFXStorage::CallbackSPP)(SFCError error, VoidPtr reference)

Description

SFXStorage::CallbackSPP is the type of the callback function for the Storage class as follows: SFXStorage | SFXTCPSocket | SFXSSLSocket | SFXUDPSocket | SFXMemory | SFXSource | SFXZIPDecoder

Reference

SFXStorage | SFXTCPSocket | SFXSSLSocket | SFXUDPSocket | SFXMemory | SFXSource | SFXZIPDecoder