OnixS C++ B3 Binary UMDF Market Data Handler  1.4.0
API documentation
Defines.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 
24 
25 #include <string>
26 #include <ostream>
27 #include <memory>
28 #include <set>
29 
30 namespace OnixS
31 {
32  namespace B3
33  {
34  namespace MarketData
35  {
36  namespace UMDF
37  {
38  typedef char Char;
39 
40  /// Alias for Packet Sequence Number type (PSN).
42 
43  /// Data source
44  struct ONIXS_B3_UMDF_MD_API DataSource
45  {
47  DataSource(const Timestamp& ts) : packetReceptionTime(ts) {}
48 
49  enum Origin
50  {
54  };
55 
56  /// Time when the packet was received by Handler from UDP, in system ticks, @see Time.h
58 
59  /// Channel identification.
61 
62  /// Packet Sequence Version.
63  /// For incremental stream, it starts with 1 at the rollout in the production
64  /// environment and incremented on weekly basis or in case of failover events.
65  /// For instrument definition and snapshot streams, its value changes for each new loop.
66  /// its value will be rolled back to 1 if incremented beyond 65534.
68 
69  /// Packet Sequence Number. Always incremented by one in the same channel and same SequenceVersion.
70  PacketSequenceNumber packetSequenceNumber;
71 
72  /// UTC date and time of packet transmission, in nanoseconds since Unix epoch (Jan 1st., 1970), with microsecond-level precision*.
74 
75  /// Number of message in the packet
77 
78  /// Indicates if the message is the last in the packet
80 
81  /// the way data received
83 
84  /// The packet was cached due to incorrect sequence
85  bool cached;
86 
87  std::string toString () const;
88  };
89 
90  ONIXS_B3_UMDF_MD_API std::ostream& operator << (std::ostream& stream, const DataSource& ds);
91 
92  namespace System
93  {
94  /// Zero-based index of CPU.
95  typedef size_t CpuIndex;
96 
97  /// Represents set of CPU indices.
98  class ONIXS_B3_UMDF_MD_API ThreadAffinity
99  {
100  typedef std::set<CpuIndex> CpuIndexes;
101 
102  public:
103  /// Initializes empty set.
104  ThreadAffinity();
105 
106  /// Initializes as copy of other set.
108 
109  /// Utilizes all the resources.
110  ~ThreadAffinity();
111 
112  /// Indicates whether is empty.
113  bool empty() const;
114 
115  /// Copies set into another set.
116  void copyTo(CpuIndexes&) const;
117 
118  /// Adds CPU index into set.
119  bool insert(CpuIndex index);
120 
121  /// Removes CPU index from the set.
122  bool erase(CpuIndex index);
123 
124  /// Makes set empty.
125  void clear();
126 
127  /// Re-initializes instance as copy of other set.
128  ThreadAffinity& operator = (const ThreadAffinity&);
129 
130  /// Returns the string representation.
131  std::string toString() const;
132 
133  private:
134 
135  /// System index.
136  CpuIndexes* indices_;
137  };
138  }
139  }
140  }
141  }
142 }
ONIXS_B3_UMDF_MD_API std::ostream & operator<<(std::ostream &stream, const LoggerSettings &settings)
Messaging::UInt64 UInt64
Definition: Integral.h:40
UInt8 packetMessageNumber
Number of message in the packet.
Definition: Defines.h:76
Messaging::UInt8 UInt8
Definition: Integral.h:31
Messaging::UInt16 UInt16
Definition: Integral.h:34
UInt64 sendingTime
UTC date and time of packet transmission, in nanoseconds since Unix epoch (Jan 1st., 1970), with microsecond-level precision*.
Definition: Defines.h:73
Messaging::UInt32 UInt32
Definition: Integral.h:37
Represents time point without time-zone information.
Definition: Time.h:482
bool lastMessage
Indicates if the message is the last in the packet.
Definition: Defines.h:79
size_t CpuIndex
Zero-based index of CPU.
Definition: Defines.h:95
DataSource(const Timestamp &ts)
Definition: Defines.h:47
Definition: Handler.h:29
UInt16 packetSequenceVersion
Packet Sequence Version.
Definition: Defines.h:67
Origin origin
the way data received
Definition: Defines.h:82
Timestamp packetReceptionTime
Time when the packet was received by Handler from UDP, in system ticks,.
Definition: Defines.h:57
UInt8 channelId
Channel identification.
Definition: Defines.h:60
Represents set of CPU indices.
Definition: Defines.h:98
PacketSequenceNumber packetSequenceNumber
Packet Sequence Number. Always incremented by one in the same channel and same SequenceVersion.
Definition: Defines.h:70
UInt32 PacketSequenceNumber
Alias for Packet Sequence Number type (PSN).
Definition: Defines.h:41
bool cached
The packet was cached due to incorrect sequence.
Definition: Defines.h:85