OnixS C++ B3 BOE Binary Order Entry  1.2.0
API Documentation
SBE Message

Inner Contents

 Message Fields
 
 Repeating Groups
 
 Schema Versioning
 

Detailed Description

The OnixS::B3::BOE::Messaging::SbeMessage represents a Simple Binary Encoding (SBE) message. The details about SBE can be found in the "Binary Order Entry - Message Specification Guidelines" document.

MessageHolder class

The Handler exposes the OnixS::B3::BOE::Messaging::MessageHolder class to encapsulate services related to handling SBE messages. It is a template class, which creates an underlying buffer to store an SBE message.

The template parameter SbeMessageType serves to indicate how the underlying buffer will be interpreted and what type of SBE message it will store.

The OnixS::B3::BOE::Messaging::MessageHolder class contains the OnixS::B3::BOE::Messaging::SimpleOpenFramingHeader and a strongly typed SBE message over the underlying data buffer.

To access to the strongly typed SBE message, use the OnixS::B3::BOE::Messaging::MessageHolder::message method or OnixS::B3::BOE::Messaging::MessageHolder::operator->().

Strongly Typed SBE Message Wrappers

The Handler exposes strongly typed SBE message wrappers (e.g.: OnixS::B3::BOE::Messaging::NewOrderSingle102), which provide interfaces to manipulate SBE message fields. These wrappers are used in strongly typed inbound callbacks of the OnixS::B3::BOE::SessionListener class (e.g.: OnixS::B3::BOE::SessionListener::onExecutionReportNew(const Messaging::ExecutionReportNew200 &, Session *)).

Note
Strongly typed SBE message wrapper classes do not have an underlying buffer and work only over an external buffer. Therefore, one needs to make sure that the lifetime of a strongly typed SBE message class object is the same as the lifetime of the buffer. For example, one should not use the delivered strongly typed SBE message object outside the inbound callback, since it uses an internal receiving buffer.

Constructing SBE Message

To create an SBE message object, use the OnixS::B3::BOE::Messaging::MessageHolder constructor. It creates the underlying buffer and the strongly typed message wrapper around it.

For example:

The following example demonstrates how SBE messages can be created.

using namespace OnixS::B3::BOE;
using namespace OnixS::B3::BOE::Messaging;
// Constructs a "New Order - Single" message,
// optional field values are set to their `null` values,
// required field values are undefined.
typedef MessageHolder<NewOrderSingle102> NewOrderSingle;
NewOrderSingle order;
std::cout << "Order " << *order << std::endl;
Note
By default, the OnixS::B3::BOE::Messaging::MessageHolder constructor sets optional fields to their null values, required field values are undefined. This behavior could be changed using the OnixS::B3::BOE::Messaging::FieldsNoInitPolicy template argument.

For example:

using namespace OnixS::B3::BOE;
using namespace OnixS::B3::BOE::Messaging;
// Constructs a "New Order - Single" message, both required and optional field values are undefined.
FieldsNoInitPolicy> NewOrderSingle;
NewOrderSingle order;
std::cout << "Order " << *order << std::endl;