OnixS C++ FIX Engine  4.10.1
API Documentation
SbeEventBasedDecoder.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 #include <limits>
25 
26 #include <OnixS/FIXEngine/ABI.h>
30 
31 namespace OnixS {
32 namespace FIX {
33 ONIXS_FIXENGINE_API_DECL(class, Message);
34 ONIXS_FIXENGINE_API_DECL(class, Dictionary);
35 
36 namespace SBE {
37 ONIXS_FIXENGINE_API_DECL(class, IDecodeListener);
38 
39 /// Performs the SBE to FIX decoding.
41 {
42 public:
43  /// Creates the SBE to FIX Decoder.
44  ///
45  /// @param xmlTemplates XML-based SBE templates.
46  /// @param customCoders The custom coders library.
47  EventBasedDecoder(const std::string & xmlTemplates, ISbeCustomCoderLibrary* customCoders = ONIXS_FIXENGINE_NULLPTR);
48 
49  /// Destructor.
51 
52  /// Tries to decode the given FAST stream buffer into the corresponding FIX Message.
53  ///
54  /// @param[in] templateId The identifier of the SBE template, used to decode the input data.
55  /// @param[in] version The version of the SBE schema, used to decode the input data.
56  /// @param[in] rootBlockLength The length of the root block. This value should be extracted from the message preamble, or from other source.
57  /// @param[in] buffer The FAST stream chunk to be decoded.
58  /// @param[in] offset The index in the buffer at which decoding begins.
59  /// @param[in] count The number of bytes to analyze during the decoding.
60  /// @param[in] listener The listener which receives decoding events.
61  /// @param[out] numberOfDecodedBytes The number of bytes that contained the encoded FIX Message.
62  ///
63  /// @warning The message should point to an existing object. This object is not owned by the Decoder and should be managed by the user.
64  ///
65  /// @throw An exception if the decoding error is detected.
66  ///
67  /// @return 'true' if the given bytes could be decoded into a FIX message, otherwise - 'false'.
68  bool decodeSingleMessage(int version, int templateId, size_t rootBlockLength,
69  const unsigned char * buffer, size_t offset, size_t count, IDecodeListener * listener,
70  size_t * numberOfDecodedBytes) const;
71 
72  /// The maximum known version of the SBE schema.
73  unsigned schemaVersion() const;
74 
75  /// The schema identifier.
76  unsigned schemaId() const;
77 
78  /// The semantic version of the SBE schema.
79  std::string schemaSemanticVersion() const;
80 
81  /// The name of the encoding type of the message header, which is
82  /// the same for all messages in a schema.
83  std::string schemaHeaderType() const;
84 private:
86 
88  EventBasedDecoder & operator = (const EventBasedDecoder &);
89 
90  struct Impl;
91  Impl * impl_;
92 };
93 
94 }
95 }
96 }
The library that contains user-defined SBE coders.
Performs the SBE to FIX decoding.
#define ONIXS_FIXENGINE_API
Definition: ABI.h:45
The SBE decode session&#39;s listener.
Identifies the FIX messages dictionary.
Definition: Dictionary.h:73
ONIXS_FIXENGINE_API_DECL(class, IEngineListener)
ONIXS_FIXENGINE_API_DECL(class, IDecodeListener)