OnixS C++ CME MDP Premium Market Data Handler  5.8.9
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.
29 {
30 public:
31  /// Initializes undefined level.
33  : ordersQty_(0)
34  {
35  }
36 
37  /// Initializes as copy of other level.
39  : ImpliedPriceLevel(static_cast<const ImpliedPriceLevel&>(other))
40  , ordersQty_(other.ordersQty_)
41  {
42  }
43 
44  /// Initializes defined level
45  /// according to specified attributes.
46  DirectPriceLevel(const Decimal& price, Int32 qty, Int32 ordersQty)
47  : ImpliedPriceLevel(price, qty)
48  , ordersQty_(ordersQty)
49  {
50  }
51 
52  // Actually, does nothing.
54 
55  /// Updates total number of orders.
57  {
58  return ordersQty_;
59  }
60 
61  /// Total number of orders of given price.
63  {
64  return ordersQty_;
65  }
66 
67  /// Re-initializes as copy of other instance.
69  {
70  *static_cast<ImpliedPriceLevel*>(this) = static_cast<const ImpliedPriceLevel&>(other);
71 
72  ordersQty_ = other.ordersQty_;
73 
74  return *this;
75  }
76 
77 private:
78  // Number of orders.
79  Int32 ordersQty_;
80 };
81 
82 /// Serializes price level attributes into a string.
84 void toStr(std::string&, const DirectPriceLevel&);
85 
86 /// Serializes price level attributes into a string.
87 inline std::string toStr(const DirectPriceLevel& priceLevel)
88 {
89  std::string str;
90 
91  toStr(str, priceLevel);
92 
93  return str;
94 }
95 
Encapsulates price level concept.
Int32 Int32
int32.
Definition: Fields.h:60
Int32 numberOfOrders() const
Total number of orders of given price.
Int32 & numberOfOrders()
Updates total number of orders.
#define ONIXS_CMEMDH_LTWT
Definition: Bootstrap.h:46
Encapsulates price level concept.
A real number with floating exponent.
Definition: Decimal.h:136
#define ONIXS_CMEMDH_NAMESPACE_BEGIN
Definition: Bootstrap.h:67
DirectPriceLevel & operator=(const DirectPriceLevel &other)
Re-initializes as copy of other instance.
DirectPriceLevel()
Initializes undefined level.
#define ONIXS_CMEMDH_EXPORTED
Definition: Compiler.h:160
DirectPriceLevel(const DirectPriceLevel &other)
Initializes as copy of other level.
DirectPriceLevel(const Decimal &price, Int32 qty, Int32 ordersQty)
Initializes defined level according to specified attributes.
void toStr(std::string &, BookState::Enum)
Serializes book state value into a string.
#define ONIXS_CMEMDH_NAMESPACE_END
Definition: Bootstrap.h:68