CXStream

From cxwiki

Revision as of 03:34, 26 February 2018 by Windwalkr (talk | contribs) (Created page with "<div class="mw-parser-output">The CXStream class hierarchy provides support for readable and writeable streams, ranging from file streams and network sockets to adap...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The CXStream class hierarchy provides support for readable and writeable streams, ranging from file streams and network sockets to adaptors such as data codecs. The underlying functionality is virtual, but non-virtual caching operations are provided transparently to avoid exessive virtual call overhead. As much as is possible, CXStream-derived classes provide completely generic behaviour, and CXStream-utilising functions accept a base CXStream* rather than specifying a more specialised derived type. This allows an application to create a CXStream of any type (potentially even creating something new) and pass it to an existing function or system.
 
This page documents the usage of CXStream (and its derived classes). For guidance on creating new CXStream-derived classes, see CXStream Development.
 

Read / Write

//
StreamSize Read(void* __nullable o_buffer, StreamSize a_size);

//
StreamSize Write(const void* __nullable a_buffer, StreamSize a_size);

//
CXStream::StreamSize ReadDiscard(CXStream::StreamSize a_size);

//
CXStream::StreamSize WriteDiscard(const void* __nonnull a_buffer, StreamSize a_size);

//void Flush(FlushFlags flags = FLUSH_FLAGS_BLOCK);

 

Cursor

//
StreamPos Seek(StreamPos a_pos, uint a_mode = STREAM_SEEK_START);

//
StreamPos Tell(void) const;

//
StreamSize GetSize(void) const;

//
void SetSize(StreamSize size);

//
void Truncate(void)

//
StreamSize GetRemain(void) const;

//
bool GetRemain(StreamSize& o_remain) const;

// End-of-File detection
bool IsEOF(void) const;

 

Capabilities Flags

 

// get the capabilities flags for this stream
Flags32 GetCaps(void) const;

// request a change of capabilities for this stream
void SetCaps(const Flags32& caps, const Flags32& mask);

//
void SetCaps(const Flags32& caps);

//
void ClearCaps(const Flags32& caps);

// Provider-specific hints
void SetHint(uint32 hintEnum, uint32 hintValue);

 

Status

// Determine the last error that has occurred.
CXResultCode GetStreamResult(void) const;

// clear the error result
void ClearStreamResult(void);

//
void SetStreamResult(CXResultCode a_result) const;

//
void ConcatenateResult(CXResultCode a_result) const;

// shut down this stream, ready for another Open()
void Close(void);

//
bool IsOpen(void) const;

//
bool IsClosed(void) const;


 

 

Events

CXGenericEventRef GetStreamEvent(EventType eventType) const;