OnixS C++ FIX Engine 2.79.1.0
C:/Users/Pasha/_Dev/fixforge-cpp/fix/cppEngine/include/OnixS/FIX/EventBasedDecoder.h
00001 /*
00002 * Copyright 2005-2011 Onix Solutions Limited [OnixS]. All rights reserved. 
00003 * 
00004 * This software owned by Onix Solutions Limited [OnixS] and is protected by copyright law 
00005 * and international copyright treaties. 
00006 * 
00007 * Access to and use of the software is governed by the terms of the applicable ONIXS Software
00008 * Services Agreement (the Agreement) and Customer end user license agreements granting 
00009 * a non-assignable, non-transferable and non-exclusive license to use the software 
00010 * for it's own data processing purposes under the terms defined in the Agreement.
00011 * 
00012 * Except as otherwise granted within the terms of the Agreement, copying or reproduction of any part 
00013 * of this source code or associated reference material to any other location for further reproduction
00014 * or redistribution, and any amendments to this copyright notice, are expressly prohibited. 
00015 *
00016 * Any reproduction or redistribution for sale or hiring of the Software not in accordance with 
00017 * the terms of the Agreement is a violation of copyright law. 
00018 */
00019 
00020 #if !defined(__ONIXS_EVENTBASEDDECODER_H__)
00021 #define __ONIXS_EVENTBASEDDECODER_H__
00022 
00023 #include <string>
00024 #include <vector>
00025 
00026 #include "OnixS/FIX/ABI.h"
00027 #include "OnixS/FIX/Definitions.h"
00028 #include "OnixS/FIX/IDecodeListener.h"
00029 
00030 namespace OnixS
00031 {
00032     namespace FIX
00033     {
00034         ONIXS_FIXENGINE_API_DECL(class, Message);
00035         ONIXS_FIXENGINE_API_DECL(class, Dialect);
00036 
00037         namespace FAST
00038         {
00040             class ONIXS_FIXENGINE_API EventBasedDecoder
00041             {
00042             public:
00049                 EventBasedDecoder(const std::string& xmlTemplates, OnixS::FIX::Version fixVersion, bool decodeEachMessageIndependently);
00050 
00058                 EventBasedDecoder(const std::string& xmlTemplates, const OnixS::FIX::Dialect & fixDialect, bool decodeEachMessageIndependently);
00059 
00061                 ~EventBasedDecoder(void);   
00062 
00073                 bool decode(const char* buffer, size_t bufferSize, IDecodeListener *listener, size_t *usedSize);
00074 
00084                 bool decode(const std::vector<char> & chunk, IDecodeListener *listener, size_t *usedSize);
00085 
00096                 bool decodeSingleMessage(const char* buffer, size_t bufferSize, IDecodeListener *listener, size_t *usedSize);
00097 
00107                 bool decodeSingleMessage(const std::vector<char> & chunk, IDecodeListener *listener, size_t *usedSize);
00108 
00117                 static bool tryDecodeUnsignedInteger(const char* buffer, size_t bufferSize, unsigned int* value, size_t* fieldLength);
00118 
00122                 void reset();
00123 
00124             private:
00125                 EventBasedDecoder(const EventBasedDecoder&);
00126                 EventBasedDecoder& operator = (const EventBasedDecoder&);
00127 
00128                 EventBasedDecoder(void* native);
00129 
00130                 void init(const std::string& xmlTemplates, const std::string& fixDictionary, bool decodeEachMessageIndependently);
00131 
00132                 struct Impl;
00133                 Impl* impl_;
00134                 void* native_;
00135             };
00136         }
00137     }
00138 }
00139 
00140 #endif // __ONIXS_EVENTBASEDDECODER_H__