OnixS C++ FIX Engine 4.13.0
API Documentation
Loading...
Searching...
No Matches
SBE.h
Go to the documentation of this file.
1#pragma once
2/*
3* Copyright Onix Solutions Limited [OnixS]. All rights reserved.
4*
5* This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
6* and international copyright treaties.
7*
8* Access to and use of the software is governed by the terms of the applicable ONIXS Software
9* Services Agreement (the Agreement) and Customer end user license agreements granting
10* a non-assignable, non-transferable and non-exclusive license to use the software
11* for it's own data processing purposes under the terms defined in the Agreement.
12*
13* Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
14* of this source code or associated reference material to any other location for further reproduction
15* or redistribution, and any amendments to this copyright notice, are expressly prohibited.
16*
17* Any reproduction or redistribution for sale or hiring of the Software not in accordance with
18* the terms of the Agreement is a violation of copyright law.
19*/
20
21#include <string>
22#include <vector>
23#include <map>
24
25#include <OnixS/FIXEngine/ABI.h>
30
31namespace OnixS {
32namespace FIX {
35
36namespace SBE {
39{
40public:
45 Encoder(const std::string & xmlTemplates, ISbeCustomCoderLibrary *customCoders = ONIXS_FIXENGINE_NULLPTR);
46
48 ~Encoder(void);
49
60 size_t encode(const OnixS::FIX::Message & fixMessage, int templateID, int version,
61 unsigned char * buffer, size_t bufferSize, size_t * rootBlockLength) const;
62
73 size_t encodeWithHeader(const OnixS::FIX::Message& fixMessage, int templateID, int version,
74 unsigned char* buffer, size_t bufferSize, size_t* rootBlockLength) const;
75
77 unsigned schemaVersion() const;
78
80 unsigned schemaId() const;
81
83 std::string schemaSemanticVersion() const;
84
87 std::string schemaHeaderType() const;
88private:
89 Encoder(const Encoder &);
90 Encoder & operator = (const Encoder &);
91
92 struct Impl;
93 Impl * impl_;
94};
95
98{
99public:
105 Decoder(const std::string & xmlTemplates, const OnixS::FIX::Dictionary & fixDictionary, ISbeCustomCoderLibrary* customCoders = ONIXS_FIXENGINE_NULLPTR);
106
112 Decoder(const std::string & xmlTemplates, ISbeCustomCoderLibrary* customCoders = ONIXS_FIXENGINE_NULLPTR);
113
120 Decoder(ProtocolVersion::Enum baseVersion, const std::string & xmlTemplates, ISbeCustomCoderLibrary* customCoders = ONIXS_FIXENGINE_NULLPTR);
121
124
140 const OnixS::FIX::Message & decode(int templateId, int version, size_t rootBlockLength,
141 const unsigned char * buffer, size_t bufferSize, size_t * numberOfDecodedBytes = ONIXS_FIXENGINE_NULLPTR) const;
142
159 const OnixS::FIX::Message& decode(const unsigned char* buffer, size_t bufferSize, size_t* numberOfDecodedBytes = ONIXS_FIXENGINE_NULLPTR,
160 int *templateId = ONIXS_FIXENGINE_NULLPTR, int *version = ONIXS_FIXENGINE_NULLPTR) const;
161
162
179 bool tryDecode(int templateId, int version, size_t rootBlockLength,
180 const unsigned char * buffer, size_t offset, size_t count, OnixS::FIX::Message * message,
181 size_t * numberOfDecodedBytes) const;
182
188
204
209
214 static Dictionary generateFixDictionary(const std::string & sbeTemplateXml);
215
221 const std::string & sbeTemplateXml);
222
224 unsigned schemaVersion() const;
225
227 unsigned schemaId() const;
228
230 std::string schemaSemanticVersion() const;
231
234 std::string schemaHeaderType() const;
235private:
237
238 Decoder(const Decoder &);
239 Decoder & operator = (const Decoder &);
240
241 struct Impl;
242 Impl * impl_;
243};
244
245}
246}
247}
#define ONIXS_FIXENGINE_API_DECL(typeKind, typeName)
Definition ABI.h:57
#define ONIXS_FIXENGINE_API
Definition ABI.h:45
#define ONIXS_FIXENGINE_NULLPTR
Definition Compiler.h:200
Identifies the FIX messages dictionary.
Definition Dictionary.h:74
Encapsulates operations over a FIX Message.
Definition Message.h:52
static Dictionary generateFixDictionary(ProtocolVersion::Enum baseVersion, const std::string &sbeTemplateXml)
Generates the FIX dictionary XML.
unsigned schemaVersion() const
The maximum known version of the SBE schema.
Decoder(const std::string &xmlTemplates, ISbeCustomCoderLibrary *customCoders=ONIXS_FIXENGINE_NULLPTR)
Creates a SBE to FIX Decoder for the FIX dictionary-independent mode.
unsigned schemaId() const
The schema identifier.
static Dictionary generateFixDictionary(const std::string &sbeTemplateXml)
Generates the FIX dictionary XML.
Decoder(const std::string &xmlTemplates, const OnixS::FIX::Dictionary &fixDictionary, ISbeCustomCoderLibrary *customCoders=ONIXS_FIXENGINE_NULLPTR)
Creates a SBE to FIX Decoder.
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.
void maximumNumberOfRepeatingGroupEntries(int value)
Manage the maximum number of repeating groups, allowed for decoded messages.
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.
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.
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.
int maximumNumberOfRepeatingGroupEntries() const
The maximum number of repeating groups, allowed for decoded messages.
OnixS::FIX::Dictionary fixDictionary() const
The FIX dictionary used by the decoder instance.
std::string schemaHeaderType() const
The name of the encoding type of the message header, which is the same for all messages in a schema.
std::string schemaSemanticVersion() const
The semantic version of the SBE schema.
~Decoder()
The destructor.
Encoder(const std::string &xmlTemplates, ISbeCustomCoderLibrary *customCoders=ONIXS_FIXENGINE_NULLPTR)
Creates a FIX to SBE Encoder.
~Encoder(void)
Destructor.
unsigned schemaVersion() const
The maximum known version of the SBE schema.
unsigned schemaId() const
The schema identifier.
size_t encode(const OnixS::FIX::Message &fixMessage, int templateID, int version, unsigned char *buffer, size_t bufferSize, size_t *rootBlockLength) const
Encodes the given FIX message into a SBE stream.
std::string schemaHeaderType() const
The name of the encoding type of the message header, which is the same for all messages in a schema.
std::string schemaSemanticVersion() const
The semantic version of the SBE schema.
size_t encodeWithHeader(const OnixS::FIX::Message &fixMessage, int templateID, int version, unsigned char *buffer, size_t bufferSize, size_t *rootBlockLength) const
Encodes the given FIX message into a SBE stream and prepends the message header.
The library that contains user-defined SBE coders.