OnixS C++ FIX Engine  4.2.0
API Documentation
IDecodeListener.h
Go to the documentation of this file.
1 /*
2 * Copyright Onix Solutions Limited [OnixS]. All rights reserved.
3 *
4 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law
5 * and international copyright treaties.
6 *
7 * Access to and use of the software is governed by the terms of the applicable ONIXS Software
8 * Services Agreement (the Agreement) and Customer end user license agreements granting
9 * a non-assignable, non-transferable and non-exclusive license to use the software
10 * for it's own data processing purposes under the terms defined in the Agreement.
11 *
12 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part
13 * of this source code or associated reference material to any other location for further reproduction
14 * or redistribution, and any amendments to this copyright notice, are expressly prohibited.
15 *
16 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with
17 * the terms of the Agreement is a violation of copyright law.
18 */
19 
20 #if !defined(__ONIXS_IDECODELISTENER_H__)
21 #define __ONIXS_IDECODELISTENER_H__
22 
23 #include <cstddef>
24 
25 #include <OnixS/FIXEngine/ABI.h>
26 
27 namespace OnixS {
28 namespace FIX {
29 namespace FAST {
30 /// Decode session's listener.
31 /// This interface declares set of methods called by EventBasedDecoder during decoding process.
33 {
34 public:
35  /// @note FIX Engine does NOT manage the lifetime of this listener.
36  virtual ~IDecodeListener() {}
37 
38  /// @name Entire message events
39  /// These events belongs to entire message. Events occur single time per message.
40 
41  /// @{
42  /// Called when a new FAST-encoded message found in input data.
43  ///
44  /// @param templateId Identifier of FAST template belonged to the message.
45  /// @param messageType FIX type of the message.
46  /// @param messageTypeLength Length of the messageType string. Doe not include terminating zero.
47  virtual void onBeginMessage(unsigned templateId, const char * messageType,
48  size_t messageTypeLength) = 0;
49 
50  /// Called when decoder finishes current message decoding.
51  /// @note It is possible to reset caller decoder during this callback.
52  virtual void onEndMessage() = 0;
53  /// @}
54 
55  /// @name Data field events
56  /// These events denotes that particular fields were decoded. Events occurs once per field.
57 
58  /// @{
59  /// Called when signed 32-bit integer field decoded.
60  ///
61  /// @param tag FIX tag of the field.
62  /// @param value Decoded value.
63  virtual void onValue(int tag, int value) = 0;
64 
65  /// Called when unsigned 32-bit integer field decoded.
66  ///
67  /// @param tag FIX tag of the field.
68  /// @param value Decoded value.
69  virtual void onValue(int tag, unsigned value) = 0;
70 
71  /// Called when signed 64-bit integer field decoded.
72  ///
73  /// @param tag FIX tag of the field.
74  /// @param value Decoded value.
75  virtual void onValue(int tag, long long value) = 0;
76 
77  /// Called when unsigned 64-bit integer field decoded.
78  ///
79  /// @param tag FIX tag of the field.
80  /// @param value Decoded value.
81  virtual void onValue(int tag, unsigned long long value) = 0;
82 
83  /// Called when decimal field decoded.
84  ///
85  /// @param tag FIX tag of the field.
86  /// @param mantissa Mantissa of the decoded decimal value.
87  /// @param exponent Exponent of the decoded decimal value (in range of -64..63).
88  virtual void onValue(int tag, long long mantissa, int exponent) = 0;
89 
90  /// Called when a string (ASCII or Unicode) or byteVector decoded.
91  ///
92  /// @param tag FIX tag of the field.
93  /// @param value Pointer to start of decoded data.
94  /// @param valueLength Length of decoded data (does not include terminating zero for &lt;string&gt; fields).
95  virtual void onValue(int tag, const char * value, size_t valueLength) = 0;
96  /// @}
97 
98  /// @name Sequence events
99  /// These callbacks embraces sequence decoding. Each callback called once per sequence unless the sequence is empty.
100 
101  /// @{
102  /// Called just before first entry of the sequence decoding.
103  ///
104  /// @param tag Tag of the sequence
105  /// @param itemCount Number of entries in the sequence.
106  /// @param lengthFieldTag Tag of the &lt;length&gt; field.
107  virtual void onBeginSequence(int tag, size_t itemCount, int lengthFieldTag) = 0;
108 
109  /// Called immediately after the last sequence entry decoded.
110  virtual void onEndSequence() = 0;
111  /// @}
112 
113  /// @name Sequence entry events
114  /// These callbacks embraces sequence entry decoding. Each callback called once per sequence entry.
115 
116  /// @{
117  /// Called just before sequence entry decoding.
118  /// @param index Index of the entry.
119  virtual void onBeginSequenceEntry(size_t index) = 0;
120 
121  /// Called after the entry was decoded.
122  virtual void onEndSequenceEntry() = 0;
123  /// @}
124 
125  /// @name Field group events
126  /// These callbacks embraces group decoding. Each callback called once per group unless the is empty.
127 
128  /// @{
129  /// Fired before first field of the group will be searched in input data.
130  /// @param tag Tag of the group.
131  virtual void onBeginGroup(int tag) = 0;
132  /// Fired after last field of the group decoded.
133  virtual void onEndGroup() = 0;
134  /// @}
135 };
136 }
137 }
138 }
139 
140 #endif // __ONIXS_IDECODELISTENER_H__
Decode session&#39;s listener.
#define ONIXS_FIXENGINE_API
Definition: ABI.h:45