OnixS C++ FIX Engine  4.7.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>
27 
28 namespace OnixS {
29 namespace FIX {
30 namespace FAST {
31 /// Decode session's listener.
32 /// This interface declares set of methods called by EventBasedDecoder during decoding process.
34 {
35 public:
36  /// @note FIX Engine does NOT manage the lifetime of this listener.
38 
39  /// @name Entire message events
40  /// These events belongs to entire message. Events occur single time per message.
41 
42  /// @{
43  /// Called when a new FAST-encoded message found in input data.
44  ///
45  /// @param templateId Identifier of FAST template belonged to the message.
46  /// @param messageType FIX type of the message.
47  /// @param messageTypeLength Length of the messageType string. Doe not include terminating zero.
48  virtual void onBeginMessage(unsigned templateId, const char * messageType,
49  size_t messageTypeLength) = 0;
50 
51  /// Called when decoder finishes current message decoding.
52  /// @note It is possible to reset caller decoder during this callback.
53  virtual void onEndMessage() = 0;
54  /// @}
55 
56  /// @name Data field events
57  /// These events denotes that particular fields were decoded. Events occurs once per field.
58 
59  /// @{
60  /// Called when signed 32-bit integer field decoded.
61  ///
62  /// @param tag FIX tag of the field.
63  /// @param value Decoded value.
64  virtual void onValue(int tag, int value) = 0;
65 
66  /// Called when unsigned 32-bit integer field decoded.
67  ///
68  /// @param tag FIX tag of the field.
69  /// @param value Decoded value.
70  virtual void onValue(int tag, unsigned value) = 0;
71 
72  /// Called when signed 64-bit integer field decoded.
73  ///
74  /// @param tag FIX tag of the field.
75  /// @param value Decoded value.
76  virtual void onValue(int tag, long long value) = 0;
77 
78  /// Called when unsigned 64-bit integer field decoded.
79  ///
80  /// @param tag FIX tag of the field.
81  /// @param value Decoded value.
82  virtual void onValue(int tag, unsigned long long value) = 0;
83 
84  /// Called when decimal field decoded.
85  ///
86  /// @param tag FIX tag of the field.
87  /// @param mantissa Mantissa of the decoded decimal value.
88  /// @param exponent Exponent of the decoded decimal value (in range of -64..63).
89  virtual void onValue(int tag, long long mantissa, int exponent) = 0;
90 
91  /// Called when a string (ASCII or Unicode) or byteVector decoded.
92  ///
93  /// @param tag FIX tag of the field.
94  /// @param value Pointer to start of decoded data.
95  /// @param valueLength Length of decoded data (does not include terminating zero for &lt;string&gt; fields).
96  virtual void onValue(int tag, const char * value, size_t valueLength) = 0;
97  /// @}
98 
99  /// @name Sequence events
100  /// These callbacks embraces sequence decoding. Each callback called once per sequence unless the sequence is empty.
101 
102  /// @{
103  /// Called just before first entry of the sequence decoding.
104  ///
105  /// @param tag Tag of the sequence
106  /// @param itemCount Number of entries in the sequence.
107  /// @param lengthFieldTag Tag of the &lt;length&gt; field.
108  virtual void onBeginSequence(int tag, size_t itemCount, int lengthFieldTag) = 0;
109 
110  /// Called immediately after the last sequence entry decoded.
111  virtual void onEndSequence() = 0;
112  /// @}
113 
114  /// @name Sequence entry events
115  /// These callbacks embraces sequence entry decoding. Each callback called once per sequence entry.
116 
117  /// @{
118  /// Called just before sequence entry decoding.
119  /// @param index Index of the entry.
120  virtual void onBeginSequenceEntry(size_t index) = 0;
121 
122  /// Called after the entry was decoded.
123  virtual void onEndSequenceEntry() = 0;
124  /// @}
125 
126  /// @name Field group events
127  /// These callbacks embraces group decoding. Each callback called once per group unless the is empty.
128 
129  /// @{
130  /// Fired before first field of the group will be searched in input data.
131  /// @param tag Tag of the group.
132  virtual void onBeginGroup(int tag) = 0;
133  /// Fired after last field of the group decoded.
134  virtual void onEndGroup() = 0;
135  /// @}
136 };
137 }
138 }
139 }
140 
141 #endif // __ONIXS_IDECODELISTENER_H__
#define ONIXS_FIXENGINE_DEFAULT
Definition: Compiler.h:176
#define ONIXS_FIXENGINE_API
Definition: ABI.h:45
Decode session&#39;s listener.