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