166 lines
3.9 KiB
C++
166 lines
3.9 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/Integral.h>
|
|
|
|
ONIXS_CMEMDH_NAMESPACE_BEGIN
|
|
|
|
/// Defines how SBE messages are traced.
|
|
ONIXS_CMEMDH_LTWT_STRUCT MessageTracing
|
|
{
|
|
/// Integral type used as basement for constants.
|
|
typedef UInt32 Base;
|
|
|
|
/// Defines how SBE messages are traced.
|
|
enum Enum
|
|
{
|
|
/// Message tracing is disabled.
|
|
Disabled,
|
|
|
|
/// Messages are traced using SBE naming from
|
|
/// coding templates for fields and their values.
|
|
SbeFormat,
|
|
|
|
/// Messages are traced in FIX tag=value format.
|
|
FixFormat
|
|
};
|
|
};
|
|
|
|
/// Serializes message tracing constant into a string.
|
|
ONIXS_CMEMDH_EXPORTED
|
|
void
|
|
toStr(
|
|
std::string&,
|
|
MessageTracing::Enum);
|
|
|
|
/// Serializes message tracing constant into a string.
|
|
inline
|
|
std::string
|
|
toStr(
|
|
MessageTracing::Enum tracing)
|
|
{
|
|
std::string str;
|
|
|
|
toStr(str, tracing);
|
|
|
|
return str;
|
|
}
|
|
|
|
/// Deserializes message tracing constant from a string.
|
|
ONIXS_CMEMDH_EXPORTED
|
|
bool
|
|
fromStr(
|
|
MessageTracing::Enum&,
|
|
const Char*,
|
|
size_t);
|
|
|
|
/// Parameters affecting what's logged at a debug level.
|
|
ONIXS_CMEMDH_LTWT_CLASS HandlerDebugLoggingSettings
|
|
{
|
|
bool traceFeeds_;
|
|
MessageTracing::Enum traceMessages_;
|
|
bool traceBooks_;
|
|
|
|
public:
|
|
/// Initializes default settings.
|
|
HandlerDebugLoggingSettings()
|
|
: traceFeeds_(false)
|
|
, traceMessages_(
|
|
MessageTracing::Disabled)
|
|
, traceBooks_(false)
|
|
{
|
|
}
|
|
|
|
/// Cleans everything up (if necessary).
|
|
~HandlerDebugLoggingSettings()
|
|
{
|
|
}
|
|
|
|
/// Defines whether feeds are to be traced.
|
|
/// @note By default, feeds are not traced.
|
|
bool traceFeeds() const
|
|
{
|
|
return traceFeeds_;
|
|
}
|
|
|
|
/// Defines whether feeds are to be traced.
|
|
void traceFeeds(bool status)
|
|
{
|
|
traceFeeds_ = status;
|
|
}
|
|
|
|
/// Defines the way SBE messages are traced.
|
|
/// @note By default, messages are not traced.
|
|
MessageTracing::Enum traceMessages() const
|
|
{
|
|
return traceMessages_;
|
|
}
|
|
|
|
/// Defines the way SBE messages are traced.
|
|
void
|
|
traceMessages(
|
|
MessageTracing::Enum tracing)
|
|
{
|
|
traceMessages_ = tracing;
|
|
}
|
|
|
|
/// Indicates whether books are traced.
|
|
/// @note By default, books are not traced.
|
|
bool traceBooks() const
|
|
{
|
|
return traceBooks_;
|
|
}
|
|
|
|
/// Indicates whether books are traced.
|
|
void
|
|
traceBooks(
|
|
bool status)
|
|
{
|
|
traceBooks_ = status;
|
|
}
|
|
};
|
|
|
|
/// Serializes Handler debug logging settings into a string.
|
|
ONIXS_CMEMDH_EXPORTED
|
|
void
|
|
toStr(
|
|
std::string&,
|
|
const
|
|
HandlerDebugLoggingSettings&);
|
|
|
|
/// Serializes Handler debug logging settings into a string.
|
|
inline
|
|
std::string
|
|
toStr(
|
|
const
|
|
HandlerDebugLoggingSettings& settings)
|
|
{
|
|
std::string str;
|
|
|
|
toStr(str, settings);
|
|
|
|
return str;
|
|
}
|
|
|
|
ONIXS_CMEMDH_NAMESPACE_END
|