OnixS C++ Euronext Optiq MDG Handler  1.3.1
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 Euronext
33  {
34  namespace MarketData
35  {
36  namespace OptiqMdg
37  {
38  typedef char Char;
39 
40  /// Alias for Packet Sequence Number type (PSN).
42 
43  /// Alias for Message Sequence Number type (Market Data Sequence Number, MDSN).
45 
46  /// Data source
47  struct ONIXS_EURONEXT_OPTIQMDG_API DataSource
48  {
50  DataSource(const Timestamp& ts) : packetReceptionTime(ts) {}
51 
52  enum Origin
53  {
54  Multicast = 0,
55  Replay = 1,
56  Spin = 2
57  };
58 
59  /// Time when the packet was received by Handler from UDP, in system ticks, @see Time.h
61 
62  /// Exchange sending time (number of nanoseconds since 01/01/1970 UTC).
64 
65  /// Packet Sequence Number
66  PacketSequenceNumber psn;
67 
68  /// Number of message in packet
70 
71  /// the way data received
73 
74  /// The packet was cached due to incorrect sequence
75  bool cached;
76 
77  std::string toString () const;
78  };
79 
80  ONIXS_EURONEXT_OPTIQMDG_API std::ostream& operator << (std::ostream& stream, const DataSource& ds);
81 
82  /// Zero-based index of CPU.
83  typedef size_t CpuIndex;
84 
85  /// Represents set of CPU indices.
86  class ONIXS_EURONEXT_OPTIQMDG_API ThreadAffinity
87  {
88  typedef std::set<CpuIndex> CpuIndexes;
89 
90  public:
91  /// Initializes empty set.
93 
94  /// Initializes as copy of other set.
96 
97  /// Utilizes all the resources.
98  ~ThreadAffinity();
99 
100  /// Indicates whether is empty.
101  bool empty() const;
102 
103  /// Copies set into another set.
104  void copyTo(CpuIndexes&) const;
105 
106  /// Adds CPU index into set.
107  bool insert(CpuIndex index);
108 
109  /// Removes CPU index from the set.
110  bool erase(CpuIndex index);
111 
112  /// Makes set empty.
113  void clear();
114 
115  /// Re-initializes instance as copy of other set.
116  ThreadAffinity& operator = (const ThreadAffinity&);
117 
118  /// Returns the string representation.
119  std::string toString() const;
120 
121  private:
122 
123  /// System index.
124  CpuIndexes* indices_;
125  };
126  }
127  }
128  }
129 }
UInt8 packetMessageNumber
Number of message in packet.
Definition: Defines.h:69
Origin origin
the way data received
Definition: Defines.h:72
Represents time point without time-zone information.
Definition: Time.h:482
UInt64 sendingTime
Exchange sending time (number of nanoseconds since 01/01/1970 UTC).
Definition: Defines.h:63
Definition: Handler.h:26
UInt64 MessageSequenceNumber
Alias for Message Sequence Number type (Market Data Sequence Number, MDSN).
Definition: Defines.h:44
PacketSequenceNumber psn
Packet Sequence Number.
Definition: Defines.h:66
UInt64 PacketSequenceNumber
Alias for Packet Sequence Number type (PSN).
Definition: Defines.h:41
Timestamp packetReceptionTime
Time when the packet was received by Handler from UDP, in system ticks,.
Definition: Defines.h:60
ONIXS_EURONEXT_OPTIQMDG_API std::ostream & operator<<(std::ostream &stream, const ServiceDescriptor &descriptor)
size_t CpuIndex
Zero-based index of CPU.
Definition: Defines.h:83
bool cached
The packet was cached due to incorrect sequence.
Definition: Defines.h:75