OnixS C++ FIX Engine  4.3.0
API Documentation
Dictionary-independent mode usage

The OnixS::FIX::SBE::Decoder can be initialized in dictionary-independent mode (event-based SBE decoder does not use FIX dictionary at all). This means that there is no need to specify FIX Dictionary for a Decoder's constructor. The decoder will generate appropriate dictionary basing on the SBE template content. Generated Dictionary will be accessible via OnixS::FIX::SBE::Decoder::fixDictionary and becomes permanent for the Engine (until OnixS::FIX::Engine::shutdown called).

It is quite similar to using of the OnixS::FIX::SBE::Decoder::generateFixDictionary method, but the dictionary identifier is chosen by the decoder itself on the base of SBE template content.

Note
The single instance of the dictionary will be created even if there are several instances of decoders that were initialized by the same SBE template.
std::string generatedDictionaryId;
EngineSettings settings;
Engine::init(settings);
std::ifstream templatesStream("templates/SbeTemplates.xml");
assert(templatesStream);
const std::string xmlSbeTemplates((std::istreambuf_iterator<char>(templatesStream)), std::istreambuf_iterator<char>());
assert(!xmlSbeTemplates.empty());
{
// Initialize decoder in dictionary-independent mode.
SBE::Decoder decoder(xmlSbeTemplates);
// Access the generated dictionary.
Dictionary dictionary = decoder.fixDictionary();
// Store dictionary identifier
generatedDictionaryId = dictionary.id();
//
// ... Decoding details are the same as in previous samples
//
}
// Access generated dictionary using identifier much later after decoding session.
Dictionary dictionary(generatedDictionaryId.c_str());