Files
externals/linux/include/OnixS/CME/MDH/DirectPriceLevel.h

117 lines
2.8 KiB
C++

// Copyright Onix Solutions Limited [OnixS]. All rights reserved.
//
// This software owned by Onix Solutions Limited [OnixS] and is
// protected by copyright law and international copyright treaties.
//
// Access to and use of the software is governed by the terms of the applicable
// OnixS Software Services Agreement (the Agreement) and Customer end user license
// agreements granting a non-assignable, non-transferable and non-exclusive license
// to use the software for it's own data processing purposes under the terms defined
// in the Agreement.
//
// Except as otherwise granted within the terms of the Agreement, copying or
// reproduction of any part of this source code or associated reference material
// to any other location for further reproduction or redistribution, and any
// amendments to this copyright notice, are expressly prohibited.
//
// Any reproduction or redistribution for sale or hiring of the Software not in
// accordance with the terms of the Agreement is a violation of copyright law.
//
#pragma once
#include <OnixS/CME/MDH/ImpliedPriceLevel.h>
ONIXS_CMEMDH_NAMESPACE_BEGIN
/// Encapsulates price level concept.
ONIXS_CMEMDH_LTWT_CLASS
DirectPriceLevel
: public ImpliedPriceLevel
{
// Number of orders.
Int32 ordersQty_;
public:
/// Initializes undefined level.
DirectPriceLevel()
: ordersQty_(0)
{
}
/// Initializes as copy of other level.
DirectPriceLevel(
const DirectPriceLevel& other)
: ImpliedPriceLevel(
static_cast
<const ImpliedPriceLevel&>
(other))
, ordersQty_(
other.ordersQty_)
{
}
/// Initializes defined level
/// according to specified attributes.
DirectPriceLevel(
const Decimal& price,
Int32 qty,
Int32 ordersQty)
: ImpliedPriceLevel(price, qty)
, ordersQty_(ordersQty)
{
}
// Actually, does nothing.
~DirectPriceLevel()
{
}
/// Updates total number of orders.
Int32& numberOfOrders()
{
return ordersQty_;
}
/// Total number of orders of given price.
Int32 numberOfOrders() const
{
return ordersQty_;
}
/// Re-initializes as copy of other instance.
DirectPriceLevel&
operator =(
const DirectPriceLevel& other)
{
*static_cast<ImpliedPriceLevel*>(this) =
static_cast<const ImpliedPriceLevel&>(other);
ordersQty_ = other.ordersQty_;
return *this;
}
};
/// Serializes price level attributes into a string.
ONIXS_CMEMDH_EXPORTED
void
toStr(
std::string&,
const DirectPriceLevel&);
/// Serializes price level attributes into a string.
inline
std::string
toStr(
const DirectPriceLevel& priceLevel)
{
std::string str;
toStr(str, priceLevel);
return str;
}
ONIXS_CMEMDH_NAMESPACE_END