OnixS C++ FIX Engine  3.25.0
API Documentation
Dialect Exploration

The OnixS::FIX::Dictionary class exposes an interface to access information about the content of a specialized FIX dictionary or standard FIX messaging specification. These interface allow to obtain the types of specific dictionary or standard FIX messages, and to explore the entire message structure, as well as to retrieve names of arbitrary fields by tag numbers.

Accessing Fields Information

The following members are present for basic field information manipulation:

Dictionary fix44(ProtocolVersion::FIX_44);
std::string tagName = fix44.fieldName(FIX44::Tags::Side);
std::cout << "Field " << tagName << "(" << FIX44::Tags::Side << ")" << " has following valid values:" << std::endl;
Dictionary::ValidFieldValues validFieldValues = fix44.validFieldValues(FIX44::Tags::Side);
for(Dictionary::ValidFieldValues::const_iterator validFieldValue = validFieldValues.begin(); validFieldValue != validFieldValues.end(); ++validFieldValue)
{
std::cout << validFieldValue->value() << "(" << validFieldValue->description() << ")" << std::endl;
}

Exploring Dictionary Messages Structure

To explore message related information, the following members are present:

The following example demonstrates how fields, which make up a message, can be traversing.

void traverseFields(const Dictionary::FieldInfos& fields, int shift)
{
std::string spaces(shift, ' ');
for(Dictionary::FieldInfos::const_iterator fieldInfo = fields.begin(); fieldInfo != fields.end(); ++fieldInfo)
{
std::cout << spaces << fieldInfo->tag() << "(required=" << fieldInfo->isRequired() << ")" << std::endl;
traverseFields(fieldInfo->childFields(), 2 + shift);
}
}
void traverseMessages(const Dictionary& dictionary)
{
Dictionary::MessageTypes messageTypes = dictionary.messageTypes();
for(Dictionary::MessageTypes::const_iterator msgType = messageTypes.begin(); msgType != messageTypes.end(); ++msgType)
{
std::cout << "Traversing " << dictionary.messageName(*msgType) << "(msgType=" << *msgType << ")" << std::endl;
traverseFields(dictionary.messageFields(*msgType), 0);
}
}