OnixS C++ CME Market Data Handler  5.7.0
API documentation
DirectPriceLevel.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 
24 
26 
27 /// Encapsulates price level concept.
30 : public ImpliedPriceLevel
31 {
32  // Number of orders.
33  Int32 ordersQty_;
34 
35 public:
36  /// Initializes undefined level.
38  : ordersQty_(0)
39  {
40  }
41 
42  /// Initializes as copy of other level.
44  const DirectPriceLevel& other)
46  static_cast
47  <const ImpliedPriceLevel&>
48  (other))
49  , ordersQty_(
50  other.ordersQty_)
51  {
52  }
53 
54  /// Initializes defined level
55  /// according to specified attributes.
57  const Decimal& price,
58  Int32 qty,
59  Int32 ordersQty)
60  : ImpliedPriceLevel(price, qty)
61  , ordersQty_(ordersQty)
62  {
63  }
64 
65  // Actually, does nothing.
67  {
68  }
69 
70  /// Updates total number of orders.
72  {
73  return ordersQty_;
74  }
75 
76  /// Total number of orders of given price.
78  {
79  return ordersQty_;
80  }
81 
82  /// Re-initializes as copy of other instance.
84  operator =(
85  const DirectPriceLevel& other)
86  {
87  *static_cast<ImpliedPriceLevel*>(this) =
88  static_cast<const ImpliedPriceLevel&>(other);
89 
90  ordersQty_ = other.ordersQty_;
91 
92  return *this;
93  }
94 };
95 
96 /// Serializes price level attributes into a string.
97 ONIXS_CMEMDH_EXPORTED
98 void
99 toStr(
100  std::string&,
101  const DirectPriceLevel&);
102 
103 /// Serializes price level attributes into a string.
104 inline
105 std::string
107  const DirectPriceLevel& priceLevel)
108 {
109  std::string str;
110 
111  toStr(str, priceLevel);
112 
113  return str;
114 }
115 
Encapsulates price level concept.
#define ONIXS_CMEMDH_LTWT_CLASS
Definition: Bootstrap.h:94
Int32 Int32
int32.
Definition: Fields.h:69
Int32 numberOfOrders() const
Total number of orders of given price.
Int32 & numberOfOrders()
Updates total number of orders.
Encapsulates price level concept.
A real number with floating exponent.
Definition: Decimal.h:231
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:152
DirectPriceLevel()
Initializes undefined level.
DirectPriceLevel(const DirectPriceLevel &other)
Initializes as copy of other level.
std::string toStr(const DirectPriceLevel &priceLevel)
Serializes price level attributes into a string.
DirectPriceLevel(const Decimal &price, Int32 qty, Int32 ordersQty)
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:156