OnixS C++ SGX Titan ITCH Market Data Handler  1.2.2
API documentation
SecondsMsg.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 
25 
26 ONIXS_SGXTITAN_ITCH_NAMESPACE_BEGIN
27 
28  /// Sent every second for which at least one ITCH
29  /// message is being generated. The message contains
30  /// the number of seconds since the start of 1970 - 01
31  /// - 01 00:00 : 00 UTC, also called Unix Time.
32  struct ONIXS_SGXTITAN_ITCH_API SecondsMsg : public IncomingMessage
33  {
34  /// Number of seconds since since 1970-01-01 00:00:00
35  /// UTC.
36  UInt32 second() const
37  {
38  return ordinary<UInt32>(1);
39  }
40 
41  /// Total message size.
43 
44  /// Check the given size.
45  static void validateSize(MessageSize size)
46  {
47  if(size < messageSize_)
48  throwIncorrectSize("SecondsMsg", size, messageSize_);
49  }
50 
51  /// Initializes instance over given memory block.
52  SecondsMsg(const void* data, MessageSize size)
54  : IncomingMessage(data, size)
55  {
56  }
57  };
58 
59  /// Serializes object into string.
60  ONIXS_SGXTITAN_ITCH_API void toStr(std::string&, const SecondsMsg&);
61 
62  /// Serializes object into string.
63  inline std::string toStr(const SecondsMsg& msg)
64  {
65  std::string str;
66  toStr(str, msg);
67  return str;
68  }
69 
70  ///
71  inline std::ostream& operator<<(std::ostream& stream, const SecondsMsg& msg)
72  {
73  stream << toStr(msg);
74  return stream;
75  }
76 
77 ONIXS_SGXTITAN_ITCH_NAMESPACE_END
#define ONIXS_SGXTITAN_ITCH_CONST_OR_CONSTEXPR
Definition: Compiler.h:46
#define ONIXS_SGXTITAN_ITCH_NOTHROW
Definition: Compiler.h:27
IncomingMessage(const void *data, MessageSize size)
UInt16 MessageSize
Aliases message length type.
Definition: Defines.h:34
ONIXS_SGXTITAN_ITCH_API void toStr(std::string &, MessageType::Enum)
Appends string presentation of object.
ONIXS_SGXTITAN_ITCH_API std::ostream & operator<<(std::ostream &stream, const ServiceDescriptor &descriptor)
ONIXS_SGXTITAN_ITCH_API void throwIncorrectSize(const std::string &messageName, MessageSize receivedSize, MessageSize expectedSize)
static void validateSize(MessageSize size)
Check the given size.
Definition: SecondsMsg.h:45
SecondsMsg(const void *data, MessageSize size)
Initializes instance over given memory block.
Definition: SecondsMsg.h:52