OnixS C++ FIX Engine 2.79.1.0
C:/Users/Pasha/_Dev/fixforge-cpp/fix/cppEngine/include/OnixS/FIX/FAST.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_FAST_H__)
00021 #define __ONIXS_FAST_H__
00022 
00023 #include <string>
00024 #include <vector>
00025 
00026 #include "OnixS/FIX/ABI.h"
00027 #include "OnixS/FIX/Definitions.h"
00028 
00029 namespace OnixS
00030 {
00031     namespace FIX
00032     {
00033         ONIXS_FIXENGINE_API_DECL(class, Message);
00034         ONIXS_FIXENGINE_API_DECL(class, Dialect);
00035 
00036         namespace FAST
00037         {
00039             class ONIXS_FIXENGINE_API Encoder
00040             {
00041             public:
00047                 Encoder(const std::string& xmlTemplates, OnixS::FIX::Version fixVersion, bool encodeEachMessageIndependently);
00048 
00050                 ~Encoder(void); 
00051 
00060                 size_t encode(const OnixS::FIX::Message& fixMessage, int templateID, char* buffer, size_t bufferSize);
00061 
00069                 size_t encode(const OnixS::FIX::Message& fixMessage, char* buffer, size_t bufferSize);
00070 
00074                 void reset();
00075 
00076             private:
00077                 Encoder(const Encoder&);
00078                 Encoder& operator = (const Encoder&);
00079 
00080                 Encoder(void* native);          
00081 
00082                 struct Impl;
00083                 Impl* impl_;
00084                 void* native_;
00085             };
00086 
00088             class ONIXS_FIXENGINE_API Decoder{
00089             public:
00096                 Decoder(const std::string& xmlTemplates, OnixS::FIX::Version fixVersion, bool decodeEachMessageIndependently);
00097 
00105                 Decoder(const std::string& xmlTemplates, const OnixS::FIX::Dialect & fixDialect, bool decodeEachMessageIndependently);
00106 
00108                 ~Decoder(void); 
00109 
00118                 const OnixS::FIX::Message& decode(const char* buffer, size_t bufferSize);
00119 
00127                 const OnixS::FIX::Message& decode(const std::vector<char> & chunk);
00128 
00143                 bool tryDecode(const char* buffer, size_t offset, size_t count, const OnixS::FIX::Message** message, size_t* numberOfDecodedBytes);
00144 
00153                 static bool tryDecodeUnsignedInteger(const char* buffer, size_t bufferSize, unsigned int* value, size_t* fieldLength);
00154 
00158                 void reset();
00159 
00160             private:
00161                 Decoder(const Decoder&);
00162                 Decoder& operator = (const Decoder&);
00163 
00164                 Decoder(void* native);
00165 
00166                 void init(const std::string& xmlTemplates, const std::string& fixDictionary, bool decodeEachMessageIndependently);
00167 
00168                 struct Impl;
00169                 Impl* impl_;
00170                 void* native_;
00171             };
00172         }
00173     }
00174 }
00175 
00176 #endif // __ONIXS_FAST_H__