Files

178 lines
3.7 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/String.h>
#include <OnixS/CME/MDH/Domain.h>
ONIXS_CMEMDH_NAMESPACE_BEGIN
/// Attributes associated with security.
ONIXS_CMEMDH_LTWT_CLASS Security
{
public:
/// Unique security identifier.
///
/// Security ID value will not be reused
/// until the next trade date following an
/// security expiration or deletion.
SecurityId id() const
{
return id_;
}
/// Security name or symbol.
StrRef symbol() const
{
return toStrRef(symbol_);
}
/// Updates security name or symbol.
void symbol(const StrRef& symbol)
{
symbol_.
assign(
symbol.items(),
symbol.size());
}
/// Security group code.
///
/// An exchange specific code assigned to
/// a group of related securities, which are
/// concurrently affected by market events.
StrRef group() const
{
return toStrRef(group_);
}
/// Assigns security group code.
void group(const StrRef& group)
{
group_.
assign(
group.items(),
group.size());
}
/// String field that indicates the
/// underlying asset code (Product Code).
StrRef asset() const
{
return toStrRef(asset_);
}
/// Updates asset code.
void asset(const StrRef& asset)
{
asset_.
assign(
asset.items(),
asset.size());
}
/// Security-level sequence number.
UInt32 seqNumber() const
{
return seqNumber_;
}
protected:
/// Initializes instance.
Security(
SecurityId id)
: id_(id)
, seqNumber_(0)
{
}
/// Cleans everything up.
~Security()
{
}
/// Updates sequence number.
void
seqNumber(
UInt32 seqNumber)
{
seqNumber_ = seqNumber;
}
private:
const SecurityId id_;
UInt32 seqNumber_;
std::string symbol_;
std::string group_;
std::string asset_;
Security(
const Security&);
Security&
operator =(
const Security&);
};
/// Security brief info.
ONIXS_CMEMDH_EXPORTED
void
brief(
std::string&,
const Security&);
/// Security brief info.
inline
std::string
brief(
const Security& security)
{
std::string str;
brief(str, security);
return str;
}
/// Serializes security.
ONIXS_CMEMDH_EXPORTED
void
toStr(
std::string&,
const Security&);
/// Serializes security.
inline
std::string
toStr(
const Security& security)
{
std::string str;
toStr(str, security);
return str;
}
ONIXS_CMEMDH_NAMESPACE_END