OnixS C++ CME MDP Premium Market Data Handler 5.10.2
Users' manual and 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
25
28
30
34{
35public:
39
43
47
51
54
58 : securityIds_(other.securityIds())
59 , securityGroups_(other.securityGroups())
60 , symbols_(other.symbols())
61 , assets_(other.assets_)
62 {
63 }
64
66 const SecurityIds& securityIds() const
67 {
68 return securityIds_;
69 }
70
73 {
74 return securityIds_;
75 }
76
79 {
80 return securityGroups_;
81 }
82
85 {
86 return securityGroups_;
87 }
88
90 const Symbols& symbols() const
91 {
92 return symbols_;
93 }
94
97 {
98 return symbols_;
99 }
100
102 const Assets& assets() const
103 {
104 return assets_;
105 }
106
109 {
110 return assets_;
111 }
112
114 void clear()
115 {
116 securityIds_.clear();
117 securityGroups_.clear();
118
119 symbols_.clear();
120 assets_.clear();
121 }
122
126 {
127 if (this != &other)
128 {
129 SecurityIds ids(other.securityIds());
130
131 SecurityGroups groups(other.securityGroups());
132
133 Symbols symbols(other.symbols());
134
135 Assets assets(other.assets());
136
137 //
138
139 securityIds_.swap(ids);
140 securityGroups_.swap(groups);
141
142 symbols_.swap(symbols);
143 assets_.swap(assets);
144 }
145
146 return *this;
147 }
148
149private:
150 SecurityIds securityIds_;
151 SecurityGroups securityGroups_;
152
153 Symbols symbols_;
154 Assets assets_;
155};
156
159void toStr(std::string&, const InstrumentSelection&);
160
162inline std::string toStr(const InstrumentSelection& selection)
163{
164 std::string str;
165
166 toStr(str, selection);
167
168 return str;
169}
170
174{
175 return (ids.empty() || (ids.end() != ids.find(id)));
176}
177
180inline bool selected(const TinyStrSet& selection, Messaging::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:54
#define ONIXS_CMEMDH_LTWT
Definition Bootstrap.h:46
#define ONIXS_CMEMDH_NAMESPACE_END
Definition Bootstrap.h:55
#define ONIXS_CMEMDH_EXPORTED
Definition Compiler.h:148
InstrumentSelection & operator=(const InstrumentSelection &other)
Definition Filtering.h:125
Assets & assets()
Securities selected by their assets.
Definition Filtering.h:108
const SecurityGroups & securityGroups() const
Securities selected by their groups.
Definition Filtering.h:78
InstrumentSelection()
Initializes empty selection.
Definition Filtering.h:53
SecurityGroups & securityGroups()
Securities selected by their groups.
Definition Filtering.h:84
const Symbols & symbols() const
Securities selected by their symbols.
Definition Filtering.h:90
const Assets & assets() const
Securities selected by their assets.
Definition Filtering.h:102
SecurityIds & securityIds()
Securities selected by their identifiers.
Definition Filtering.h:72
Symbols & symbols()
Securities selected by their symbols.
Definition Filtering.h:96
TinySet< SecurityId > SecurityIds
Definition Filtering.h:38
void clear()
Clears selection.
Definition Filtering.h:114
InstrumentSelection(const InstrumentSelection &other)
Definition Filtering.h:57
const SecurityIds & securityIds() const
Securities selected by their identifiers.
Definition Filtering.h:66
Attributes associated with security.
Definition Security.h:31
Messaging::StrRef asset() const
Definition Security.h:73
SecurityId id() const
Definition Security.h:38
Messaging::StrRef group() const
Definition Security.h:60
Messaging::StrRef symbol() const
Security name or symbol.
Definition Security.h:44
bool empty() const
Indicates whether the set is empty.
Definition TinySet.h:68
ConstIterator end() const
Provides iterating facilities.
Definition TinySet.h:93
ConstIterator find(const Item &item) const
Tells whether the set contains given item.
Definition TinySet.h:99
bool empty() const
Indicates whether the set is empty.
Definition TinySet.h:270
ConstIterator end() const
Provides iterating facilities.
Definition TinySet.h:295
ConstIterator find(const Item &item) const
Definition TinySet.h:302
std::basic_string_view< Char > StrRef
Definition StrRef.h:46
Messaging::Int32 SecurityId
Unique security identifier.
Definition Domain.h:31
bool selected(const InstrumentSelection::SecurityIds &ids, SecurityId id)
Definition Filtering.h:173
void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.