OnixS C++ FIX Engine  4.2.0
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 
25 #include <OnixS/FIXEngine/ABI.h>
28 #include <OnixS/FIXEngine/FIX/InputDataTraits.h>
29 #include <OnixS/FIXEngine/Sockets/Definitions.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 SBE to FIX decoding.
41 {
42 public:
43  /// Creates SBE to FIX Decoder.
44  ///
45  /// @param xmlTemplates XML-based SBE templates.
46  EventBasedDecoder(const std::string & xmlTemplates);
47 
48  /// Destructor.
50 
51  /// Tries to decode the given FAST stream buffer into the corresponding FIX Message.
52  ///
53  /// @param[in] templateId Identifier of the SBE template, used to decode the input data.
54  /// @param[in] version Version of the SBE schema, used to decode the input data.
55  /// @param[in] rootBlockLength Length of the root block. This value should be extracted from the message preamble, or from other source.
56  /// @param[in] buffer The FAST stream chunk to be decoded.
57  /// @param[in] offset The index in the buffer at which decoding begins.
58  /// @param[in] count Number of bytes to analyze during the decoding.
59  /// @param[in] listener Listener which receives decoding events.
60  /// @param[out] numberOfDecodedBytes Number of bytes that contained the encoded FIX Message.
61  ///
62  /// @warning message should point to an existing object. This object is not owned by Decoder and should be managed by user.
63  ///
64  /// @throw Exception if the decoding error is detected.
65  ///
66  /// @return 'true' if the given bytes could be decoded into a FIX message, otherwise - 'false'.
67  bool decodeSingleMessage(int version, int templateId, size_t rootBlockLength,
68  const unsigned char * buffer, size_t offset, size_t count, IDecodeListener * listener,
69  size_t * numberOfDecodedBytes) const;
70 
71  /// Maximum known version of the SBE schema.
72  unsigned schemaVersion() const;
73 
74  /// Schema identifier.
75  unsigned schemaId() const;
76 
77  /// Semantic version of the SBE schema.
78  std::string schemaSemanticVersion() const;
79 
80  /// Name of the encoding type of the message header, which is
81  /// the same for all messages in a schema.
82  std::string schemaHeaderType() const;
83 private:
85 
87  EventBasedDecoder & operator = (const EventBasedDecoder &);
88 
89  struct Impl;
90  Impl * impl_;
91 };
92 
93 }
94 }
95 }
SBE decode session&#39;s listener.
Identifies FIX messages dictionary.
Definition: Dictionary.h:79
ONIXS_FIXENGINE_API_DECL(class, IEngineListener)
#define ONIXS_FIXENGINE_API
Definition: ABI.h:45
Performs SBE to FIX decoding.
ONIXS_FIXENGINE_API_DECL(class, IDecodeListener)