ASN1C C/C++ Common Runtime  ASN1C v7.7.x
Public Member Functions | List of all members
OSRTOutputStream Class Reference

#include <OSRTOutputStream.h>

Inheritance diagram for OSRTOutputStream:
OSRTStream OSRTFileOutputStream OSRTMemoryOutputStream OSRTSocketOutputStream

Public Member Functions

EXTRTMETHOD OSRTOutputStream ()
 
EXTRTMETHOD OSRTOutputStream (OSRTContext *mpContext, OSBOOL attachStream=FALSE)
 
virtual EXTRTMETHOD ~OSRTOutputStream ()
 
virtual EXTRTMETHOD int close ()
 
virtual EXTRTMETHOD int flush ()
 
virtual OSRTCtxtPtr getContext ()
 
virtual OSCTXTgetCtxtPtr ()
 
virtual char * getErrorInfo ()
 
virtual char * getErrorInfo (char *pBuf, size_t &bufSize)
 
virtual int getStatus () const
 
virtual OSBOOL isA (StreamID id) const
 
virtual EXTRTMETHOD OSBOOL isOpened ()
 
void printErrorInfo ()
 
void resetErrorInfo ()
 
virtual EXTRTMETHOD long write (const OSOCTET *pdata, size_t size)
 
virtual EXTRTMETHOD long write (const char *pdata)
 
- Public Member Functions inherited from OSRTStream
virtual EXTRTMETHOD ~OSRTStream ()
 
int getStatus () const
 
OSBOOL isInitialized ()
 
void printErrorInfo ()
 
void resetErrorInfo ()
 

Additional Inherited Members

- Protected Member Functions inherited from OSRTStream
EXTRTMETHOD OSRTStream (OSRTContext *pContext, OSBOOL attachStream=FALSE)
 
EXTRTMETHOD OSRTStream (OSRTStream &original)
 
EXTRTMETHOD OSRTStream ()
 
EXTRTMETHOD char * getErrorInfo (size_t *pBufSize)
 
- Protected Attributes inherited from OSRTStream
OSRTCtxtHolder mCtxtHolder
 
OSBOOL mbAttached
 
int mStatus
 
int mInitStatus
 

Detailed Description

The base class definition for operations with output streams. As with the input stream, this implementation is backed by memory buffers to improve I/O performance.

Constructor & Destructor Documentation

◆ OSRTOutputStream()

EXTRTMETHOD OSRTOutputStream::OSRTOutputStream ( )

The default constructor. It initializes a buffered stream. A buffered stream maintains data in memory before reading or writing to the device. This generally provides better performance than an unbuffered stream.

◆ ~OSRTOutputStream()

virtual EXTRTMETHOD OSRTOutputStream::~OSRTOutputStream ( )
virtual

Virtual destructor. Closes the stream if it was opened.

Member Function Documentation

◆ close()

virtual EXTRTMETHOD int OSRTOutputStream::close ( )
virtual

Closes the output or output stream and releases any system resources associated with the stream. For output streams this function also flushes all internal buffers to the stream.

Returns
Completion status of operation:
  • 0 = success,
  • negative return value is error.
See also
rtxStreamClose

Reimplemented from OSRTStream.

◆ flush()

virtual EXTRTMETHOD int OSRTOutputStream::flush ( )
virtual

Flushes the buffered data to the stream.

Returns
Completion status of operation:
  • 0 = success,
  • negative return value is error.
See also
rtxStreamFlush

Reimplemented from OSRTStream.

◆ getContext()

virtual OSRTCtxtPtr OSRTOutputStream::getContext ( )
inlinevirtual

This method returns a pointer to the underlying OSRTContext object.

Returns
A reference-counted pointer to an OSRTContext object. The OSRTContext object will not be released until all referenced-counted pointer variables go out of scope. This allows safe sharing of the context between different run-time classes.

Reimplemented from OSRTStream.

References OSRTStream::getContext().

◆ getCtxtPtr()

virtual OSCTXT* OSRTOutputStream::getCtxtPtr ( )
inlinevirtual

This method returns a pointer to the underlying OSCTXT object. This is the structure used in calls to low-level C encode/decode functions.

Returns
Pointer to a context (OSCTXT) structure.

Reimplemented from OSRTStream.

References OSRTStream::getCtxtPtr().

◆ getErrorInfo() [1/2]

virtual char* OSRTOutputStream::getErrorInfo ( )
inlinevirtual

Returns error text in a dynamic memory buffer. Buffer will be allocated by 'operator new []'. The calling routine is responsible to free the memory by using 'operator delete []'.

Returns
A pointer to a newly allocated buffer with error text.

Reimplemented from OSRTStream.

References OSRTStream::getErrorInfo().

◆ getErrorInfo() [2/2]

virtual char* OSRTOutputStream::getErrorInfo ( char *  pBuf,
size_t &  bufSize 
)
inlinevirtual

Returns error text in a memory buffer. If buffer pointer is specified in parameters (not NULL) then error text will be copied in the passed buffer. Otherwise, this method allocates memory using the 'operator new []' function. The calling routine is responsible to free the memory by using 'operator delete []'.

Parameters
pBufA pointer to a destination buffer to obtain the error text. If NULL, dynamic buffer will be allocated.
bufSizeA reference to buffer size. If pBuf is NULL it will receive the size of allocated dynamic buffer.
Returns
A pointer to a buffer with error text. If pBuf is not NULL, the return pointer will be equal to it. Otherwise, returns newly allocated buffer with error text. NULL, if error occurred.

Reimplemented from OSRTStream.

References OSRTStream::getErrorInfo().

◆ getStatus()

virtual int OSRTOutputStream::getStatus ( ) const
inlinevirtual

This method returns the completion status of previous operation. It can be used to check completion status of constructors or methods, which do not return completion status.

Returns
Runtime status code:
  • 0 = success,
  • negative return value is error.

References OSRTStream::getStatus().

◆ isA()

virtual OSBOOL OSRTOutputStream::isA ( StreamID  id) const
inlinevirtual

This method is used to query a stream object in order to determine its actual type.

Parameters
idEnumerated stream identifier
Returns
True if the stream matches the identifier

Reimplemented in OSRTSocketOutputStream, OSRTMemoryOutputStream, and OSRTFileOutputStream.

References OSRTStream::isOpened().

◆ isOpened()

virtual EXTRTMETHOD OSBOOL OSRTOutputStream::isOpened ( )
virtual

Checks if the stream open or not.

Returns
s TRUE, if the stream is opened, FALSE otherwise.
See also
rtxStreamIsOpened

Reimplemented from OSRTStream.

◆ printErrorInfo()

void OSRTOutputStream::printErrorInfo ( )
inline

The printErrorInfo method prints information on errors contained within the context.

References OSRTStream::printErrorInfo().

◆ resetErrorInfo()

void OSRTOutputStream::resetErrorInfo ( )
inline

The resetErrorInfo method resets information on errors contained within the context.

References OSRTStream::resetErrorInfo().

◆ write() [1/2]

virtual EXTRTMETHOD long OSRTOutputStream::write ( const OSOCTET *  pdata,
size_t  size 
)
virtual

Write data to the stream. This method writes the given number of octets from the given array to the output stream.

Parameters
pdataThe pointer to the data to be written.
sizeThe number of octets to write.
Returns
The total number of octets written into the stream, or negative value with error code if any error is occurred.
See also
rtxStreamWrite

◆ write() [2/2]

virtual EXTRTMETHOD long OSRTOutputStream::write ( const char *  pdata)
virtual

Write data to the stream. This method writes data from a null-terminated character string to the output stream.

Parameters
pdataThe pointer to the data to be written.
Returns
The total number of octets written into the stream, or negative value with error code if any error is occurred.
See also
rtxStreamWrite

The documentation for this class was generated from the following file: