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

#include <OSRTMsgBuf.h>

Inheritance diagram for OSRTMessageBuffer:
ASN1MessageBuffer

Public Member Functions

virtual ~OSRTMessageBuffer ()
 
virtual void * getAppInfo ()
 
virtual size_t getByteIndex ()
 
virtual OSRTCtxtPtr getContext ()
 
virtual OSCTXTgetCtxtPtr ()
 
virtual char * getErrorInfo ()
 
virtual char * getErrorInfo (char *pBuf, size_t &bufSize)
 
virtual OSOCTET * getMsgCopy ()
 
virtual const OSOCTET * getMsgPtr ()
 
virtual size_t getMsgLen ()
 
int getStatus () const
 
virtual int init ()
 
virtual EXTRTMETHOD int initBuffer (OSOCTET *pMsgBuf, size_t msgBufLen)
 
virtual void printErrorInfo ()
 
virtual void resetErrorInfo ()
 
virtual void setAppInfo (void *)
 
virtual EXTRTMETHOD void setDiag (OSBOOL value=TRUE)
 

Protected Member Functions

EXTRTMETHOD OSRTMessageBuffer (Type bufferType, OSRTContext *pContext=0)
 

Protected Attributes

OSRTCtxtHolder mCtxtHolder
 
Type mBufferType
 

Detailed Description

Abstract message buffer base class. This class is used to manage an encode or decode message buffer. For encoding, this is the buffer into which the message is being built. For decoding, it describes a message that was read into memory to be decoded. Further classes are derived from this to handle encoding and decoding of messages for different encoding rules types.

Constructor & Destructor Documentation

◆ OSRTMessageBuffer()

EXTRTMETHOD OSRTMessageBuffer::OSRTMessageBuffer ( Type  bufferType,
OSRTContext pContext = 0 
)
protected

The protected constructor creates a new context and sets the buffer class type.

Parameters
bufferTypeType of message buffer that is being created (for example, XMLEncode).
pContextPointer to a context to use. If NULL, new context will be allocated.

◆ ~OSRTMessageBuffer()

virtual OSRTMessageBuffer::~OSRTMessageBuffer ( )
inlinevirtual

The virtual destructor does nothing. It is overridden by derived versions of this class.

Member Function Documentation

◆ getAppInfo()

virtual void* OSRTMessageBuffer::getAppInfo ( )
inlinevirtual

Returns a pointer to application-specific information block

Reimplemented in ASN1MessageBuffer.

◆ getByteIndex()

virtual size_t OSRTMessageBuffer::getByteIndex ( )
inlinevirtual

The getByteIndex method is used to fetch the current byte offset within the current working buffer. For encoding, this is the next location that will be written to. For decoding, this is the next byte the parser will read.

◆ getContext()

virtual OSRTCtxtPtr OSRTMessageBuffer::getContext ( )
inlinevirtual

The getContext method returns the underlying context smart-pointer object.

Referenced by ASN1MessageBuffer::setStatus().

◆ getCtxtPtr()

virtual OSCTXT* OSRTMessageBuffer::getCtxtPtr ( )
inlinevirtual

The getCtxtPtr method returns the underlying C runtime context. This context can be used in calls to C runtime functions.

Referenced by ASN1MessageBuffer::addEventHandler(), ASN1MessageBuffer::addRawEventHandler(), ASN1MessageBuffer::getBitOffset(), ASN1MessageBuffer::removeEventHandler(), ASN1MessageBuffer::removeRawEventHandler(), and ASN1MessageBuffer::setErrorHandler().

◆ getErrorInfo() [1/2]

virtual char* OSRTMessageBuffer::getErrorInfo ( )
inlinevirtual

Returns error text in a dynamic memory buffer. The buffer is allocated using '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.

◆ getErrorInfo() [2/2]

virtual char* OSRTMessageBuffer::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.

◆ getMsgCopy()

virtual OSOCTET* OSRTMessageBuffer::getMsgCopy ( )
inlinevirtual

The getMsgCopy method will return a copy of the encoded message managed by the object.

Referenced by ASN1MessageBuffer::getBitOffset().

◆ getMsgLen()

virtual size_t OSRTMessageBuffer::getMsgLen ( )
inlinevirtual

This method returns the length in bytes of an encoded message.

◆ getMsgPtr()

virtual const OSOCTET* OSRTMessageBuffer::getMsgPtr ( )
inlinevirtual

The getMsgPtr method will return a const pointer to the encoded message managed by the object.

Referenced by ASN1MessageBuffer::getBitOffset().

◆ getStatus()

int OSRTMessageBuffer::getStatus ( ) const
inline

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.

◆ init()

virtual int OSRTMessageBuffer::init ( )
inlinevirtual

Initializes message buffer.

Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

◆ initBuffer()

virtual EXTRTMETHOD int OSRTMessageBuffer::initBuffer ( OSOCTET *  pMsgBuf,
size_t  msgBufLen 
)
virtual

This version of the overloaded initBuffer method initializes the message buffer to point at the given null-terminated character string.

Parameters
pMsgBufPointer to message buffer.
msgBufLenLength of message buffer in bytes.
Returns
Completion status of operation:
  • 0 (0) = success,
  • negative return value is error.

Referenced by ASN1MessageBuffer::getAppInfo().

◆ printErrorInfo()

virtual void OSRTMessageBuffer::printErrorInfo ( )
inlinevirtual

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

Referenced by ASN1MessageBuffer::getBitOffset().

◆ resetErrorInfo()

virtual void OSRTMessageBuffer::resetErrorInfo ( )
inlinevirtual

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

Reimplemented in ASN1MessageBuffer.

Referenced by ASN1MessageBuffer::resetErrorInfo().

◆ setAppInfo()

virtual void OSRTMessageBuffer::setAppInfo ( void *  )
inlinevirtual

Sets the application-specific information block.

Reimplemented in ASN1MessageBuffer.

◆ setDiag()

virtual EXTRTMETHOD void OSRTMessageBuffer::setDiag ( OSBOOL  value = TRUE)
virtual

The setDiag method will turn diagnostic tracing on or off.

Parameters
value- Boolean value (default = TRUE = on)

Member Data Documentation

◆ mBufferType

Type OSRTMessageBuffer::mBufferType
protected

The mBufferType member variable holds information on the derived message buffer class type (for example, XMLEncode).


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