OnixS C++ Fenics UST BIMP Market Data Handler  1.1.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 
26 
27 #include <string>
28 #include <ostream>
29 #include <set>
30 
31 
32 namespace OnixS
33 {
34  namespace FenicsUST
35  {
36  namespace MarketData
37  {
38  namespace Bimp
39  {
40  /// Data source
41  struct ONIXS_FENICSUST_BIMP_API DataSource
42  {
44  DataSource(const Timestamp& ts) : packetReceptionTime(ts) {}
45 
46  enum Origin
47  {
48  Multicast = 0,
49  Replay = 1,
50  Spin = 2
51  };
52 
53  /// Time when the packet was received by Handler from UDP, in system ticks, @see Time.h
55 
56  /// Message sequence number
58 
59  /// Number of message in packet
61 
62  /// Message sequence number
63  UInt64 messageSeqNum;
64 
65  /// the way data received
67 
68  /// The packet was cached due to incorrect sequence
69  bool cached;
70 
71  std::string toString () const;
72  };
73 
74  typedef UInt8 Integer1;
75  typedef UInt16 Integer2;
76  typedef UInt32 Integer4;
77  typedef UInt64 Integer8;
78 
79  typedef UInt8 SignedInteger1;
80  typedef UInt16 SignedInteger2;
81  typedef UInt32 SignedInteger4;
82  typedef UInt64 SignedInteger8;
83 
84  /// Alias for Sequence Number type.
85  typedef Integer8 SequenceNumber;
86 
87  /// Alias for Instrument Id type.
88  typedef Integer8 InstrumentId;
89 
90  /// Alias for Order Id type.
91  typedef Integer8 OrderId;
92 
93  /// Alias for Order Id type.
94  typedef SignedInteger8 Price;
95 
96  /// Alias for Quantity type.
97  typedef Integer8 Quantity;
98 
99  /// Aliases message length type.
100  typedef Integer2 MessageSize;
101 
102  typedef UInt8 BitField;
103 
104  ONIXS_FENICSUST_BIMP_API std::ostream& operator << (std::ostream& stream, const DataSource& ds);
105 
106  /// Zero-based index of CPU.
107  typedef size_t CpuIndex;
108 
109  /// Represents set of CPU indices.
110  class ONIXS_FENICSUST_BIMP_API ThreadAffinity
111  {
112  typedef std::set<CpuIndex> CpuIndexes;
113 
114  public:
115  /// Initializes empty set.
116  ThreadAffinity();
117 
118  /// Initializes as copy of other set.
120 
121  /// Utilizes all the resources.
122  ~ThreadAffinity();
123 
124  /// Indicates whether is empty.
125  bool empty() const;
126 
127  /// Copies set into another set.
128  void copyTo(CpuIndexes&) const;
129 
130  /// Adds CPU index into set.
131  bool insert(CpuIndex index);
132 
133  /// Removes CPU index from the set.
134  bool erase(CpuIndex index);
135 
136  /// Makes set empty.
137  void clear();
138 
139  /// Re-initializes instance as copy of other set.
140  ThreadAffinity& operator = (const ThreadAffinity&);
141 
142  /// Returns the string representation.
143  std::string toString() const;
144 
145  private:
146 
147  /// System index.
148  CpuIndexes* indices_;
149  };
150  }
151  }
152  }
153 }
UInt16 packetMessageCount
Message sequence number.
Definition: Defines.h:57
ONIXS_FENICSUST_BIMP_API std::ostream & operator<<(std::ostream &stream, const ServiceDescriptor &descriptor)
size_t CpuIndex
Zero-based index of CPU.
Definition: Defines.h:107
Timestamp packetReceptionTime
Time when the packet was received by Handler from UDP, in system ticks,.
Definition: Defines.h:54
Represents set of CPU indices.
Definition: Defines.h:110
Integer8 InstrumentId
Alias for Instrument Id type.
Definition: Defines.h:88
UInt8 packetMessageNumber
Number of message in packet.
Definition: Defines.h:60
Integer8 Quantity
Alias for Quantity type.
Definition: Defines.h:97
SignedInteger8 Price
Alias for Order Id type.
Definition: Defines.h:94
Integer8 SequenceNumber
Alias for Sequence Number type.
Definition: Defines.h:85
bool cached
The packet was cached due to incorrect sequence.
Definition: Defines.h:69
Integer2 MessageSize
Aliases message length type.
Definition: Defines.h:100
UInt64 messageSeqNum
Message sequence number.
Definition: Defines.h:63
Represents time point without time-zone information.
Definition: Time.h:482
Origin origin
the way data received
Definition: Defines.h:66
Integer8 OrderId
Alias for Order Id type.
Definition: Defines.h:91