OnixS C++ CME MDP Premium Market Data Handler  5.8.3
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 
23 #include <OnixS/CME/MDH/String.h>
24 #include <OnixS/CME/MDH/Domain.h>
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_.assign(symbol.items(), symbol.size());
52  }
53 
54  /// Security group code.
55  ///
56  /// An exchange specific code assigned to
57  /// a group of related securities, which are
58  /// concurrently affected by market events.
59  StrRef group() const
60  {
61  return toStrRef(group_);
62  }
63 
64  /// Assigns security group code.
65  void group(const StrRef& group)
66  {
67  group_.assign(group.items(), group.size());
68  }
69 
70  /// String field that indicates the
71  /// underlying asset code (Product Code).
72  StrRef asset() const
73  {
74  return toStrRef(asset_);
75  }
76 
77  /// Updates asset code.
78  void asset(const StrRef& asset)
79  {
80  asset_.assign(asset.items(), asset.size());
81  }
82 
83  /// Security-level sequence number.
84  UInt32 seqNumber() const
85  {
86  return seqNumber_;
87  }
88 
89  /// User-defined data to be attached.
90  typedef UInt64 UserData;
91 
92  /// User-defined data.
93  UserData userData() const
94  {
95  return userData_;
96  }
97 
98 protected:
99  /// Initializes instance.
101  : id_(id)
102  , seqNumber_(0)
103  , userData_(0)
104  {
105  }
106 
107  /// Cleans everything up.
109 
110  /// Updates sequence number.
111  void seqNumber(UInt32 seqNumber)
112  {
113  seqNumber_ = seqNumber;
114  }
115 
116  /// Sets user-defined data.
117  void userData(UserData data)
118  {
119  userData_ = data;
120  }
121 
122 private:
123  const SecurityId id_;
124 
125  UInt32 seqNumber_;
126 
127  std::string symbol_;
128  std::string group_;
129  std::string asset_;
130 
131  UserData userData_;
132 
133  Security(const Security&);
134 
135  Security& operator=(const Security&);
136 };
137 
138 /// Security brief info.
140 void brief(std::string&, const Security&);
141 
142 /// Security brief info.
143 inline std::string brief(const Security& security)
144 {
145  std::string str;
146 
147  brief(str, security);
148 
149  return str;
150 }
151 
152 /// Serializes security.
154 void toStr(std::string&, const Security&);
155 
156 /// Serializes security.
157 inline std::string toStr(const Security& security)
158 {
159  std::string str;
160 
161  toStr(str, security);
162 
163  return str;
164 }
165 
void userData(UserData data)
Sets user-defined data.
Definition: Security.h:117
std::string toStr(const Security &security)
Serializes security.
Definition: Security.h:157
StrRef symbol() const
Security name or symbol.
Definition: Security.h:43
~Security()
Cleans everything up.
Definition: Security.h:108
UInt32 UInt32
uInt32.
Definition: Fields.h:192
StrRef asset(const MultiContainer &message)
Retrieves asset field value assuming the given message represents a security definition.
Definition: Accessors.h:75
StrRef group() const
Security group code.
Definition: Security.h:59
void asset(const StrRef &asset)
Updates asset code.
Definition: Security.h:78
StrRef symbol(const MultiContainer &message)
Retrieves symbol field value assuming the given message represents a security definition.
Definition: Accessors.h:66
Int32 SecurityId
Unique security identifier.
Definition: Domain.h:31
UserData userData() const
User-defined data.
Definition: Security.h:93
Security(SecurityId id)
Initializes instance.
Definition: Security.h:100
std::string brief(const Security &security)
Security brief info.
Definition: Security.h:143
#define ONIXS_CMEMDH_LTWT
Definition: Bootstrap.h:46
SecurityId id() const
Unique security identifier.
Definition: Security.h:37
StrRef asset() const
String field that indicates the underlying asset code (Product Code).
Definition: Security.h:72
UInt64 UInt64
uInt64.
Definition: Fields.h:195
void group(const StrRef &group)
Assigns security group code.
Definition: Security.h:65
const Char * items() const
Read-only content.
Definition: String.h:77
Provides efficient way of accessing text-based values without copying content of the text being refer...
Definition: String.h:41
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:67
void symbol(const StrRef &symbol)
Updates security name or symbol.
Definition: Security.h:49
Attributes associated with security.
Definition: Security.h:29
#define ONIXS_CMEMDH_EXPORTED
Definition: Compiler.h:135
StrRef toStrRef(const std::string &str)
Constructs StrRef instance over std::string content.
Definition: String.h:155
void seqNumber(UInt32 seqNumber)
Updates sequence number.
Definition: Security.h:111
UInt64 UserData
User-defined data to be attached.
Definition: Security.h:90
size_t size() const
Number of chars.
Definition: String.h:83
UInt32 seqNumber() const
Security-level sequence number.
Definition: Security.h:84
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:68