SophiaFramework UNIVERSE 5.3 |
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 | |
---|---|
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.
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 | |
---|---|
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. |
Storage | Stream | SFXFile | SFXTCPSocket | SFXSSLSocket | SFXMemory | SFXSource | SFXZIPDecoder
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.
|
[ protected, explicit ] SFXStorage(Void);
[ public, pure-virtual ] virtual ~SFXStorage(Void);
This function is a pure virtual function.
[ public, virtual, const ] SFCError AsSFBAStream( SFBAStreamSmpPtr result // pointer to the SFBAStream instance );
This function is a pure virtual function.
[ public, pure-virtual, const ] SFCError AsSFBSource( SFBSourceSmpPtr result // pointer to the SFBSource instance );
This function is a pure virtual function.
[ public, pure-virtual ] Void Cancel(Void);
This function is a pure virtual function.
[ 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 );
This function is a pure virtual function.
[ 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 );
This function is a pure virtual function.
[ public, pure-virtual ] SFCError Read( VoidPtr buffer // buffer to read data from the storage into UInt32Ptr size // buffer size );
Specify the buffer to read data from the storage into.
Specify the size of buffer when calling this function. When this function ends, the size of data that is actually read is stored.
This function is a pure virtual function.
[ public ] SFCError ScheduleRead( CallbackSPP spp // callback function VoidPtr reference // data passed to the callback function );
This function is a pure virtual function.
[ public, pure-virtual ] SFCError ScheduleWrite( CallbackSPP spp // callback function VoidPtr reference // data passed to callback function );
This function is a pure virtual function.
[ public, pure-virtual ] SFCError Write( VoidConstPtr buffer // buffer to write data to the storage UInt32Ptr size // size of data to write to the storage );
Specify the buffer to write data to the storage.
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.
This function is a pure virtual function.
typedef Void(* SFXStorage::CallbackSPP)(SFCError error, VoidPtr reference)
SFXStorage::CallbackSPP is the type of the callback function for the Storage class as follows: SFXStorage | SFXTCPSocket | SFXSSLSocket | SFXUDPSocket | SFXMemory | SFXSource | SFXZIPDecoder
SFXStorage | SFXTCPSocket | SFXSSLSocket | SFXUDPSocket | SFXMemory | SFXSource | SFXZIPDecoder
Copyright(c) 2002 - 2024 Sophia Cradle Incorporated All Rights Reserved. |