OSJSONEncodeBuffer Class Reference
The OSJSONEncodeBuffer class is derived from the OSJSONMessageBuffer base class. More...
#include <OSJSONEncodeBuffer.h>
Public Member Functions | |
EXTJSONMETHOD | OSJSONEncodeBuffer () |
Default constructor. | |
EXTJSONMETHOD | OSJSONEncodeBuffer (OSOCTET *pMsgBuf, size_t msgBufLen) |
This constructor allows a static message buffer to be specified to receive the encoded message. | |
virtual size_t | getMsgLen () |
This method returns the length of a previously encoded JSON message. | |
virtual EXTJSONMETHOD int | init () |
This method reinitializes the encode buffer to allow a new message to be encoded. | |
virtual OSBOOL | isA (Type bufferType) |
This is a virtual method that must be overridden by derived classes to allow identification of the class. | |
void | nullTerminate () |
This method adds a null-terminator character ('') at the current buffer position. | |
virtual EXTJSONMETHOD long | write (const char *filename) |
This method writes the encoded message to the given file. | |
virtual EXTJSONMETHOD long | write (FILE *fp) |
This version of the write method writes to a file that is specified by a FILE pointer. |
Detailed Description
The OSJSONEncodeBuffer class is derived from the OSJSONMessageBuffer base class.
It contains variables and methods specific to encoding JSON messages. It is used to manage the buffer into which a message is to be encoded.
Definition at line 38 of file OSJSONEncodeBuffer.h.
Constructor & Destructor Documentation
EXTJSONMETHOD OSJSONEncodeBuffer::OSJSONEncodeBuffer | ( | OSOCTET * | pMsgBuf, | |
size_t | msgBufLen | |||
) |
This constructor allows a static message buffer to be specified to receive the encoded message.
- Parameters:
-
pMsgBuf A pointer to a fixed size message buffer to receive the encoded message. msgBufLen Size of the fixed-size message buffer.
Member Function Documentation
virtual size_t OSJSONEncodeBuffer::getMsgLen | ( | ) | [inline, virtual] |
This method returns the length of a previously encoded JSON message.
- Returns:
- Length of the JSON message encapsulated within this buffer object.
Definition at line 67 of file OSJSONEncodeBuffer.h.
virtual EXTJSONMETHOD int OSJSONEncodeBuffer::init | ( | ) | [virtual] |
This method reinitializes the encode buffer to allow a new message to be encoded.
This makes it possible to reuse one message buffer object in a loop to encode multiple messages. After this method is called, any previously encoded message in the buffer will be overwritten on the next encode call.
virtual OSBOOL OSJSONEncodeBuffer::isA | ( | Type | bufferType | ) | [inline, virtual] |
This is a virtual method that must be overridden by derived classes to allow identification of the class.
The base class variant is abstract. This method matches an enumerated identifier defined in the base class. One identifier is declared for each of the derived classes.
- Parameters:
-
bufferType Enumerated identifier specifying a derived class. This type is defined as a public access type in the OSRTMessageBufferIF base interface. Possible values include BEREncode, BERDecode, PEREncode, PERDecode, JSONEncode, and JSONDecode.
- Returns:
- Boolean result of the match operation. True if the
bufferType
argument isJSONEncode
. argument.
Definition at line 95 of file OSJSONEncodeBuffer.h.
virtual EXTJSONMETHOD long OSJSONEncodeBuffer::write | ( | FILE * | fp | ) | [virtual] |
This version of the write method writes to a file that is specified by a FILE pointer.
- Parameters:
-
fp Pointer to FILE structure to which the encoded message will be written.
- Returns:
- Number of octets actually written. This value may be less than the actual message length if an error occurs.
virtual EXTJSONMETHOD long OSJSONEncodeBuffer::write | ( | const char * | filename | ) | [virtual] |
This method writes the encoded message to the given file.
- Parameters:
-
filename The name of file to which the encoded message will be written.
- Returns:
- Number of octets actually written. This value may be less than the actual message length if an error occurs.
The documentation for this class was generated from the following file: