OnixS C++ CME Streamlined Market Data Handler  1.0.0.4
API documentation
Security.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 
27 
28 /// Attributes associated with security.
30 {
31 public:
32  /// Unique security identifier.
33  ///
34  /// Security ID value will not be reused
35  /// until the next trade date following an
36  /// security expiration or deletion.
37  SecurityId id() const
38  {
39  return id_;
40  }
41 
42  /// Security name or symbol.
43  StrRef symbol() const
44  {
45  return toStrRef(symbol_);
46  }
47 
48  /// Updates security name or symbol.
49  void symbol(const StrRef& symbol)
50  {
51  symbol_.
52  assign(
53  symbol.items(),
54  symbol.size());
55  }
56 
57  /// Security group code.
58  ///
59  /// An exchange specific code assigned to
60  /// a group of related securities, which are
61  /// concurrently affected by market events.
62  StrRef group() const
63  {
64  return toStrRef(group_);
65  }
66 
67  /// Assigns security group code.
68  void group(const StrRef& group)
69  {
70  group_.
71  assign(
72  group.items(),
73  group.size());
74  }
75 
76  /// String field that indicates the
77  /// underlying asset code (Product Code).
78  StrRef asset() const
79  {
80  return toStrRef(asset_);
81  }
82 
83  /// Updates asset code.
84  void asset(const StrRef& asset)
85  {
86  asset_.
87  assign(
88  asset.items(),
89  asset.size());
90  }
91 
92  /// Security-level sequence number.
93  UInt32 seqNumber() const
94  {
95  return seqNumber_;
96  }
97 
98 protected:
99  /// Initializes instance.
101  SecurityId id)
102  : id_(id)
103  , seqNumber_(0)
104  {
105  }
106 
107  /// Cleans everything up.
109  {
110  }
111 
112  /// Updates sequence number.
113  void
115  UInt32 seqNumber)
116  {
117  seqNumber_ = seqNumber;
118  }
119 
120 private:
121  const SecurityId id_;
122 
123  UInt32 seqNumber_;
124 
125  std::string symbol_;
126  std::string group_;
127  std::string asset_;
128 
129  Security(
130  const Security&);
131 
132  Security&
133  operator =(
134  const Security&);
135 };
136 
137 /// Security brief info.
138 ONIXS_CMESTREAMLINEDMDH_EXPORTED
139 void
140 brief(
141  std::string&,
142  const Security&);
143 
144 /// Security brief info.
145 inline
146 std::string
148  const Security& security)
149 {
150  std::string str;
151 
152  brief(str, security);
153 
154  return str;
155 }
156 
157 /// Serializes security.
158 ONIXS_CMESTREAMLINEDMDH_EXPORTED
159 void
160 toStr(
161  std::string&,
162  const Security&);
163 
164 /// Serializes security.
165 inline
166 std::string
168  const Security& security)
169 {
170  std::string str;
171 
172  toStr(str, security);
173 
174  return str;
175 }
176 
StrRef toStrRef(const std::string &str)
Constructs StrRef instance over std::string content.
Definition: String.h:166
Security(SecurityId id)
Initializes instance.
Definition: Security.h:100
void group(const StrRef &group)
Assigns security group code.
Definition: Security.h:68
Attributes associated with security.
Definition: Security.h:29
StrRef symbol() const
Security name or symbol.
Definition: Security.h:43
UInt64 SecurityId
Unique security identifier.
Definition: Domain.h:31
std::string brief(const Security &security)
Security brief info.
Definition: Security.h:147
size_t size() const
Number of chars.
Definition: String.h:85
#define ONIXS_CMESTREAMLINEDMDH_NAMESPACE_END
Definition: Bootstrap.h:172
#define ONIXS_CMESTREAMLINEDMDH_LTWT_CLASS
Definition: Bootstrap.h:110
UInt32 seqNumber() const
Security-level sequence number.
Definition: Security.h:93
void asset(const StrRef &asset)
Updates asset code.
Definition: Security.h:84
std::string toStr(const Security &security)
Serializes security.
Definition: Security.h:167
void symbol(const StrRef &symbol)
Updates security name or symbol.
Definition: Security.h:49
const Char * items() const
Read-only content.
Definition: String.h:79
Provides efficient way of accessing text-based FIX field values.
Definition: String.h:39
void seqNumber(UInt32 seqNumber)
Updates sequence number.
Definition: Security.h:114
~Security()
Cleans everything up.
Definition: Security.h:108
UInt32 UInt32
uInt32.
Definition: Fields.h:183
#define ONIXS_CMESTREAMLINEDMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:168