In contrast to flat model (
FIX Message) object model allowto address messages and fields by names. This interface is slower than flat model however may appear more friendly thanks to Intellisense - the development-time on-line help.
For each FIX protocol version there is a dedicated namespace. For each message type there is a dedicated class. To create "new order single" message using object model simply create instance of the corresponding class.
#include "B2BITS_Exception.h"
#include "B2BITS_FixEngine.h"
#include "b2bits/FixMessages/FIX44/Enums.h"
#include "b2bits/FixMessages/FIX44/AllMessages.h"
#include "b2bits/FixMessages/FIX44/Tags.h"
#include "b2bits/FixMessages/LocalMktDateType.h"
#include "b2bits/FixMessages/UTCTimestampType.h"
b2bits::FixMessages::FIX42::NewOrderSingleMessage order42;
b2bits::FixMessages::FIX44::IndicationOfInterestMessage ioi44;
Fields can be accessed by names.
b2bits::FixMessages::FIX42::ExecutionReportMessage exec;
exec.OrderID().set("2247");
exec.ExecType().set(ExecType::Fill);
exec.OrdStatus().set(OrdStatus::Filled);
exec.LeavesQty().set(0);
exec.TransactTime().set(UTCTimestampType::now());
exec.OrderID().remove();
Repeating groups can be accessed by the name of the leading tag. Repeating group is treated as array, means that entries are accessed via indices.
AllocationInstructionMessage alloc;
AllocationInstructionMessage::OrdersGroup ordReportGrp = alloc.Orders();
ordReportGrp.resize(1);
ordReportGrp[0].ClOrdID().set("1789");
AllocationInstructionMessage::AllocsGroup allocInstrGrp = alloc.Allocs();
allocInstrGrp.resize(2);
allocInstrGrp[0].AllocAccount().set("Account1");
allocInstrGrp[0].AllocQty().set(4);
allocInstrGrp[1].AllocAccount().set("Account2");
allocInstrGrp[1].AllocQty().set(6);
alloc.Orders().remove();
No specific actions are required to release resources.
Object message can be send the same way as flat message