Files

357 lines
7.3 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/Messages.h>
ONIXS_CMEMDH_NAMESPACE_BEGIN
/// Casts SBE-encoded message to given type.
template
<
class Message
>
inline
Message
typify(
const
BinaryMessage& message)
{
return
Message(
message.binary(),
message.binarySize());
}
/// Casts given binary message according to template/type
/// information and processes casted messages by given processor.
///
/// Returned value indicates whether message type was successfully
/// recognized and pushed to processor for further processing. Unknown
/// messages aren't processed and thus false result is returned.
template
<
class Processor
>
bool
processTypified(
const BinaryMessage& binary,
Processor& processor)
{
switch (binary.templateId())
{
case InstrumentDefinitionFuture27::TemplateId:
{
processor(
typify
<InstrumentDefinitionFuture27>
(binary));
return true;
}
case InstrumentDefinitionSpread29::TemplateId:
{
processor(
typify
<InstrumentDefinitionSpread29>
(binary));
return true;
}
case IncrementalRefreshBook32::TemplateId:
{
processor(
typify
<IncrementalRefreshBook32>
(binary));
return true;
}
case IncrementalRefreshDailyStatistics33::TemplateId:
{
processor(
typify
<IncrementalRefreshDailyStatistics33>
(binary));
return true;
}
case IncrementalRefreshLimitsBanding34::TemplateId:
{
processor(
typify
<IncrementalRefreshLimitsBanding34>
(binary));
return true;
}
case IncrementalRefreshSessionStatistics35::TemplateId:
{
processor(
typify
<IncrementalRefreshSessionStatistics35>
(binary));
return true;
}
case SnapshotFullRefresh38::TemplateId:
{
processor(
typify
<SnapshotFullRefresh38>
(binary));
return true;
}
case InstrumentDefinitionOption41::TemplateId:
{
processor(
typify
<InstrumentDefinitionOption41>
(binary));
return true;
}
case IncrementalRefreshTradeSummary42::TemplateId:
{
processor(
typify
<IncrementalRefreshTradeSummary42>
(binary));
return true;
}
case IncrementalRefreshOrderBook43::TemplateId:
{
processor(
typify
<IncrementalRefreshOrderBook43>
(binary));
return true;
}
case SnapshotFullRefreshOrderBook44::TemplateId:
{
processor(
typify
<SnapshotFullRefreshOrderBook44>
(binary));
return true;
}
case ChannelReset4::TemplateId:
{
processor(
typify
<ChannelReset4>
(binary));
return true;
}
case AdminHeartbeat12::TemplateId:
{
processor(
typify
<AdminHeartbeat12>
(binary));
return true;
}
case AdminLogin15::TemplateId:
{
processor(
typify
<AdminLogin15>
(binary));
return true;
}
case AdminLogout16::TemplateId:
{
processor(
typify
<AdminLogout16>
(binary));
return true;
}
case InstrumentDefinitionFuture54::TemplateId:
{
processor(
typify
<InstrumentDefinitionFuture54>
(binary));
return true;
}
case InstrumentDefinitionSpread56::TemplateId:
{
processor(
typify
<InstrumentDefinitionSpread56>
(binary));
return true;
}
case SecurityStatus30::TemplateId:
{
processor(
typify
<SecurityStatus30>
(binary));
return true;
}
case IncrementalRefreshBook46::TemplateId:
{
processor(
typify
<IncrementalRefreshBook46>
(binary));
return true;
}
case IncrementalRefreshDailyStatistics49::TemplateId:
{
processor(
typify
<IncrementalRefreshDailyStatistics49>
(binary));
return true;
}
case IncrementalRefreshLimitsBanding50::TemplateId:
{
processor(
typify
<IncrementalRefreshLimitsBanding50>
(binary));
return true;
}
case IncrementalRefreshSessionStatistics51::TemplateId:
{
processor(
typify
<IncrementalRefreshSessionStatistics51>
(binary));
return true;
}
case IncrementalRefreshVolume37::TemplateId:
{
processor(
typify
<IncrementalRefreshVolume37>
(binary));
return true;
}
case SnapshotFullRefresh52::TemplateId:
{
processor(
typify
<SnapshotFullRefresh52>
(binary));
return true;
}
case QuoteRequest39::TemplateId:
{
processor(
typify
<QuoteRequest39>
(binary));
return true;
}
case InstrumentDefinitionOption55::TemplateId:
{
processor(
typify
<InstrumentDefinitionOption55>
(binary));
return true;
}
case IncrementalRefreshTradeSummary48::TemplateId:
{
processor(
typify
<IncrementalRefreshTradeSummary48>
(binary));
return true;
}
case IncrementalRefreshOrderBook47::TemplateId:
{
processor(
typify
<IncrementalRefreshOrderBook47>
(binary));
return true;
}
case SnapshotFullRefreshOrderBook53::TemplateId:
{
processor(
typify
<SnapshotFullRefreshOrderBook53>
(binary));
return true;
}
default:
return false;
}
}
ONIXS_CMEMDH_NAMESPACE_END