// Copyright (C) 2010-2016  MarketFactory, Inc. All Rights Reserved.
//================================================================================
//   This file is auto-generated; DO NOT EDIT!
//================================================================================

#ifndef __API_HANDLER_MARKETFACTORY__
#define __API_HANDLER_MARKETFACTORY__

/*
 *
 * Header file for C++ API handler.
 *
 */

#include "APIFwd.h"

#include "VersionMessage.h"
#include "RuThereMessage.h"
#include "ImHereMessage.h"
#include "HeartbeatMessage.h"
#include "ReplayMessage.h"
#include "ReplayDoneMessage.h"
#include "LastSequenceIDMessage.h"
#include "BatchRegisterMessage.h"
#include "BatchUnregisterMessage.h"
#include "BatchesCompletedMessage.h"
#include "MktDataMessage.h"
#include "SubmitOrderMessage.h"
#include "CancelOrderMessage.h"
#include "CancelAllOrderMessage.h"
#include "ModifyOrderMessage.h"
#include "ComplexOrderMessage.h"
#include "OrderReceivedMessage.h"
#include "OrderSubmittedMessage.h"
#include "OrderRejectedMessage.h"
#include "OrderCanceledMessage.h"
#include "OrderDoneMessage.h"
#include "OrderCancelRejectedMessage.h"
#include "TradeCaptureMessage.h"
#include "DropCopyMessage.h"
#include "EventReportMessage.h"
#include "DateRolloverMessage.h"
#include "ClientConnectMessage.h"
#include "ClientDisconnectMessage.h"
#include "ConnectResponseMessage.h"
#include "TradeLimitDataMessage.h"
#include "RiskResponseMessage.h"
#include "LockResponseMessage.h"
#include "LockUserMessage.h"
#include "ConfigMessage.h"
#include "SubscribeMessage.h"
#include "UnsubscribeMessage.h"
#include "UnsubscribeAllMessage.h"
#include "SubscriptionEventMessage.h"
#include "InsertLogMessage.h"
#include "TestMessage.h"
#include "RequestSnapshotMessage.h"

namespace Niagara {
class FastCodec;
}

namespace MarketFactory {
class FastOStream;
}

namespace MFAPI {

template <typename T>
class MsgHandlerT
{
public:
    virtual ~MsgHandlerT() {}

    virtual void handle( const T& obj, const VersionMessage& );
    virtual void handle( const T& obj, const RuThereMessage& );
    virtual void handle( const T& obj, const ImHereMessage& );
    virtual void handle( const T& obj, const HeartbeatMessage& );
    virtual void handle( const T& obj, const ReplayMessage& );
    virtual void handle( const T& obj, const ReplayDoneMessage& );
    virtual void handle( const T& obj, const LastSequenceIDMessage& );
    virtual void handle( const T& obj, const BatchRegisterMessage& );
    virtual void handle( const T& obj, const BatchUnregisterMessage& );
    virtual void handle( const T& obj, const BatchesCompletedMessage& );
    virtual void handle( const T& obj, const MktDataMessage& );
    virtual void handle( const T& obj, const SubmitOrderMessage& );
    virtual void handle( const T& obj, const CancelOrderMessage& );
    virtual void handle( const T& obj, const CancelAllOrderMessage& );
    virtual void handle( const T& obj, const ModifyOrderMessage& );
    virtual void handle( const T& obj, const ComplexOrderMessage& );
    virtual void handle( const T& obj, const OrderReceivedMessage& );
    virtual void handle( const T& obj, const OrderSubmittedMessage& );
    virtual void handle( const T& obj, const OrderRejectedMessage& );
    virtual void handle( const T& obj, const OrderCanceledMessage& );
    virtual void handle( const T& obj, const OrderDoneMessage& );
    virtual void handle( const T& obj, const OrderCancelRejectedMessage& );
    virtual void handle( const T& obj, const TradeCaptureMessage& );
    virtual void handle( const T& obj, const DropCopyMessage& );
    virtual void handle( const T& obj, const EventReportMessage& );
    virtual void handle( const T& obj, const DateRolloverMessage& );
    virtual void handle( const T& obj, const ClientConnectMessage& );
    virtual void handle( const T& obj, const ClientDisconnectMessage& );
    virtual void handle( const T& obj, const ConnectResponseMessage& );
    virtual void handle( const T& obj, const TradeLimitDataMessage& );
    virtual void handle( const T& obj, const RiskResponseMessage& );
    virtual void handle( const T& obj, const LockResponseMessage& );
    virtual void handle( const T& obj, const LockUserMessage& );
    virtual void handle( const T& obj, const ConfigMessage& );
    virtual void handle( const T& obj, const SubscribeMessage& );
    virtual void handle( const T& obj, const UnsubscribeMessage& );
    virtual void handle( const T& obj, const UnsubscribeAllMessage& );
    virtual void handle( const T& obj, const SubscriptionEventMessage& );
    virtual void handle( const T& obj, const InsertLogMessage& );
    virtual void handle( const T& obj, const TestMessage& );
    virtual void handle( const T& obj, const RequestSnapshotMessage& );

    // Method that gets called when an override is not provided.
    virtual void handleDefault( const T& obj );

    // Dispatch from the given object.
    void dispatchMessage( const T& obj, const void* concrete, uint16_t msgType );
};

//
// Methods.
//

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const VersionMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const RuThereMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const ImHereMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const HeartbeatMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const ReplayMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const ReplayDoneMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const LastSequenceIDMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const BatchRegisterMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const BatchUnregisterMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const BatchesCompletedMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const MktDataMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const SubmitOrderMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const CancelOrderMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const CancelAllOrderMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const ModifyOrderMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const ComplexOrderMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const OrderReceivedMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const OrderSubmittedMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const OrderRejectedMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const OrderCanceledMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const OrderDoneMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const OrderCancelRejectedMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const TradeCaptureMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const DropCopyMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const EventReportMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const DateRolloverMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const ClientConnectMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const ClientDisconnectMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const ConnectResponseMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const TradeLimitDataMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const RiskResponseMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const LockResponseMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const LockUserMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const ConfigMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const SubscribeMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const UnsubscribeMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const UnsubscribeAllMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const SubscriptionEventMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const InsertLogMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const TestMessage& )
{
    handleDefault(obj);
}

template <typename T>
void MsgHandlerT<T>::handle( const T& obj, const RequestSnapshotMessage& )
{
    handleDefault(obj);
}

//
// Dispatch method.
//

template <typename T>
void MsgHandlerT<T>::dispatchMessage( const T& obj, const void* concrete, uint16_t msgType )
{
    switch ( msgType ) {
        case VersionMessage::ID: {
            this->handle(obj, *reinterpret_cast<const VersionMessage*>(concrete));
        } break;
        case RuThereMessage::ID: {
            this->handle(obj, *reinterpret_cast<const RuThereMessage*>(concrete));
        } break;
        case ImHereMessage::ID: {
            this->handle(obj, *reinterpret_cast<const ImHereMessage*>(concrete));
        } break;
        case HeartbeatMessage::ID: {
            this->handle(obj, *reinterpret_cast<const HeartbeatMessage*>(concrete));
        } break;
        case ReplayMessage::ID: {
            this->handle(obj, *reinterpret_cast<const ReplayMessage*>(concrete));
        } break;
        case ReplayDoneMessage::ID: {
            this->handle(obj, *reinterpret_cast<const ReplayDoneMessage*>(concrete));
        } break;
        case LastSequenceIDMessage::ID: {
            this->handle(obj, *reinterpret_cast<const LastSequenceIDMessage*>(concrete));
        } break;
        case BatchRegisterMessage::ID: {
            this->handle(obj, *reinterpret_cast<const BatchRegisterMessage*>(concrete));
        } break;
        case BatchUnregisterMessage::ID: {
            this->handle(obj, *reinterpret_cast<const BatchUnregisterMessage*>(concrete));
        } break;
        case BatchesCompletedMessage::ID: {
            this->handle(obj, *reinterpret_cast<const BatchesCompletedMessage*>(concrete));
        } break;
        case MktDataMessage::ID: {
            this->handle(obj, *reinterpret_cast<const MktDataMessage*>(concrete));
        } break;
        case SubmitOrderMessage::ID: {
            this->handle(obj, *reinterpret_cast<const SubmitOrderMessage*>(concrete));
        } break;
        case CancelOrderMessage::ID: {
            this->handle(obj, *reinterpret_cast<const CancelOrderMessage*>(concrete));
        } break;
        case CancelAllOrderMessage::ID: {
            this->handle(obj, *reinterpret_cast<const CancelAllOrderMessage*>(concrete));
        } break;
        case ModifyOrderMessage::ID: {
            this->handle(obj, *reinterpret_cast<const ModifyOrderMessage*>(concrete));
        } break;
        case ComplexOrderMessage::ID: {
            this->handle(obj, *reinterpret_cast<const ComplexOrderMessage*>(concrete));
        } break;
        case OrderReceivedMessage::ID: {
            this->handle(obj, *reinterpret_cast<const OrderReceivedMessage*>(concrete));
        } break;
        case OrderSubmittedMessage::ID: {
            this->handle(obj, *reinterpret_cast<const OrderSubmittedMessage*>(concrete));
        } break;
        case OrderRejectedMessage::ID: {
            this->handle(obj, *reinterpret_cast<const OrderRejectedMessage*>(concrete));
        } break;
        case OrderCanceledMessage::ID: {
            this->handle(obj, *reinterpret_cast<const OrderCanceledMessage*>(concrete));
        } break;
        case OrderDoneMessage::ID: {
            this->handle(obj, *reinterpret_cast<const OrderDoneMessage*>(concrete));
        } break;
        case OrderCancelRejectedMessage::ID: {
            this->handle(obj, *reinterpret_cast<const OrderCancelRejectedMessage*>(concrete));
        } break;
        case TradeCaptureMessage::ID: {
            this->handle(obj, *reinterpret_cast<const TradeCaptureMessage*>(concrete));
        } break;
        case DropCopyMessage::ID: {
            this->handle(obj, *reinterpret_cast<const DropCopyMessage*>(concrete));
        } break;
        case EventReportMessage::ID: {
            this->handle(obj, *reinterpret_cast<const EventReportMessage*>(concrete));
        } break;
        case DateRolloverMessage::ID: {
            this->handle(obj, *reinterpret_cast<const DateRolloverMessage*>(concrete));
        } break;
        case ClientConnectMessage::ID: {
            this->handle(obj, *reinterpret_cast<const ClientConnectMessage*>(concrete));
        } break;
        case ClientDisconnectMessage::ID: {
            this->handle(obj, *reinterpret_cast<const ClientDisconnectMessage*>(concrete));
        } break;
        case ConnectResponseMessage::ID: {
            this->handle(obj, *reinterpret_cast<const ConnectResponseMessage*>(concrete));
        } break;
        case TradeLimitDataMessage::ID: {
            this->handle(obj, *reinterpret_cast<const TradeLimitDataMessage*>(concrete));
        } break;
        case RiskResponseMessage::ID: {
            this->handle(obj, *reinterpret_cast<const RiskResponseMessage*>(concrete));
        } break;
        case LockResponseMessage::ID: {
            this->handle(obj, *reinterpret_cast<const LockResponseMessage*>(concrete));
        } break;
        case LockUserMessage::ID: {
            this->handle(obj, *reinterpret_cast<const LockUserMessage*>(concrete));
        } break;
        case ConfigMessage::ID: {
            this->handle(obj, *reinterpret_cast<const ConfigMessage*>(concrete));
        } break;
        case SubscribeMessage::ID: {
            this->handle(obj, *reinterpret_cast<const SubscribeMessage*>(concrete));
        } break;
        case UnsubscribeMessage::ID: {
            this->handle(obj, *reinterpret_cast<const UnsubscribeMessage*>(concrete));
        } break;
        case UnsubscribeAllMessage::ID: {
            this->handle(obj, *reinterpret_cast<const UnsubscribeAllMessage*>(concrete));
        } break;
        case SubscriptionEventMessage::ID: {
            this->handle(obj, *reinterpret_cast<const SubscriptionEventMessage*>(concrete));
        } break;
        case InsertLogMessage::ID: {
            this->handle(obj, *reinterpret_cast<const InsertLogMessage*>(concrete));
        } break;
        case TestMessage::ID: {
            this->handle(obj, *reinterpret_cast<const TestMessage*>(concrete));
        } break;
        case RequestSnapshotMessage::ID: {
            this->handle(obj, *reinterpret_cast<const RequestSnapshotMessage*>(concrete));
        } break;

    }
}

template <typename T>
void MsgHandlerT<T>::handleDefault( const T& obj )
{
    // No-op. Override this to implement the default behaviour.
}

} // MFAPI

#endif
// InclKwds: MsgHandlerT
