OnixS C++ FIX Engine 4.13.0
API Documentation
Loading...
Searching...
No Matches
Decoder Class Reference

Public Member Functions

 Decoder (const std::string &xmlTemplates, const OnixS::FIX::Dictionary &fixDictionary, ISbeCustomCoderLibrary *customCoders=ONIXS_FIXENGINE_NULLPTR)
 Decoder (const std::string &xmlTemplates, ISbeCustomCoderLibrary *customCoders=ONIXS_FIXENGINE_NULLPTR)
 Decoder (ProtocolVersion::Enum baseVersion, const std::string &xmlTemplates, ISbeCustomCoderLibrary *customCoders=ONIXS_FIXENGINE_NULLPTR)
 ~Decoder ()
const OnixS::FIX::Messagedecode (int templateId, int version, size_t rootBlockLength, const unsigned char *buffer, size_t bufferSize, size_t *numberOfDecodedBytes=ONIXS_FIXENGINE_NULLPTR) const
const OnixS::FIX::Messagedecode (const unsigned char *buffer, size_t bufferSize, size_t *numberOfDecodedBytes=ONIXS_FIXENGINE_NULLPTR, int *templateId=ONIXS_FIXENGINE_NULLPTR, int *version=ONIXS_FIXENGINE_NULLPTR) const
bool tryDecode (int templateId, int version, size_t rootBlockLength, const unsigned char *buffer, size_t offset, size_t count, OnixS::FIX::Message *message, size_t *numberOfDecodedBytes) const
OnixS::FIX::Dictionary fixDictionary () const
void maximumNumberOfRepeatingGroupEntries (int value)
int maximumNumberOfRepeatingGroupEntries () const
unsigned schemaVersion () const
unsigned schemaId () const
std::string schemaSemanticVersion () const
std::string schemaHeaderType () const

Static Public Member Functions

static Dictionary generateFixDictionary (const std::string &sbeTemplateXml)
static Dictionary generateFixDictionary (ProtocolVersion::Enum baseVersion, const std::string &sbeTemplateXml)

Detailed Description

Definition at line 97 of file SBE.h.

Constructor & Destructor Documentation

◆ Decoder() [1/3]

Decoder ( const std::string & xmlTemplates,
const OnixS::FIX::Dictionary & fixDictionary,
ISbeCustomCoderLibrary * customCoders = ONIXS_FIXENGINE_NULLPTR )

Creates a SBE to FIX Decoder.

Parameters
xmlTemplatesXML-based SBE templates.
fixDictionaryThe customized FIX dictionary used for the decoded message.
customCodersThe custom coders library.

◆ Decoder() [2/3]

Decoder ( const std::string & xmlTemplates,
ISbeCustomCoderLibrary * customCoders = ONIXS_FIXENGINE_NULLPTR )

Creates a SBE to FIX Decoder for the FIX dictionary-independent mode.

The generic FIX dictionary is created by the provided SBE-template content, uses the FIX 4.0 as a base FIX dictionary and has a generic name.

Parameters
xmlTemplatesXML-based SBE templates.
customCodersThe custom coders library.

◆ Decoder() [3/3]

Decoder ( ProtocolVersion::Enum baseVersion,
const std::string & xmlTemplates,
ISbeCustomCoderLibrary * customCoders = ONIXS_FIXENGINE_NULLPTR )

Creates a SBE to FIX Decoder for the FIX dictionary-independent mode.

The generic FIX dictionary is created by the provided SBE-template content, uses the specified FIX dictionary as a base and has a generic name.

Parameters
baseVersionThe version of the FIX protocol which the dictionary becomes a base for the newly generated FIX dictionary.
xmlTemplatesXML-based SBE templates used to generate the FIX dictionary. This FIX dictionary takes a generic identifier generated on a base of the XML content and baseVersion
customCodersThe custom coders library.

◆ ~Decoder()

~Decoder ( )

The destructor.

Member Function Documentation

◆ decode() [1/2]

const OnixS::FIX::Message & decode ( const unsigned char * buffer,
size_t bufferSize,
size_t * numberOfDecodedBytes = ONIXS_FIXENGINE_NULLPTR,
int * templateId = ONIXS_FIXENGINE_NULLPTR,
int * version = ONIXS_FIXENGINE_NULLPTR ) const

Decodes the given SBE stream chunk into the corresponding FIX Message using the message header.

This method decodes the given SBE stream chunk using the message header decoder that was built on a base of the SBE template.

Parameters
[in]bufferThe buffer that contains the SBE stream chunk to be decoded.
[in]bufferSizeThe size of the buffer.
[out]numberOfDecodedBytesThe number of bytes that contained the encoded FIX Message.
[out]templateIdThe identifier of the SBE template, that was used to decode the input data.
[out]versionThe version of the SBE schema, that was used to decode the input data.
Warning
The returned message is 'owned' by the Decoder.
The previously decoded message is freed by the Decoder when this method is called again.
Exceptions
Anexception if the message cannot be decoded.
Returns
The decoded FIX message.

◆ decode() [2/2]

const OnixS::FIX::Message & decode ( int templateId,
int version,
size_t rootBlockLength,
const unsigned char * buffer,
size_t bufferSize,
size_t * numberOfDecodedBytes = ONIXS_FIXENGINE_NULLPTR ) const

Decodes the given SBE stream chunk into the corresponding FIX Message.

Parameters
[in]templateIdThe identifier of the SBE template, used to decode the input data.
[in]versionThe version of the SBE schema, used to decode the input data.
[in]rootBlockLengthThe length of the root block. This value should be extracted from the message preamble, or from other source.
[in]bufferThe buffer that contains the SBE stream chunk to be decoded.
[in]bufferSizeThe size of the buffer.
[out]numberOfDecodedBytesThe number of bytes that contains the encoded FIX Message.
Warning
The returned message is 'owned' by the Decoder.
The previously decoded message is freed by the Decoder when this method is called again.
Exceptions
Anexception if the message cannot be decoded.
Returns
The decoded FIX message.

◆ fixDictionary()

OnixS::FIX::Dictionary fixDictionary ( ) const

The FIX dictionary used by the decoder instance.

Returns
The FIX dictionary currently used by the decoder instance. If the decoder was initialized with the FIX dictionary-independent mode, the method returns a reference to the internally generated FIX dictionary.

◆ generateFixDictionary() [1/2]

Dictionary generateFixDictionary ( const std::string & sbeTemplateXml)
static

Generates the FIX dictionary XML.

Parameters
[in]sbeTemplateXmlThe XML content of the SBE template (the same as used to initialize the Decoder).

◆ generateFixDictionary() [2/2]

Dictionary generateFixDictionary ( ProtocolVersion::Enum baseVersion,
const std::string & sbeTemplateXml )
static

Generates the FIX dictionary XML.

Parameters
[in]sbeTemplateXmlThe XML content of the SBE template (the same as used to initialize the Decoder).
[in]baseVersionThe version of the FIX protocol which the dictionary becomes a base for the newly generated FIX dictionary.

◆ maximumNumberOfRepeatingGroupEntries() [1/2]

int maximumNumberOfRepeatingGroupEntries ( ) const

The maximum number of repeating groups, allowed for decoded messages.

Returns
The current number of repeating groups, allowed for decoded messages. The default value is the maximum positive value for the int type.

◆ maximumNumberOfRepeatingGroupEntries() [2/2]

void maximumNumberOfRepeatingGroupEntries ( int value)

Manage the maximum number of repeating groups, allowed for decoded messages.

This parameter is used during the decoding and is useful to detect a broken data, which, in particular cases, can 'need' to allocate an unexpectedly huge number of entries (for an instance - billions of entries, while normally there are just a few ones). This situation results in a memory exhausting and (often) significantly decrease the overall system performance.

To prevent the memory exhausting and negative consequences of that, this parameter should be configured with the value, which is greater then maximum possible number of entries in the valid input data, but less then the maximum integer value (default one). In a lot of real cases value of 10000 is good enough to detect broken data without a memory overloading.

Default is the maximum positive value for the int type.

Parameters
valueThe number of repeating groups, allowed for decoded messages.

◆ schemaHeaderType()

std::string schemaHeaderType ( ) const

The name of the encoding type of the message header, which is the same for all messages in a schema.

◆ schemaId()

unsigned schemaId ( ) const

The schema identifier.

◆ schemaSemanticVersion()

std::string schemaSemanticVersion ( ) const

The semantic version of the SBE schema.

◆ schemaVersion()

unsigned schemaVersion ( ) const

The maximum known version of the SBE schema.

◆ tryDecode()

bool tryDecode ( int templateId,
int version,
size_t rootBlockLength,
const unsigned char * buffer,
size_t offset,
size_t count,
OnixS::FIX::Message * message,
size_t * numberOfDecodedBytes ) const

Tries to decode the given SBE stream buffer into the corresponding FIX Message.

Parameters
[in]templateIdThe identifier of the SBE template, used to decode the input data.
[in]versionThe version of the SBE schema, used to decode the input data.
[in]rootBlockLengthThe length of the root block. This value should be extracted from the message preamble, or from other source.
[in]bufferThe SBE stream chunk to be decoded.
[in]offsetThe index in the buffer at which decoding begins.
[in]countThe number of bytes to analyze during the decoding.
[out]messageThe pointer to the decoded FIX Message.
[out]numberOfDecodedBytesThe number of bytes that contained the encoded FIX Message.
Warning
the message should point to an existing object. This object is not owned by the Decoder and should be managed by a user.
Exceptions
Anexception if the decoding error is detected.
Returns
'true' if the given bytes could be decoded into a FIX message, otherwise - 'false'.