OnixS C++ CME MDP Premium Market Data Handler 5.9.0
API Documentation
Loading...
Searching...
No Matches
Filtering.h
Go to the documentation of this file.
1// Copyright Onix Solutions Limited [OnixS]. All rights reserved.
2//
3// This software owned by Onix Solutions Limited [OnixS] and is
4// protected by copyright law and international copyright treaties.
5//
6// Access to and use of the software is governed by the terms of the applicable
7// OnixS Software Services Agreement (the Agreement) and Customer end user license
8// agreements granting a non-assignable, non-transferable and non-exclusive license
9// to use the software for it's own data processing purposes under the terms defined
10// in the Agreement.
11//
12// Except as otherwise granted within the terms of the Agreement, copying or
13// reproduction of any part of this source code or associated reference material
14// to any other location for further reproduction or redistribution, and any
15// amendments to this copyright notice, are expressly prohibited.
16//
17// Any reproduction or redistribution for sale or hiring of the Software not in
18// accordance with the terms of the Agreement is a violation of copyright law.
19//
20
21#pragma once
22
26
28
32{
33public:
37
41
45
49
52
56 : securityIds_(other.securityIds())
57 , securityGroups_(other.securityGroups())
58 , symbols_(other.symbols())
59 , assets_(other.assets_)
60 {
61 }
62
64 const SecurityIds& securityIds() const
65 {
66 return securityIds_;
67 }
68
71 {
72 return securityIds_;
73 }
74
77 {
78 return securityGroups_;
79 }
80
83 {
84 return securityGroups_;
85 }
86
88 const Symbols& symbols() const
89 {
90 return symbols_;
91 }
92
95 {
96 return symbols_;
97 }
98
100 const Assets& assets() const
101 {
102 return assets_;
103 }
104
107 {
108 return assets_;
109 }
110
112 void clear()
113 {
114 securityIds_.clear();
115 securityGroups_.clear();
116
117 symbols_.clear();
118 assets_.clear();
119 }
120
124 {
125 if (this != &other)
126 {
127 SecurityIds ids(other.securityIds());
128
129 SecurityGroups groups(other.securityGroups());
130
131 Symbols symbols(other.symbols());
132
133 Assets assets(other.assets());
134
135 //
136
137 securityIds_.swap(ids);
138 securityGroups_.swap(groups);
139
140 symbols_.swap(symbols);
141 assets_.swap(assets);
142 }
143
144 return *this;
145 }
146
147private:
148 SecurityIds securityIds_;
149 SecurityGroups securityGroups_;
150
151 Symbols symbols_;
152 Assets assets_;
153};
154
157void toStr(std::string&, const InstrumentSelection&);
158
160inline std::string toStr(const InstrumentSelection& selection)
161{
162 std::string str;
163
164 toStr(str, selection);
165
166 return str;
167}
168
169//
170
174{
175 return (ids.empty() || (ids.end() != ids.find(id)));
176}
177
180inline bool selected(const TinyStrSet& selection, const StrRef& value)
181{
182 return (value.empty() || selection.empty() || (selection.end() != selection.find(value)));
183}
184
187inline bool selected(const InstrumentSelection& selection, const Security& security)
188{
189 return (
190 selected(selection.securityIds(), security.id()) && selected(selection.securityGroups(), security.group())
191 && selected(selection.symbols(), security.symbol()) && selected(selection.assets(), security.asset())
192 );
193}
194
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition Bootstrap.h:67
#define ONIXS_CMEMDH_LTWT
Definition Bootstrap.h:46
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:68
#define ONIXS_CMEMDH_EXPORTED
Definition Compiler.h:171
Represents selection of instruments whose market data is to be processed by the Handler.
Definition Filtering.h:32
InstrumentSelection & operator=(const InstrumentSelection &other)
Re-initializes selection as copy of the other instance.
Definition Filtering.h:123
Assets & assets()
Securities selected by their assets.
Definition Filtering.h:106
const SecurityGroups & securityGroups() const
Securities selected by their groups.
Definition Filtering.h:76
InstrumentSelection()
Initializes empty selection.
Definition Filtering.h:51
SecurityGroups & securityGroups()
Securities selected by their groups.
Definition Filtering.h:82
const Symbols & symbols() const
Securities selected by their symbols.
Definition Filtering.h:88
TinyStrSet SecurityGroups
Collection of security groups specified for given instrument selection.
Definition Filtering.h:44
const Assets & assets() const
Securities selected by their assets.
Definition Filtering.h:100
SecurityIds & securityIds()
Securities selected by their identifiers.
Definition Filtering.h:70
Symbols & symbols()
Securities selected by their symbols.
Definition Filtering.h:94
TinySet< SecurityId > SecurityIds
Collection of security ids specified for given instrument selection.
Definition Filtering.h:36
TinyStrSet Assets
Collection of assets specified for given instrument selection.
Definition Filtering.h:48
void clear()
Clears selection.
Definition Filtering.h:112
TinyStrSet Symbols
Collection of symbols specified for given instrument selection.
Definition Filtering.h:40
InstrumentSelection(const InstrumentSelection &other)
Initializes selection as copy of the other instance.
Definition Filtering.h:55
const SecurityIds & securityIds() const
Securities selected by their identifiers.
Definition Filtering.h:64
Attributes associated with security.
Definition Security.h:30
StrRef asset() const
String field that indicates the underlying asset code (Product Code).
Definition Security.h:72
SecurityId id() const
Unique security identifier.
Definition Security.h:37
StrRef group() const
Security group code.
Definition Security.h:59
StrRef symbol() const
Security name or symbol.
Definition Security.h:43
Provides efficient way of accessing text-based values without copying content of the text being refer...
Definition String.h:42
Class implementing set optimized for storing small number of items.
Definition TinySet.h:35
bool empty() const
Indicates whether the set is empty.
Definition TinySet.h:67
ConstIterator end() const
Provides iterating facilities.
Definition TinySet.h:92
ConstIterator find(const Item &item) const
Tells whether the set contains given item.
Definition TinySet.h:98
Implements TinySet for StrRef class.
Definition TinySet.h:241
bool empty() const
Indicates whether the set is empty.
Definition TinySet.h:269
ConstIterator end() const
Provides iterating facilities.
Definition TinySet.h:294
ConstIterator find(const Item &item) const
Looks for the given item and returns iterator pointing to the found entry or to nowhere.
Definition TinySet.h:301
bool selected(const InstrumentSelection::SecurityIds &ids, SecurityId id)
Checks whether security with given identifier belongs to given selection.
Definition Filtering.h:173
void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.
Int32 SecurityId
Unique security identifier.
Definition Domain.h:31