Index Source Files Annotated Class List Alphabetical Class List Class Hierarchy Graphical Class Hierarchy

# MessageCracker.h

Go to the documentation of this file.

    00001 /* -*- C++ -*- */
    00002
    00003 /****************************************************************************
    00004 ** Copyright (c) quickfixengine.org  All rights reserved.
    00005 **
    00006 ** This file is part of the QuickFIX FIX Engine
    00007 **
    00008 ** This file may be distributed under the terms of the quickfixengine.org
    00009 ** license as defined by quickfixengine.org and appearing in the file
    00010 ** LICENSE included in the packaging of this file.
    00011 **
    00012 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
    00013 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    00014 **
    00015 ** See http://www.quickfixengine.org/LICENSE for licensing information.
    00016 **
    00017 ** Contact ask@quickfixengine.org if any conditions of this licensing are
    00018 ** not clear to you.
    00019 **
    00020 ****************************************************************************/
    00021
    00022 #ifndef FIX_MESSAGECRACKER_H
    00023 #define FIX_MESSAGECRACKER_H
    00024
    00025 #include "fix40/MessageCracker.h"
    00026 #include "fix41/MessageCracker.h"
    00027 #include "fix42/MessageCracker.h"
    00028 #include "fix43/MessageCracker.h"
    00029 #include "fix44/MessageCracker.h"
    00030 #include "fix50/MessageCracker.h"
    00031 #include "fixt11/MessageCracker.h"
    00032 #include "Values.h"
    00033 #include "Session.h"
    00034
    00035 namespace FIX
    00036 {
    00040 class MessageCracker
    00041       :
    00042       public FIX40::MessageCracker,
    00043       public FIX41::MessageCracker,
    00044       public FIX42::MessageCracker,
    00045       public FIX43::MessageCracker,
    00046       public FIX44::MessageCracker,
    00047       public FIX50::MessageCracker,
    00048       public FIXT11::MessageCracker
    00049 {
    00050 public:
    00051   void crack( const Message& message,
    00052               const SessionID& sessionID )
    00053   {
    00054     const FIX::BeginString& beginString =
    00055       FIELD_GET_REF( message.getHeader(), BeginString );
    00056
    00057     crack( message, sessionID, beginString );
    00058   }
    00059
    00060   void crack( const Message& message,
    00061               const SessionID& sessionID,
    00062               const BeginString& beginString )
    00063   {
    00064     if ( beginString == BeginString_FIX40 )
    00065       ((FIX40::MessageCracker&)(*this)).crack((const FIX40::Message&) message, sessionID);
    00066     else if ( beginString == BeginString_FIX41 )
    00067       ((FIX41::MessageCracker&)(*this)).crack((const FIX41::Message&) message, sessionID);
    00068     else if ( beginString == BeginString_FIX42 )
    00069       ((FIX42::MessageCracker&)(*this)).crack((const FIX42::Message&) message, sessionID);
    00070     else if ( beginString == BeginString_FIX43 )
    00071       ((FIX43::MessageCracker&)(*this)).crack((const FIX43::Message&) message, sessionID);
    00072     else if ( beginString == BeginString_FIX44 )
    00073       ((FIX44::MessageCracker&)(*this)).crack((const FIX44::Message&) message, sessionID);
    00074     else if ( beginString == BeginString_FIX50 )
    00075       ((FIX50::MessageCracker&)(*this)).crack((const FIX50::Message&) message, sessionID);
    00076     else if ( beginString == BeginString_FIXT11 )
    00077     {
    00078       if( message.isAdmin() )
    00079       {
    00080         ((FIXT11::MessageCracker&)(*this)).crack((const FIXT11::Message&) message, sessionID);
    00081       }
    00082       else
    00083       {
    00084         ApplVerID applVerID;
    00085         if(!message.getHeader().isSetField(applVerID))
    00086         {
    00087           Session* pSession = Session::lookupSession( sessionID );
    00088           applVerID = pSession->getSenderDefaultApplVerID();
    00089         }
    00090         else
    00091         {
    00092           message.getHeader().getField( applVerID );
    00093         }
    00094
    00095         crack( message, sessionID, Message::toBeginString(applVerID) );
    00096       }
    00097     }
    00098   }
    00099
    00100   void crack( Message& message,
    00101               const SessionID& sessionID )
    00102   {
    00103     const FIX::BeginString& beginString =
    00104       FIELD_GET_REF( message.getHeader(), BeginString );
    00105
    00106     crack( message, sessionID, beginString );
    00107   }
    00108
    00109   void crack( Message& message,
    00110               const SessionID& sessionID,
    00111               const BeginString& beginString )
    00112   {
    00113     if ( beginString == BeginString_FIX40 )
    00114       ((FIX40::MessageCracker&)(*this)).crack((const FIX40::Message&) message, sessionID);
    00115     else if ( beginString == BeginString_FIX41 )
    00116       ((FIX41::MessageCracker&)(*this)).crack((const FIX41::Message&) message, sessionID);
    00117     else if ( beginString == BeginString_FIX42 )
    00118       ((FIX42::MessageCracker&)(*this)).crack((const FIX42::Message&) message, sessionID);
    00119     else if ( beginString == BeginString_FIX43 )
    00120       ((FIX43::MessageCracker&)(*this)).crack((const FIX43::Message&) message, sessionID);
    00121     else if ( beginString == BeginString_FIX44 )
    00122       ((FIX44::MessageCracker&)(*this)).crack((const FIX44::Message&) message, sessionID);
    00123     else if ( beginString == BeginString_FIX50 )
    00124       ((FIX50::MessageCracker&)(*this)).crack((const FIX50::Message&) message, sessionID);
    00125     else if ( beginString == BeginString_FIXT11 )
    00126     {
    00127       if( message.isAdmin() )
    00128       {
    00129         ((FIXT11::MessageCracker&)(*this)).crack((const FIXT11::Message&) message, sessionID);
    00130       }
    00131       else
    00132       {
    00133         ApplVerID applVerID;
    00134         if(!message.getHeader().isSetField(applVerID))
    00135         {
    00136           Session* pSession = Session::lookupSession( sessionID );
    00137           applVerID = pSession->getSenderDefaultApplVerID();
    00138         }
    00139         else
    00140         {
    00141           message.getHeader().getField( applVerID );
    00142         }
    00143
    00144         crack( message, sessionID, Message::toBeginString(applVerID) );
    00145       }
    00146     }
    00147   }
    00148 };
    00149 }
    00150
    00151 #endif //FIX_MESSAGECRACKER_H