OnixS C++ SGX Titan ITCH Market Data Handler  1.2.2
API documentation
GlimpseService.Messages.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 #pragma once
21 
22 #include <util/TextBuilder.h>
23 #include <util/Converter.h>
24 
26 
27 #include "NamespaceHelper.h"
28 
29 ONIXS_HANDLER_NAMESPACE_BEGIN
30 
31 ///Glimpse message type enumeration
33 {
34  enum Enum
35  {
36  EndOfSnapshot = 'G',
37  };
38 };
39 
41 {
42  EndOfSnapshotMsg(const unsigned char* data, UInt16 length) : IncomingMessage(data, length) {}
43 
44  /// Human readable long name of Instrument series
45  UInt64 sequenceNumber() const
46  {
47  const unsigned int size = 20;
48  const unsigned int offset = 1;
49 
50  return OnixS::Util::str2ui64(fixedStr<size>(offset).items(), size);
51  }
52 
53  /// Total message size.
55 
56  static void validateSize(MessageSize size)
57  {
58  if(size < messageSize_)
59  throwIncorrectSize("EndOfSnapshotMsg", size, messageSize_);
60  }
61 };
62 
63 /// Serializes object into string.
64 void toStr(std::string&, const EndOfSnapshotMsg&);
65 
66 /// Serializes object into string.
67 inline std::string toStr(const EndOfSnapshotMsg& msg)
68 {
69  std::string str;
70  toStr(str, msg);
71  return str;
72 }
73 
74 inline
75 Util::TextBuilder& operator<<(Util::TextBuilder& tb, const EndOfSnapshotMsg& msg)
76 {
77  return tb << toStr(msg);
78 }
79 
80 ONIXS_HANDLER_NAMESPACE_END
#define ONIXS_SGXTITAN_ITCH_CONST_OR_CONSTEXPR
Definition: Compiler.h:46
Util::TextBuilder & operator<<(Util::TextBuilder &tb, const EndOfSnapshotMsg &msg)
EndOfSnapshotMsg(const unsigned char *data, UInt16 length)
UInt64 sequenceNumber() const
Human readable long name of Instrument series.
UInt16 MessageSize
Aliases message length type.
Definition: Defines.h:34
std::string toStr(const EndOfSnapshotMsg &msg)
Serializes object into string.
ONIXS_SGXTITAN_ITCH_API void throwIncorrectSize(const std::string &messageName, MessageSize receivedSize, MessageSize expectedSize)