![]() ![]() ![]()
|
BREW C++ Class Library & GUI Framework & XML Middleware : SophiaFramework 4.1 |
#include <SFXElasticStreamWriter.h.hpp>
class SFXElasticStreamWriter : public SFXOutputStream;
SFMTYPEDEFCLASS(SFXElasticStreamWriter)


What is SFXElasticStreamWriter?
The SFXElasticStreamWriter class is used to write data onto the output stream of elastic buffer such as file, TCP socket and so on.
The SFXBinaryStreamWriter, SFXAnsiStringStreamWriter, or SFXWideStringStreamWriter class can get the elastic buffer stream by using the SFXElasticStreamWriter class internally. Therefore, usually it is unnecessary to use the SFXElasticStreamWriter class explicitly.
Attach function and Detach function
By using the SFXElasticStreamWriter::Attach function, and delegating the control privilege of the SFXBinaryStreamWriter, SFXAnsiStringStreamWriter, or SFXWideStringStreamWriter object that inherites from SFXOutputStream to the SFXElasticStreamWriter object, the output stream of elastic buffer can be available.
The SFXElasticStreamWriter::Detach function has reverse functionality.
What is delegation?: In object oriented programming, delegation means that an object have another deputy object behave like itself.
SFXBinaryStreamWriter | SFXAnsiStringStreamWriter | SFXWideStringStreamWriter | SFXElasticStreamReader
| Constructor/Destructor |
|---|
|
SFXElasticStreamWriter( Void ) Constructor of SFXElasticStreamWriter class.
|
|
~SFXElasticStreamWriter( Void ) Destructor of SFXElasticStreamWriter class.
|
| Public Functions | |
|---|---|
| Void |
Attach(
SFXOutputStreamPtr stream
) Delegate the control privilege of SFXOutputStream object to the SFXStreamWriter object.
|
| Void |
Cancel( Void ) Call the Cancel function for Storage class. And also unregister callback functions.
|
| SFXOutputStreamPtr |
Detach( Void ) Delegate the control privilege of SFXElasticStreamWriter object to the SFXOutputStream object.
|
| SFCError |
Flush( Void ) Flush( CallbackSPP spp , VoidPtr reference ) Flush the written data.
|
| UInt32 |
GetWritableSize( Void ) Get the size of writable data.
|
| Void |
Release( Void ) Release the stream.
|
| SFCError |
ResetTrigger( Void ) Reset the trigger when the callback function will be called.
|
| SFCError |
SetTrigger(
UInt32 size
) SetTrigger( VoidConstPtr buffer , UInt32 size ) SetTrigger( SFXBufferConstRef buffer ) Set the trigger when the callback function will be called.
|
| Bool |
Triggers( Void ) Check whether the callback function is called by trigger or not.
|
| SFCError |
Write(
SFXBufferConstRef buffer
) Write( VoidConstPtr buffer , UInt32 size ) Write data to stream.
|
| Types |
|---|
|
CallbackSPP
(inherits from SFXStream)
Constant that represents Callback function.
|
[ public, explicit ] SFXElasticStreamWriter(Void);
[ public, virtual ] virtual ~SFXElasticStreamWriter(Void);
[ public ] Void Attach( SFXOutputStreamPtr stream // stream to set );
The contents of the SFXElasticStreamWriter object before calling the SFXElasticStreamWriter::Attach function will be destroyed.
[ public, virtual ] Void Cancel(Void);
Call the SFXFile::Cancel function for file, the SFXTCPSocket::Cancel function for TCP socket, etc.
And also the callback functions registered by SFXElasticStreamWriter::Flush function are unregistered.
SFXElasticStreamWriter::Flush | SFXFile::Cancel | SFXTCPSocket::Cancel
[ public ] SFXOutputStreamPtr Detach(Void);
[ public, virtual ] SFCError Flush(Void);
[ public, virtual ] SFCError Flush( CallbackSPP spp // callback function VoidPtr reference // data sent to callback function );
There are two types of SFXElasticStreamWriter::Flush functions: one is with the registration of callback function, and the other is without it. Which type of SFXElasticStreamWriter::Flush function is available depends upon the storage of stream.
For example, only the type with the registration of callback function is availavle for TCP stream. However file stream can use both types.
In case of the SFXElasticStreamWriter::Flush function without the registration of callback function, data is flushed immediately after this function is called.
[ public, const ] UInt32 GetWritableSize(Void);
[ public ] Void Release(Void);
[ public, virtual ] SFCError ResetTrigger(Void);
Reset the trigger set with the SFXElasticStreamWriter::SetTrigger function.
[ public, virtual ] SFCError SetTrigger( UInt32 size // data size to be written through output stream );
[ public, virtual ] SFCError SetTrigger( SFXBufferConstRef buffer // SFXBuffer object to be written through output stream );
[ public, virtual ] SFCError SetTrigger( VoidConstPtr buffer // data to be written through output stream UInt32 size // size of data to be written through output stream );
The callback function registered by the SFXElasticStreamWriter::Flush function is called when the stream buffer is full or the end of data is written.
When the "size" parameter of SFXElasticStreamWriter::SetTrigger function is specified, callback function is called every time the "size" data is written.
When the "buffer" parameter of SFXElasticStreamWriter::SetTrigger function is specified, callback function is called every time the data same with "buffer" is written.
Call the callback on every time the line-feed character is read.
SetTrigger("\r\n", 2)
[ public, virtual, const ] Bool Triggers(Void);
The SFXElasticStreamWriter::Triggers function is used for the callback function registered by the SFXElasticStreamWriter::Flush function.
SFXElasticStreamWriter::SetTrigger | SFXElasticStreamWriter::ResetTrigger | SFXElasticStreamWriter::Flush
[ public, virtual ] SFCError Write( SFXBufferConstRef buffer // writing data );
[ public, virtual ] SFCError Write( VoidConstPtr buffer // writing data UInt32 size // size of writing data );
When the size of data to be written is larger than the return value of SFXElasticStreamWriter::GetWritableSize function, it is necessary to call the SFXElasticStreamWriter::Flush function.
|
Copyright (C) 2002 - 2009 Sophia Cradle, Inc. All Rights Reserved. |
![]() ![]() ![]()
|