The cStream Class provides a basic, simple implementation for IStream interface.
More...
|
| cStream (tStreamType eType, tFileSize szBuffer=0, uint32_t ui32Flags=0) |
| Constructs a Stream with the current size. More...
|
|
virtual | ~cStream () |
| Destructor.
|
|
tResult | SetSize (tFileSize szBuffer, uint32_t ui32Flags=0) |
| Sets the current size of the stream. More...
|
|
tResult | CopyTo (cStream &strmOutput) const |
| Copies a Stream to another. More...
|
|
tResult | CopyFrom (cStream &strmInput) |
| Copies content from another Stream. More...
|
|
const void * | GetCurrentPtr () const |
| Gets the address of the buffers current seek position. More...
|
|
tFileSize | GetCurrentSize () const |
| Returns the current buffer size. More...
|
|
tFileSize | GetHighestPosIndex () const |
| Returns the current buffer size which was written (without a gap at the end). More...
|
|
tResult | AttachReference (void *pReferenceBuffer, tFileSize szBufferSize) |
| Reference to a extern buffer (no intern buffer will be used to write to or read from). More...
|
|
tResult | DetachReference () |
| Reference to a buffer will be detached. More...
|
|
tResult | Read (void *pvBuffer, size_t nBufferSize, size_t *pnBytesRead=nullptr) const override |
| Implements. More...
|
|
tResult | Write (const void *pvBuffer, size_t nBufferSize, size_t *pnBytesWritten=nullptr) override |
| Implements. More...
|
|
tResult | Seek (tFilePos nPos, tSeekOrigin eOrigin, tFilePos *pNewPos=nullptr) const override |
| Implements IStream::Seek. More...
|
|
tResult | Reset () override |
| Implements. More...
|
|
tResult | Flush () override |
| Implements. More...
|
|
tResult | GetInterface (const char *i_strIID, void *&o_pInterface) override |
| Query interfaces on an object. More...
|
|
tResult | GetInterface (const char *i_strIID, const void *&o_pInterface) const override |
| Provides const correct interface querying. More...
|
|
void | Destroy () const override |
| Destruct and deallocate instantiations of type IObject . More...
|
|
| ADTF_IID (IObject, "object.ant.ucom.adtf.iid") |
| Marks the IObject to be castable with the ucom_cast() More...
|
|
The cStream Class provides a basic, simple implementation for IStream interface.
Definition at line 20 of file stream.h.
◆ tStreamFlags
Stream flags.
Enumerator |
---|
FLG_KEEP_POSITION | Sets correct end of file marker at.
- See also
- cStream::SetSize() call.
|
FLG_DONT_GROW | Will only have the at construction time decided size.
|
Definition at line 43 of file stream.h.
◆ tStreamType
Stream direction type.
Enumerator |
---|
INPUT_STREAM | Is a Input Stream (can be read).
|
OUTPUT_STREAM | Is a Output Stream (can be written).
|
Definition at line 29 of file stream.h.
◆ cStream()
Constructs a Stream with the current size.
- Parameters
-
eType | [in] The In or Ouput Type. |
szBuffer | [in] The stream buffer size which will be preallocated. |
ui32Flags | [in] The creating flags ( |
- See also
- tStreamFlags).
◆ AttachReference()
Reference to a extern buffer (no intern buffer will be used to write to or read from).
Mind: A SetSize will be failed, while a Buffer is attached!!
- Parameters
-
pReferenceBuffer | Reference to the extern buffer. |
szBufferSize | Size of the Extern buffer. |
- Returns
- Standard Result Code.
◆ CopyFrom()
Copies content from another Stream.
- Parameters
-
strmInput | The Stream to copy from. |
- Returns
- Standard Result Code.
◆ CopyTo()
Copies a Stream to another.
- Parameters
-
strmOutput | The Stream to copy to. |
- Returns
- Standard Result Code.
◆ DetachReference()
Reference to a buffer will be detached.
- See also
- AttachReference.
- Returns
- Standard Result Code.
◆ Flush()
Implements.
- See also
- IStream::Flush. This function is not supported in the cStream implementation.
- Returns
- Standard Result Code.
◆ GetCurrentPtr()
const void* GetCurrentPtr |
( |
| ) |
const |
Gets the address of the buffers current seek position.
- Returns
- The buffer address.
- Note
- rtsafe
◆ GetCurrentSize()
Returns the current buffer size.
- Returns
- The buffer size.
- Note
- rtsafe
◆ GetHighestPosIndex()
Returns the current buffer size which was written (without a gap at the end).
- Returns
- The current highest pos reached with the Write() call.
- Note
- rtsafe
◆ GetRemainingBytes()
- Returns
- Remaing vount of bytes
- Note
- rtsafe
◆ IsEof()
Checks if end of stream is reached.
- Return values
-
true | End of stream reached |
false | End of stream is not reached |
- Note
- rtsafe
◆ Read()
tResult Read |
( |
void * |
pvBuffer, |
|
|
size_t |
nBufferSize, |
|
|
size_t * |
pnBytesRead = nullptr |
|
) |
| const |
|
override |
Implements.
- See also
- IStream::Read. Will Read from the intern Buffer or extern reference attached.
- Parameters
-
pvBuffer | reference address the cStream will copy the read data to. |
nBufferSize | size of bytes to read. |
pnBytesRead | return value for size of bytes read. |
- Returns
- Standard Result Code.
- Note
- rtsafe
◆ Reset()
Implements.
- See also
- IStream::Seek. Sets the current position in the stream to the begin.
- Returns
- Standard Result Code.
- Note
- rtsafe
◆ Seek()
Implements IStream::Seek.
Sets the current position in the stream.
- Parameters
-
nPos | Position to set to (in bytes). |
eOrigin | IStream::tSeekOrigin. |
pNewPos | return value for the new position (same as |
- See also
- GetCurrentPtr).
- Returns
- Standard Result Code.
- Note
- rtsafe
◆ SetSize()
Sets the current size of the stream.
- Parameters
-
szBuffer | [in] The stream buffer size which will be allocated. |
ui32Flags | [in] The set size flags ( |
- See also
- tStreamFlags).
- Returns
- Standard Result Code.
◆ Write()
tResult Write |
( |
const void * |
pvBuffer, |
|
|
size_t |
nBufferSize, |
|
|
size_t * |
pnBytesWritten = nullptr |
|
) |
| |
|
override |
Implements.
- See also
- IStream::Write. Writes to the intern buffer or extern reference attached.
- Parameters
-
pvBuffer | reference address the cStream will copy the data from. |
nBufferSize | size of bytes to write. |
pnBytesWritten | return value for size of bytes written. |
- Returns
- Standard Result Code.