added onix fix libs

This commit is contained in:
Mohammad Arham committed 2024-09-23 12:00:04 -04:00
1 parent ff5f02bbde
commit 8069cc893f
84 files changed
+78912

No files matched your search

+88
View File
@@ -0,0 +1,88 @@
/*
* 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/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Compiler.h>
#include <OnixS/FIXEngine/Definitions.h>
#include <OnixS/FIXEngine/FIX/ThreadingModel.h>
#include <OnixS/FIXEngine/FIX/Timestamp.h>
#include <OnixS/FIXEngine/FIX/Dictionary.h>
#include <OnixS/FIXEngine/FIX/EncryptionMethod.h>
#include <OnixS/FIXEngine/FIX/Engine.h>
#include <OnixS/FIXEngine/FIX/EngineSettings.h>
#include <OnixS/FIXEngine/FIX/EventBasedDecoder.h>
#include <OnixS/FIXEngine/FIX/Exception.h>
#include <OnixS/FIXEngine/FIX/FAST.h>
#include <OnixS/FIXEngine/FIX/FieldSet.h>
#include <OnixS/FIXEngine/FIX/FieldValueRef.h>
#include <OnixS/FIXEngine/FIX/Group.h>
#include <OnixS/FIXEngine/FIX/IDecodeListener.h>
#include <OnixS/FIXEngine/FIX/IEngineListener.h>
#include <OnixS/FIXEngine/FIX/InputDataTraits.h>
#include <OnixS/FIXEngine/FIX/ISbeDecodeListener.h>
#include <OnixS/FIXEngine/FIX/ISessionListener.h>
#include <OnixS/FIXEngine/FIX/ISessionStorage.h>
#include <OnixS/FIXEngine/FIX/Message.h>
#include <OnixS/FIXEngine/FIX/MessageParsingFlags.h>
#include <OnixS/FIXEngine/FIX/MessageValidationFlags.h>
#include <OnixS/FIXEngine/FIX/MessageStringingFlags.h>
#include <OnixS/FIXEngine/FIX/Numeric.h>
#include <OnixS/FIXEngine/FIX/ProtocolVersion.h>
#include <OnixS/FIXEngine/FIX/RawMessage.h>
#include <OnixS/FIXEngine/FIX/SBE.h>
#include <OnixS/FIXEngine/FIX/SbeEventBasedDecoder.h>
#include <OnixS/FIXEngine/FIX/FlatGroup.h>
#include <OnixS/FIXEngine/FIX/FlatMessage.h>
#include <OnixS/FIXEngine/FIX/SequenceNumber.h>
#include <OnixS/FIXEngine/FIX/Session.h>
#include <OnixS/FIXEngine/FIX/SessionRole.h>
#include <OnixS/FIXEngine/FIX/SessionState.h>
#include <OnixS/FIXEngine/FIX/SessionStorageType.h>
#include <OnixS/FIXEngine/FIX/StringRef.h>
#include <OnixS/FIXEngine/FIX/Tag.h>
#include <OnixS/FIXEngine/FIX/Version.h>
#include <OnixS/FIXEngine/FIX/TcpDirectAttr.h>
#include <OnixS/FIXEngine/FIX/TcpDirectStack.h>
#include <OnixS/FIXEngine/FIX/TcpStandardStack.h>
#include <OnixS/FIXEngine/FIX/Scheduling/SessionConnectionSettings.h>
#include <OnixS/FIXEngine/FIX/Scheduling/SessionSchedule.h>
#include <OnixS/FIXEngine/FIX/Scheduling/SessionScheduler.h>
#include <OnixS/FIXEngine/Sockets/Definitions.h>
#include <OnixS/FIXEngine/Sockets/MulticastClient.h>
#include <OnixS/FIXEngine/Sockets/TcpClient.h>
#include <OnixS/FIXEngine/Threading/Definitions.h>
#include <OnixS/FIXEngine/Threading/Future.h>
#include <OnixS/FIXEngine/Threading/Mutex.h>
#include <OnixS/FIXEngine/Threading/Condition.h>
#include <OnixS/FIXEngine/Threading/Semaphore.h>
#include <OnixS/FIXEngine/Threading/Guard.h>
#include <OnixS/FIXEngine/Threading/Thread.h>
#include <OnixS/FIXEngine/Threading/ThreadSafeQueue.h>
#include <OnixS/FIXEngine/Threading/ThreadSafePool.h>
#include <OnixS/FIXEngine/FIX/ISessionReactor.h>
#include <OnixS/FIXEngine/Cryptography/Base64Encoding.h>
#include <OnixS/FIXEngine/Cryptography/Cryptograph.h>
+59
View File
@@ -0,0 +1,59 @@
/*
* 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
#if defined (_MSC_VER)
#if defined (ONIXS_FIXENGINE_AS_STATIC_LIBS)
#define ONIXS_FIXENGINE_API
#else
#if defined (ONIXS_FIXENGINE_EXPORTS)
#define ONIXS_FIXENGINE_API __declspec(dllexport)
#else
#define ONIXS_FIXENGINE_API __declspec(dllimport)
#endif
#endif
#define ONIXS_FIXENGINE_THROWABLE_API
#define ONIXS_FIXENGINE_THROWABLE ONIXS_FIXENGINE_THROWABLE_API
#elif (__GNUC__ >= 4)
#define ONIXS_FIXENGINE_API __attribute__ ((visibility("default")))
#define ONIXS_FIXENGINE_THROWABLE_API ONIXS_FIXENGINE_API
#define ONIXS_FIXENGINE_THROWABLE ONIXS_FIXENGINE_API
#else
#define ONIXS_FIXENGINE_API
#define ONIXS_FIXENGINE_THROWABLE_API
#define ONIXS_FIXENGINE_THROWABLE
#endif
#if defined (_MSC_VER)
#define \
ONIXS_FIXENGINE_API_DECL(typeKind, typeName) \
typeKind ONIXS_FIXENGINE_API typeName
#else
#define \
ONIXS_FIXENGINE_API_DECL(typeKind, typeName) \
typeKind typeName
#endif
+216
View File
@@ -0,0 +1,216 @@
/*
* 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
#if !(defined(ONIXS_FIXENGINE_DOXYGEN) && ONIXS_FIXENGINE_DOXYGEN)
#include <OnixS/FIXEngine/CompilerDetection.h>
#if defined(__GNUC__)
#define ONIXS_FIXENGINE_MAY_ALIAS __attribute__((__may_alias__))
#else
#define ONIXS_FIXENGINE_MAY_ALIAS
#endif
// https://bugzilla.redhat.com/show_bug.cgi?id=702984
#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 4)
#define ONIXS_FIXENGINE_GCC44_SPURIOUS_WARNING_TURNAROUND ONIXS_FIXENGINE_MAY_ALIAS
#else
#define ONIXS_FIXENGINE_GCC44_SPURIOUS_WARNING_TURNAROUND
#endif
# if defined(ONIXS_FIXENGINE_COMPILER_CXX_NOEXCEPT) && ONIXS_FIXENGINE_COMPILER_CXX_NOEXCEPT
# define ONIXS_FIXENGINE_NOTHROW noexcept
# else
# define ONIXS_FIXENGINE_NOTHROW throw()
# endif
# if defined(ONIXS_FIXENGINE_COMPILER_CXX_EXPLICIT_CONVERSIONS) && ONIXS_FIXENGINE_COMPILER_CXX_EXPLICIT_CONVERSIONS
# define ONIXS_FIXENGINE_EXPLICIT explicit
#else
# define ONIXS_FIXENGINE_EXPLICIT
#endif
#if (__cplusplus >= 201103L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || (defined(__GXX_EXPERIMENTAL_CXX0X__) && (__GXX_EXPERIMENTAL_CXX0X__))
# define ONIXS_FIXENGINE_CXX11
#endif
#if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
# define ONIXS_FIXENGINE_CXX17
#endif
# if defined(ONIXS_FIXENGINE_COMPILER_CXX_CONSTEXPR) && ONIXS_FIXENGINE_COMPILER_CXX_CONSTEXPR
# define ONIXS_FIXENGINE_CONST_OR_CONSTEXPR constexpr
#else
# define ONIXS_FIXENGINE_CONST_OR_CONSTEXPR const
#endif
#if defined(__GNUC__)
# define ONIXS_FIXENGINE_CHECK_EXPECT(exp,c) (__builtin_expect((exp), (c)))
#else
# define ONIXS_FIXENGINE_CHECK_EXPECT(exp,c) ((exp))
#endif
#if !defined(ONIXS_FIXENGINE_NORETURN)
# if defined(_MSC_VER)
# define ONIXS_FIXENGINE_NORETURN __declspec(noreturn)
# elif defined(__GNUC__)
# define ONIXS_FIXENGINE_NORETURN __attribute__ ((__noreturn__))
# elif defined(__has_cpp_attribute)
# if __has_cpp_attribute(noreturn)
# define ONIXS_FIXENGINE_NORETURN [[noreturn]]
# endif
# endif
#endif
#if !defined(ONIXS_FIXENGINE_NORETURN)
# define ONIXS_FIXENGINE_NORETURN
#endif
#if !defined(ONIXS_FIXENGINE_NODISCARD)
# if defined(_MSC_VER)
# define ONIXS_FIXENGINE_NODISCARD _Check_return_
# elif defined(__GNUC__)
# define ONIXS_FIXENGINE_NODISCARD __attribute__((warn_unused_result))
# elif defined(__has_cpp_attribute)
# if __has_cpp_attribute(nodiscard)
# define ONIXS_FIXENGINE_NODISCARD [[nodiscard]]
# endif
# endif
#endif
#if defined(__has_cpp_attribute)
# if __has_cpp_attribute(unlikely)
# define ONIXS_FIXENGINE_UNLIKELY_ATTR [[unlikely]]
# endif
#endif
#if !defined(ONIXS_FIXENGINE_UNLIKELY_ATTR)
# define ONIXS_FIXENGINE_UNLIKELY_ATTR
#endif
#if defined(__has_cpp_attribute)
# if __has_cpp_attribute(likely)
# define ONIXS_FIXENGINE_LIKELY_ATTR [[likely]]
# endif
#endif
#if !defined(ONIXS_FIXENGINE_LIKELY_ATTR)
# define ONIXS_FIXENGINE_LIKELY_ATTR
#endif
#if !defined(ONIXS_FIXENGINE_NODISCARD)
# define ONIXS_FIXENGINE_NODISCARD
#endif
#if defined(__GNUC__)
# define ONIXS_FIXENGINE_UNUSED __attribute__((__unused__))
#else
# define ONIXS_FIXENGINE_UNUSED
#endif
#if defined(__GNUC__)
# define ONIXS_FIXENGINE_LIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), true))
# define ONIXS_FIXENGINE_UNLIKELY(cond) (__builtin_expect((static_cast<bool>((cond))), false))
#else
# if defined(__has_cpp_attribute)
# if __has_cpp_attribute(unlikely)
# define ONIXS_FIXENGINE_UNLIKELY(cond) ((cond)) [[unlikely]]
# define ONIXS_FIXENGINE_LIKELY(cond) ((cond)) [[likely]]
# endif
# endif
#endif
#if !defined(ONIXS_FIXENGINE_LIKELY)
# define ONIXS_FIXENGINE_LIKELY(cond) ((cond))
#endif
#if !defined(ONIXS_FIXENGINE_UNLIKELY)
# define ONIXS_FIXENGINE_UNLIKELY(cond) ((cond))
#endif
#if defined(__GNUC__)
#define ONIXS_FIXENGINE_HOTPATH __attribute__((hot))
#define ONIXS_FIXENGINE_COLDPATH __attribute__((noinline,cold))
#define ONIXS_FIXENGINE_PURE __attribute__((pure))
#else
#if defined(_MSC_VER)
#define ONIXS_FIXENGINE_COLDPATH __declspec(noinline)
#else
#define ONIXS_FIXENGINE_COLDPATH
#endif
#define ONIXS_FIXENGINE_HOTPATH
#define ONIXS_FIXENGINE_PURE
#endif
#if defined (ONIXS_FIXENGINE_CXX11)
# define ONIXS_FIXENGINE_HAS_TYPE_TRAITS
#endif
#if defined(ONIXS_FIXENGINE_CXX17)
# define ONIXS_FIXENGINE_HAS_STRING_VIEW
#endif
#if defined(ONIXS_FIXENGINE_COMPILER_CXX_DEFAULTED_FUNCTIONS) && ONIXS_FIXENGINE_COMPILER_CXX_DEFAULTED_FUNCTIONS
# define ONIXS_FIXENGINE_DEFAULT = default;
#else
# define ONIXS_FIXENGINE_DEFAULT {}
#endif
#if defined NDEBUG
# define ONIXS_FIXENGINE_ASSERT(CHECK) void(0)
#else
# if !defined(ONIXS_FIXENGINE_CXX11)
# define ONIXS_FIXENGINE_ASSERT(CHECK) (assert((CHECK)))
# else
# define ONIXS_FIXENGINE_ASSERT(CHECK) \
(ONIXS_FIXENGINE_LIKELY(CHECK) ? void(0) : []() {assert(!#CHECK);}())
# endif
#endif
#define ONIXS_FIXENGINE_HARDWARE_DESTRUCTIVE_INTERFACE_SIZE (64)
#else //#if !(defined(ONIXS_DOXYGEN) && ONIXS_DOXYGEN)
#define ONIXS_FIXENGINE_CXX11
#define ONIXS_FIXENGINE_UNUSED
#define ONIXS_FIXENGINE_EXPORTED
#define ONIXS_FIXENGINE_GCC44_SPURIOUS_WARNING_TURNAROUND
#define ONIXS_FIXENGINE_NOTHROW noexcept
#define ONIXS_FIXENGINE_EXPLICIT explicit
#define ONIXS_FIXENGINE_CONST_OR_CONSTEXPR constexpr
#define ONIXS_FIXENGINE_CONSTEXPR constexpr
#define ONIXS_FIXENGINE_OVERRIDE override
#define ONIXS_FIXENGINE_FINAL final
#define ONIXS_FIXENGINE_COMPILER_CXX_NULLPTR nullptr
#define ONIXS_FIXENGINE_NORETURN
#define ONIXS_FIXENGINE_NODISCARD
#define ONIXS_FIXENGINE_HOTPATH
#define ONIXS_FIXENGINE_COLDPATH
#define ONIXS_FIXENGINE_PURE
#define ONIXS_FIXENGINE_HAS_TYPE_TRAITS
#define ONIXS_FIXENGINE_HAS_STRING_VIEW
#endif
@@ -0,0 +1,532 @@
// This is a generated file. Do not edit!
#ifndef ONIXS_FIXENGINE_COMPILER_DETECTION_H
#define ONIXS_FIXENGINE_COMPILER_DETECTION_H
#ifdef __cplusplus
# define ONIXS_FIXENGINE_COMPILER_IS_Comeau 0
# define ONIXS_FIXENGINE_COMPILER_IS_Intel 0
# define ONIXS_FIXENGINE_COMPILER_IS_IntelLLVM 0
# define ONIXS_FIXENGINE_COMPILER_IS_PathScale 0
# define ONIXS_FIXENGINE_COMPILER_IS_Embarcadero 0
# define ONIXS_FIXENGINE_COMPILER_IS_Borland 0
# define ONIXS_FIXENGINE_COMPILER_IS_Watcom 0
# define ONIXS_FIXENGINE_COMPILER_IS_OpenWatcom 0
# define ONIXS_FIXENGINE_COMPILER_IS_SunPro 0
# define ONIXS_FIXENGINE_COMPILER_IS_HP 0
# define ONIXS_FIXENGINE_COMPILER_IS_Compaq 0
# define ONIXS_FIXENGINE_COMPILER_IS_zOS 0
# define ONIXS_FIXENGINE_COMPILER_IS_IBMClang 0
# define ONIXS_FIXENGINE_COMPILER_IS_XLClang 0
# define ONIXS_FIXENGINE_COMPILER_IS_XL 0
# define ONIXS_FIXENGINE_COMPILER_IS_VisualAge 0
# define ONIXS_FIXENGINE_COMPILER_IS_NVHPC 0
# define ONIXS_FIXENGINE_COMPILER_IS_PGI 0
# define ONIXS_FIXENGINE_COMPILER_IS_Cray 0
# define ONIXS_FIXENGINE_COMPILER_IS_TI 0
# define ONIXS_FIXENGINE_COMPILER_IS_FujitsuClang 0
# define ONIXS_FIXENGINE_COMPILER_IS_Fujitsu 0
# define ONIXS_FIXENGINE_COMPILER_IS_GHS 0
# define ONIXS_FIXENGINE_COMPILER_IS_Tasking 0
# define ONIXS_FIXENGINE_COMPILER_IS_SCO 0
# define ONIXS_FIXENGINE_COMPILER_IS_ARMCC 0
# define ONIXS_FIXENGINE_COMPILER_IS_AppleClang 0
# define ONIXS_FIXENGINE_COMPILER_IS_ARMClang 0
# define ONIXS_FIXENGINE_COMPILER_IS_Clang 0
# define ONIXS_FIXENGINE_COMPILER_IS_LCC 0
# define ONIXS_FIXENGINE_COMPILER_IS_GNU 0
# define ONIXS_FIXENGINE_COMPILER_IS_MSVC 0
# define ONIXS_FIXENGINE_COMPILER_IS_ADSP 0
# define ONIXS_FIXENGINE_COMPILER_IS_IAR 0
# define ONIXS_FIXENGINE_COMPILER_IS_MIPSpro 0
#if defined(__COMO__)
# undef ONIXS_FIXENGINE_COMPILER_IS_Comeau
# define ONIXS_FIXENGINE_COMPILER_IS_Comeau 1
#elif defined(__INTEL_COMPILER) || defined(__ICC)
# undef ONIXS_FIXENGINE_COMPILER_IS_Intel
# define ONIXS_FIXENGINE_COMPILER_IS_Intel 1
#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER)
# undef ONIXS_FIXENGINE_COMPILER_IS_IntelLLVM
# define ONIXS_FIXENGINE_COMPILER_IS_IntelLLVM 1
#elif defined(__PATHCC__)
# undef ONIXS_FIXENGINE_COMPILER_IS_PathScale
# define ONIXS_FIXENGINE_COMPILER_IS_PathScale 1
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
# undef ONIXS_FIXENGINE_COMPILER_IS_Embarcadero
# define ONIXS_FIXENGINE_COMPILER_IS_Embarcadero 1
#elif defined(__BORLANDC__)
# undef ONIXS_FIXENGINE_COMPILER_IS_Borland
# define ONIXS_FIXENGINE_COMPILER_IS_Borland 1
#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
# undef ONIXS_FIXENGINE_COMPILER_IS_Watcom
# define ONIXS_FIXENGINE_COMPILER_IS_Watcom 1
#elif defined(__WATCOMC__)
# undef ONIXS_FIXENGINE_COMPILER_IS_OpenWatcom
# define ONIXS_FIXENGINE_COMPILER_IS_OpenWatcom 1
#elif defined(__SUNPRO_CC)
# undef ONIXS_FIXENGINE_COMPILER_IS_SunPro
# define ONIXS_FIXENGINE_COMPILER_IS_SunPro 1
#elif defined(__HP_aCC)
# undef ONIXS_FIXENGINE_COMPILER_IS_HP
# define ONIXS_FIXENGINE_COMPILER_IS_HP 1
#elif defined(__DECCXX)
# undef ONIXS_FIXENGINE_COMPILER_IS_Compaq
# define ONIXS_FIXENGINE_COMPILER_IS_Compaq 1
#elif defined(__IBMCPP__) && defined(__COMPILER_VER__)
# undef ONIXS_FIXENGINE_COMPILER_IS_zOS
# define ONIXS_FIXENGINE_COMPILER_IS_zOS 1
#elif defined(__open_xl__) && defined(__clang__)
# undef ONIXS_FIXENGINE_COMPILER_IS_IBMClang
# define ONIXS_FIXENGINE_COMPILER_IS_IBMClang 1
#elif defined(__ibmxl__) && defined(__clang__)
# undef ONIXS_FIXENGINE_COMPILER_IS_XLClang
# define ONIXS_FIXENGINE_COMPILER_IS_XLClang 1
#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800
# undef ONIXS_FIXENGINE_COMPILER_IS_XL
# define ONIXS_FIXENGINE_COMPILER_IS_XL 1
#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800
# undef ONIXS_FIXENGINE_COMPILER_IS_VisualAge
# define ONIXS_FIXENGINE_COMPILER_IS_VisualAge 1
#elif defined(__NVCOMPILER)
# undef ONIXS_FIXENGINE_COMPILER_IS_NVHPC
# define ONIXS_FIXENGINE_COMPILER_IS_NVHPC 1
#elif defined(__PGI)
# undef ONIXS_FIXENGINE_COMPILER_IS_PGI
# define ONIXS_FIXENGINE_COMPILER_IS_PGI 1
#elif defined(_CRAYC)
# undef ONIXS_FIXENGINE_COMPILER_IS_Cray
# define ONIXS_FIXENGINE_COMPILER_IS_Cray 1
#elif defined(__TI_COMPILER_VERSION__)
# undef ONIXS_FIXENGINE_COMPILER_IS_TI
# define ONIXS_FIXENGINE_COMPILER_IS_TI 1
#elif defined(__CLANG_FUJITSU)
# undef ONIXS_FIXENGINE_COMPILER_IS_FujitsuClang
# define ONIXS_FIXENGINE_COMPILER_IS_FujitsuClang 1
#elif defined(__FUJITSU)
# undef ONIXS_FIXENGINE_COMPILER_IS_Fujitsu
# define ONIXS_FIXENGINE_COMPILER_IS_Fujitsu 1
#elif defined(__ghs__)
# undef ONIXS_FIXENGINE_COMPILER_IS_GHS
# define ONIXS_FIXENGINE_COMPILER_IS_GHS 1
#elif defined(__TASKING__)
# undef ONIXS_FIXENGINE_COMPILER_IS_Tasking
# define ONIXS_FIXENGINE_COMPILER_IS_Tasking 1
#elif defined(__SCO_VERSION__)
# undef ONIXS_FIXENGINE_COMPILER_IS_SCO
# define ONIXS_FIXENGINE_COMPILER_IS_SCO 1
#elif defined(__ARMCC_VERSION) && !defined(__clang__)
# undef ONIXS_FIXENGINE_COMPILER_IS_ARMCC
# define ONIXS_FIXENGINE_COMPILER_IS_ARMCC 1
#elif defined(__clang__) && defined(__apple_build_version__)
# undef ONIXS_FIXENGINE_COMPILER_IS_AppleClang
# define ONIXS_FIXENGINE_COMPILER_IS_AppleClang 1
#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
# undef ONIXS_FIXENGINE_COMPILER_IS_ARMClang
# define ONIXS_FIXENGINE_COMPILER_IS_ARMClang 1
#elif defined(__clang__)
# undef ONIXS_FIXENGINE_COMPILER_IS_Clang
# define ONIXS_FIXENGINE_COMPILER_IS_Clang 1
#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__))
# undef ONIXS_FIXENGINE_COMPILER_IS_LCC
# define ONIXS_FIXENGINE_COMPILER_IS_LCC 1
#elif defined(__GNUC__) || defined(__GNUG__)
# undef ONIXS_FIXENGINE_COMPILER_IS_GNU
# define ONIXS_FIXENGINE_COMPILER_IS_GNU 1
#elif defined(_MSC_VER)
# undef ONIXS_FIXENGINE_COMPILER_IS_MSVC
# define ONIXS_FIXENGINE_COMPILER_IS_MSVC 1
#elif defined(_ADI_COMPILER)
# undef ONIXS_FIXENGINE_COMPILER_IS_ADSP
# define ONIXS_FIXENGINE_COMPILER_IS_ADSP 1
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
# undef ONIXS_FIXENGINE_COMPILER_IS_IAR
# define ONIXS_FIXENGINE_COMPILER_IS_IAR 1
#endif
# if ONIXS_FIXENGINE_COMPILER_IS_GNU
# if !((__GNUC__ * 100 + __GNUC_MINOR__) >= 404)
# error Unsupported compiler version
# endif
# if defined(__GNUC__)
# define ONIXS_FIXENGINE_COMPILER_VERSION_MAJOR (__GNUC__)
# else
# define ONIXS_FIXENGINE_COMPILER_VERSION_MAJOR (__GNUG__)
# endif
# if defined(__GNUC_MINOR__)
# define ONIXS_FIXENGINE_COMPILER_VERSION_MINOR (__GNUC_MINOR__)
# endif
# if defined(__GNUC_PATCHLEVEL__)
# define ONIXS_FIXENGINE_COMPILER_VERSION_PATCH (__GNUC_PATCHLEVEL__)
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L
# define ONIXS_FIXENGINE_COMPILER_CXX_FINAL 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_FINAL 0
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L
# define ONIXS_FIXENGINE_COMPILER_CXX_OVERRIDE 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_OVERRIDE 0
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
# define ONIXS_FIXENGINE_COMPILER_CXX_NOEXCEPT 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_NOEXCEPT 0
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
# define ONIXS_FIXENGINE_COMPILER_CXX_CONSTEXPR 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_CONSTEXPR 0
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
# define ONIXS_FIXENGINE_COMPILER_CXX_EXPLICIT_CONVERSIONS 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_EXPLICIT_CONVERSIONS 0
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
# define ONIXS_FIXENGINE_COMPILER_CXX_NULLPTR 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_NULLPTR 0
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
# define ONIXS_FIXENGINE_COMPILER_CXX_RVALUE_REFERENCES 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_RVALUE_REFERENCES 0
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
# define ONIXS_FIXENGINE_COMPILER_CXX_STATIC_ASSERT 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_STATIC_ASSERT 0
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L
# define ONIXS_FIXENGINE_COMPILER_CXX_ALIGNAS 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_ALIGNAS 0
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && __cplusplus >= 201103L
# define ONIXS_FIXENGINE_COMPILER_CXX_ALIAS_TEMPLATES 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_ALIAS_TEMPLATES 0
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L
# define ONIXS_FIXENGINE_COMPILER_CXX_THREAD_LOCAL 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_THREAD_LOCAL 0
# endif
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 404 && (__cplusplus >= 201103L || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__))
# define ONIXS_FIXENGINE_COMPILER_CXX_DEFAULTED_FUNCTIONS 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_DEFAULTED_FUNCTIONS 0
# endif
# elif ONIXS_FIXENGINE_COMPILER_IS_MSVC
# if !(_MSC_VER >= 1600)
# error Unsupported compiler version
# endif
/* _MSC_VER = VVRR */
# define ONIXS_FIXENGINE_COMPILER_VERSION_MAJOR (_MSC_VER / 100)
# define ONIXS_FIXENGINE_COMPILER_VERSION_MINOR (_MSC_VER % 100)
# if defined(_MSC_FULL_VER)
# if _MSC_VER >= 1400
/* _MSC_FULL_VER = VVRRPPPPP */
# define ONIXS_FIXENGINE_COMPILER_VERSION_PATCH (_MSC_FULL_VER % 100000)
# else
/* _MSC_FULL_VER = VVRRPPPP */
# define ONIXS_FIXENGINE_COMPILER_VERSION_PATCH (_MSC_FULL_VER % 10000)
# endif
# endif
# if defined(_MSC_BUILD)
# define ONIXS_FIXENGINE_COMPILER_VERSION_TWEAK (_MSC_BUILD)
# endif
# if _MSC_VER >= 1700
# define ONIXS_FIXENGINE_COMPILER_CXX_FINAL 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_FINAL 0
# endif
# if _MSC_VER >= 1600
# define ONIXS_FIXENGINE_COMPILER_CXX_OVERRIDE 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_OVERRIDE 0
# endif
# if _MSC_VER >= 1900
# define ONIXS_FIXENGINE_COMPILER_CXX_NOEXCEPT 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_NOEXCEPT 0
# endif
# if _MSC_VER >= 1900
# define ONIXS_FIXENGINE_COMPILER_CXX_CONSTEXPR 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_CONSTEXPR 0
# endif
# if _MSC_VER >= 1800
# define ONIXS_FIXENGINE_COMPILER_CXX_EXPLICIT_CONVERSIONS 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_EXPLICIT_CONVERSIONS 0
# endif
# if _MSC_VER >= 1600
# define ONIXS_FIXENGINE_COMPILER_CXX_NULLPTR 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_NULLPTR 0
# endif
# if _MSC_VER >= 1600
# define ONIXS_FIXENGINE_COMPILER_CXX_RVALUE_REFERENCES 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_RVALUE_REFERENCES 0
# endif
# if _MSC_VER >= 1600
# define ONIXS_FIXENGINE_COMPILER_CXX_STATIC_ASSERT 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_STATIC_ASSERT 0
# endif
# if _MSC_VER >= 1900
# define ONIXS_FIXENGINE_COMPILER_CXX_ALIGNAS 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_ALIGNAS 0
# endif
# if _MSC_VER >= 1800
# define ONIXS_FIXENGINE_COMPILER_CXX_ALIAS_TEMPLATES 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_ALIAS_TEMPLATES 0
# endif
# if _MSC_VER >= 1900
# define ONIXS_FIXENGINE_COMPILER_CXX_THREAD_LOCAL 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_THREAD_LOCAL 0
# endif
# if _MSC_VER >= 1800
# define ONIXS_FIXENGINE_COMPILER_CXX_DEFAULTED_FUNCTIONS 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_DEFAULTED_FUNCTIONS 0
# endif
# elif ONIXS_FIXENGINE_COMPILER_IS_Clang
# if !(((__clang_major__ * 100) + __clang_minor__) >= 301)
# error Unsupported compiler version
# endif
# define ONIXS_FIXENGINE_COMPILER_VERSION_MAJOR (__clang_major__)
# define ONIXS_FIXENGINE_COMPILER_VERSION_MINOR (__clang_minor__)
# define ONIXS_FIXENGINE_COMPILER_VERSION_PATCH (__clang_patchlevel__)
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define ONIXS_FIXENGINE_SIMULATE_VERSION_MAJOR (_MSC_VER / 100)
# define ONIXS_FIXENGINE_SIMULATE_VERSION_MINOR (_MSC_VER % 100)
# endif
# if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_override_control)
# define ONIXS_FIXENGINE_COMPILER_CXX_FINAL 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_FINAL 0
# endif
# if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_override_control)
# define ONIXS_FIXENGINE_COMPILER_CXX_OVERRIDE 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_OVERRIDE 0
# endif
# if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_noexcept)
# define ONIXS_FIXENGINE_COMPILER_CXX_NOEXCEPT 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_NOEXCEPT 0
# endif
# if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_constexpr)
# define ONIXS_FIXENGINE_COMPILER_CXX_CONSTEXPR 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_CONSTEXPR 0
# endif
# if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_explicit_conversions)
# define ONIXS_FIXENGINE_COMPILER_CXX_EXPLICIT_CONVERSIONS 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_EXPLICIT_CONVERSIONS 0
# endif
# if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_nullptr)
# define ONIXS_FIXENGINE_COMPILER_CXX_NULLPTR 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_NULLPTR 0
# endif
# if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_rvalue_references)
# define ONIXS_FIXENGINE_COMPILER_CXX_RVALUE_REFERENCES 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_RVALUE_REFERENCES 0
# endif
# if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_static_assert)
# define ONIXS_FIXENGINE_COMPILER_CXX_STATIC_ASSERT 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_STATIC_ASSERT 0
# endif
# if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_alignas)
# define ONIXS_FIXENGINE_COMPILER_CXX_ALIGNAS 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_ALIGNAS 0
# endif
# if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_alias_templates)
# define ONIXS_FIXENGINE_COMPILER_CXX_ALIAS_TEMPLATES 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_ALIAS_TEMPLATES 0
# endif
# if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_thread_local)
# define ONIXS_FIXENGINE_COMPILER_CXX_THREAD_LOCAL 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_THREAD_LOCAL 0
# endif
# if ((__clang_major__ * 100) + __clang_minor__) >= 301 && __has_feature(cxx_defaulted_functions)
# define ONIXS_FIXENGINE_COMPILER_CXX_DEFAULTED_FUNCTIONS 1
# else
# define ONIXS_FIXENGINE_COMPILER_CXX_DEFAULTED_FUNCTIONS 0
# endif
# else
# error Unsupported compiler
# endif
# if defined(ONIXS_FIXENGINE_COMPILER_CXX_FINAL) && ONIXS_FIXENGINE_COMPILER_CXX_FINAL
# define ONIXS_FIXENGINE_FINAL final
# else
# define ONIXS_FIXENGINE_FINAL
# endif
# if defined(ONIXS_FIXENGINE_COMPILER_CXX_OVERRIDE) && ONIXS_FIXENGINE_COMPILER_CXX_OVERRIDE
# define ONIXS_FIXENGINE_OVERRIDE override
# else
# define ONIXS_FIXENGINE_OVERRIDE
# endif
# if defined(ONIXS_FIXENGINE_COMPILER_CXX_NOEXCEPT) && ONIXS_FIXENGINE_COMPILER_CXX_NOEXCEPT
# define ONIXS_FIXENGINE_NOEXCEPT noexcept
# define ONIXS_FIXENGINE_NOEXCEPT_EXPR(X) noexcept(X)
# else
# define ONIXS_FIXENGINE_NOEXCEPT
# define ONIXS_FIXENGINE_NOEXCEPT_EXPR(X)
# endif
# if defined(ONIXS_FIXENGINE_COMPILER_CXX_CONSTEXPR) && ONIXS_FIXENGINE_COMPILER_CXX_CONSTEXPR
# define ONIXS_FIXENGINE_CONSTEXPR constexpr
# else
# define ONIXS_FIXENGINE_CONSTEXPR
# endif
# if defined(ONIXS_FIXENGINE_COMPILER_CXX_NULLPTR) && ONIXS_FIXENGINE_COMPILER_CXX_NULLPTR
# define ONIXS_FIXENGINE_NULLPTR nullptr
# elif ONIXS_FIXENGINE_COMPILER_IS_GNU
# define ONIXS_FIXENGINE_NULLPTR __null
# else
# define ONIXS_FIXENGINE_NULLPTR 0
# endif
# if defined(ONIXS_FIXENGINE_COMPILER_CXX_STATIC_ASSERT) && ONIXS_FIXENGINE_COMPILER_CXX_STATIC_ASSERT
# define ONIXS_FIXENGINE_STATIC_ASSERT(X) static_assert(X, #X)
# define ONIXS_FIXENGINE_STATIC_ASSERT_MSG(X, MSG) static_assert(X, MSG)
# else
# define ONIXS_FIXENGINE_STATIC_ASSERT_JOIN(X, Y) ONIXS_FIXENGINE_STATIC_ASSERT_JOIN_IMPL(X, Y)
# define ONIXS_FIXENGINE_STATIC_ASSERT_JOIN_IMPL(X, Y) X##Y
template<bool> struct ONIXS_FIXENGINEStaticAssert;
template<> struct ONIXS_FIXENGINEStaticAssert<true>{};
# define ONIXS_FIXENGINE_STATIC_ASSERT(X) enum { ONIXS_FIXENGINE_STATIC_ASSERT_JOIN(ONIXS_FIXENGINEStaticAssertEnum, __LINE__) = sizeof(ONIXS_FIXENGINEStaticAssert<X>) }
# define ONIXS_FIXENGINE_STATIC_ASSERT_MSG(X, MSG) enum { ONIXS_FIXENGINE_STATIC_ASSERT_JOIN(ONIXS_FIXENGINEStaticAssertEnum, __LINE__) = sizeof(ONIXS_FIXENGINEStaticAssert<X>) }
# endif
# if defined(ONIXS_FIXENGINE_COMPILER_CXX_ALIGNAS) && ONIXS_FIXENGINE_COMPILER_CXX_ALIGNAS
# define ONIXS_FIXENGINE_ALIGNAS(X) alignas(X)
# elif ONIXS_FIXENGINE_COMPILER_IS_GNU || ONIXS_FIXENGINE_COMPILER_IS_Clang || ONIXS_FIXENGINE_COMPILER_IS_AppleClang
# define ONIXS_FIXENGINE_ALIGNAS(X) __attribute__ ((__aligned__(X)))
# elif ONIXS_FIXENGINE_COMPILER_IS_MSVC
# define ONIXS_FIXENGINE_ALIGNAS(X) __declspec(align(X))
# else
# define ONIXS_FIXENGINE_ALIGNAS(X)
# endif
# if defined(ONIXS_FIXENGINE_COMPILER_CXX_THREAD_LOCAL) && ONIXS_FIXENGINE_COMPILER_CXX_THREAD_LOCAL
# define ONIXS_FIXENGINE_THREAD_LOCAL thread_local
# elif ONIXS_FIXENGINE_COMPILER_IS_GNU || ONIXS_FIXENGINE_COMPILER_IS_Clang || ONIXS_FIXENGINE_COMPILER_IS_AppleClang
# define ONIXS_FIXENGINE_THREAD_LOCAL __thread
# elif ONIXS_FIXENGINE_COMPILER_IS_MSVC
# define ONIXS_FIXENGINE_THREAD_LOCAL __declspec(thread)
# else
// ONIXS_FIXENGINE_THREAD_LOCAL not defined for this configuration.
# endif
#endif
#endif
@@ -0,0 +1,50 @@
#pragma once
/*
* 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.
*/
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Cryptography/Definitions.h>
#include <string>
namespace OnixS {
namespace Cryptography {
/// The BASE64 encoding service.
class ONIXS_FIXENGINE_API Base64Encoding
{
public:
/// Returns the BASE64 presentation of the binary data.
/// @note Encoding throws nothing.
static std::string encode(const void * data, const size_t dataSize);
/// Reconstructs the binary data from the BASE64-encoded text.
/// @throw An exception if the text is corrupted or not BASE64-encoded.
static void decode(ByteArray & decoded, const std::string & encoded);
/// Returns the BASE64URL presentation of the binary data.
/// @note Encoding throws nothing.
static std::string encodeUrl(const void * data, const size_t dataSize);
/// Reconstructs the binary data from the BASE64URL-encoded text.
/// @throw An exception if the text is corrupted or not BASE64URL-encoded.
static void decodeUrl(ByteArray & decoded, const std::string & encoded);
};
}
}
@@ -0,0 +1,43 @@
#pragma once
/*
* 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.
*/
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Cryptography/Definitions.h>
#include <string>
namespace OnixS {
namespace Cryptography {
/// The cryptography service.
class ONIXS_FIXENGINE_API Cryptograph
{
public:
/// Produces the signature using HMAC-SHA256.
///
/// @param key Secret key bytes to produce the signature.
/// @param data The user data to produce the signature.
/// @param result The resulting HMAC-SHA256 signature.
///
/// @throw An exception in case of any issues during the calculation of the signature.
static void calculateHmacSha256(const ByteArray & key, const std::string & data, ByteArray & result);
};
}
}
@@ -0,0 +1,31 @@
/*
* 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/FIXEngine/ABI.h>
#include <vector>
namespace OnixS {
namespace Cryptography {
/// The simple presentation of the byte sequence.
typedef std::vector<unsigned char> ByteArray;
}
}
@@ -0,0 +1,138 @@
#pragma once
/*
* 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.
*/
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/FIX/StringRef.h>
namespace OnixS {
namespace Cryptography {
/// The immutable secure string
class ONIXS_FIXENGINE_API SecureString
{
public:
/// Constructs the empty SecureString.
SecureString();
/// Constructs the SecureString which stores the encrypted plainText.
///
/// @param plainText The plain text to be encrypted and stored.
explicit SecureString(FIX::StringRef plainText);
/// Constructs the SecureString which stores the encrypted plainText.
///
/// @param plainText The plain text to be encrypted and stored.
/// @param plainTextLength The plain text length.
SecureString(const char * plainText, size_t plainTextLength);
/// Initializes the instance as a shallow copy of other one.
SecureString(const SecureString & other);
/// Makes a shallow copy of another SecureString.
SecureString & operator=(const SecureString & other);
/// Disposes all internal data structures.
~SecureString();
/// The length of the plain string.
size_t length() const;
/// Indicates whether the SecureString has no data.
bool empty() const;
protected:
class Impl;
SecureString(const Impl *);
private:
const Impl * impl_;
};
/// The editable secure string.
class ONIXS_FIXENGINE_API SecureStringBuilder
{
public:
/// Constructs the empty SecureStringBuilder.
explicit SecureStringBuilder();
/// Constructs the SecureStringBuilder which stores the encrypted plainText as an initial value.
///
/// @param plainText The plain text to be encrypted and stored.
explicit SecureStringBuilder(FIX::StringRef plainText);
/// Constructs the SecureStringBuilder which stores the encrypted plainText as an initial value.
///
/// @param plainText The plain text to be encrypted and stored.
/// @param plainTextLength The plain text length.
SecureStringBuilder(const char * plainText, size_t plainTextLength);
/// Initializes the instance as a deep copy of other one.
SecureStringBuilder(const SecureStringBuilder & other);
/// Makes a deep copy of another SecureStringBuilder.
SecureStringBuilder & operator=(const SecureStringBuilder & other);
~SecureStringBuilder();
/// Gets the number of characters in the current secure string.
size_t length() const;
/// Moves the encoded data to the immutable SecureString object.
///
/// SecureStringBuilder becomes empty after detaching.
SecureString detach();
/// Replaces the secure value with a new one.
///
/// @param plainText plain text to be encrypted and stored.
void assign(FIX::StringRef plainText);
/// Replaces internal value with a new one.
///
/// @param plainText The plain text to be encrypted and stored.
/// @param plainTextLength The plain text length.
void assign(const char * plainText, size_t plainTextLength);
/// Appends a character to the end of the current secure string.
void append(char c);
/// Inserts a character in this secure string at the specified index position.
void insert(size_t index, char c);
/// Replaces the existing character at the specified index position with another character.
void replace(size_t index, char c);
/// Removes the character at the specified index position from this secure string.
void erase(size_t index);
/// Deletes the value of the current secure string.
void clear();
protected:
class Impl;
private:
Impl * impl_;
};
}
}
@@ -0,0 +1,36 @@
/*
* 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 <memory>
namespace OnixS {
template <typename T>
struct PtrTraits
{
#if __cplusplus >= 201103L || defined (_WIN32)
typedef std::unique_ptr<T> UniquePtr;
#else
typedef std::auto_ptr<T> UniquePtr;
#endif
};
}
@@ -0,0 +1,164 @@
/*
* 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 <string>
#include <vector>
#include <OnixS/FIXEngine/FIX/Tag.h>
#include <OnixS/FIXEngine/FIX/ProtocolVersion.h>
namespace OnixS {
namespace FIX {
/// Identifies attributes of a valid FIX field value.
class ONIXS_FIXENGINE_API ValidFieldValue
{
public:
/// Returns a valid value of the corresponding FIX field.
std::string value() const;
/// Returns a valid value description of the corresponding FIX field.
std::string description() const;
private:
friend class MessageOperator;
const char * value_;
const char * description_;
ValidFieldValue(const char * value, const char * description);
};
/// Identifies attributes of a FIX field.
class ONIXS_FIXENGINE_API FieldInfo
{
public:
/// Returns the tag number of the corresponding FIX field.
Tag tag() const;
/// Indicates if this field is a required one.
bool isRequired() const;
/// Returns the collection of child fields if this field identifies the repeating group.
std::vector<FieldInfo> childFields() const;
private:
friend class MessageOperator;
const void * impl_;
FieldInfo(const void *);
};
/// Identifies the FIX messages dictionary.
class ONIXS_FIXENGINE_API Dictionary
{
public:
/// Initializes the dictionary according to the
/// definition from the Engine configuration file.
///
/// @param id The identifier of the FIX dictionary as specified in
/// the dictionary XML description by the 'id' attribute of the 'FIX' node.
Dictionary(const char * id);
/// Creates the dictionary that corresponds to
/// the given FIX Protocol version.
Dictionary(ProtocolVersion::Enum version);
/// The dictionary unique identifier.
const std::string & id() const;
/// The version of the FIX messaging specification
/// (protocol) on which the dictionary is based.
ProtocolVersion::Enum version() const;
/// Returns the name of the corresponding FIX field.
///
/// @return The name of corresponding FIX field
/// or an empty string if the field is unknown.
const std::string & fieldName(Tag tag) const;
/// Returns the tag number of the corresponding FIX field.
///
/// @return The tag number of the corresponding FIX field
/// or 0 if the field is unknown.
Tag fieldNumber(const std::string & name) const;
/// Returns the value description (if it exists) of the corresponding FIX field value.
///
/// @return The value description of the corresponding FIX field value
/// or an empty string if there is no a description for this field value
/// or the field is unknown.
std::string fieldValueDescription(Tag tag, const std::string & value) const;
/// The collection of valid field values.
typedef std::vector<ValidFieldValue> ValidFieldValues;
/// Returns valid field values (if they exist) of the corresponding FIX field.
///
/// @return A set of valid field values of the corresponding FIX field value
/// or an empty set if there is no known valid field values for this field
/// or the field is unknown.
ValidFieldValues validFieldValues(Tag tag) const;
/// The collection of message types.
typedef std::vector<std::string> MessageTypes;
/// Returns a collection of types of all messages available in this particular FIX dictionary.
MessageTypes messageTypes() const;
/// Returns the message name by the given message type.
///
/// @return The message name by the given message type
/// or an empty string if the message type is unknown.
std::string messageName(const std::string & type) const;
/// The collection of the FIX field information.
typedef std::vector<FieldInfo> FieldInfos;
/// Returns a collection of field descriptions that belong to the given message.
FieldInfos messageFields(const std::string & type) const;
/// The collection of tag numbers.
typedef std::vector<Tag> Tags;
/// Returns a collection of all tags which belong to the dialect.
Tags tags() const;
/// Compares two dictionaries by their identifiers.
bool operator == (const Dictionary & other) const;
/// Compares two dictionaries by their identifiers.
bool operator != (const Dictionary & other) const;
/// Swaps two instances.
void swap(Dictionary & other);
private:
friend class MessageOperator;
const void * impl_;
Dictionary(const void *);
};
}
}
@@ -0,0 +1,37 @@
/*
* 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/FIXEngine/ABI.h>
namespace OnixS {
namespace FIX {
/// Defines encryption methods.
struct EncryptionMethod {
enum Enum {
/// No encryption.
None,
/// Secure Sockets Layer.
SSL
};
};
}
}
+191
View File
@@ -0,0 +1,191 @@
#pragma once
/*
* 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.
*/
#include <string>
#include <set>
#include <vector>
#include <OnixS/FIXEngine/Compiler.h>
#include <OnixS/FIXEngine/FIX/Timestamp.h>
#include <OnixS/FIXEngine/FIX/Dictionary.h>
namespace OnixS {
namespace FIX {
ONIXS_FIXENGINE_API_DECL(class, IEngineListener);
ONIXS_FIXENGINE_API_DECL(class, ISessionReactor);
ONIXS_FIXENGINE_API_DECL(class, EngineSettings);
typedef std::vector<OnixS::FIX::Dictionary> Dictionaries;
typedef std::vector<int> ListenPorts;
/// The FIX Engine.
class ONIXS_FIXENGINE_API Engine
{
public:
/// Initializes the FIX Engine.
///
/// @param listenPort The engine listens on this port for incoming connections.
/// If '0' then only session-initiators can be created.
/// If '-1' then the telecommunication level is disabled and only the message parsing/assembling can be used.
/// @param stack An instance of an externally managed reactor for acceptor sessions.
///
/// @note This call is thread-safe.
static Engine * init(int listenPort = 0, ISessionReactor * stack = ONIXS_FIXENGINE_NULLPTR);
/// Initializes the FIX Engine.
///
/// @param configFile The configuration file.
/// @param stack An instance of an externally managed reactor for acceptor sessions.
///
/// @note This call is thread-safe.
static Engine * init(const std::string & configFile, ISessionReactor * stack = ONIXS_FIXENGINE_NULLPTR);
/// Initializes the FIX Engine.
///
/// @param configuration The configuration string.
/// @param stack An instance of an externally managed reactor for acceptor sessions.
///
/// @note This call is thread-safe.
static Engine * initFromString(const std::string & configuration, ISessionReactor * stack = ONIXS_FIXENGINE_NULLPTR);
/// Initializes the FIX Engine.
///
/// @param settings Engine settings.
/// @param stack An instance of an externally managed reactor for acceptor sessions.
///
/// @note This call is thread-safe.
static Engine * init(const EngineSettings & settings, ISessionReactor * stack = ONIXS_FIXENGINE_NULLPTR);
/// Logs the given user's message to FIX Engine's log file.
///
/// @note This call is thread-safe.
void log(const std::string & message);
/// Shutdowns the FIX Engine and releases all resources.
///
/// @note This call is thread-safe.
static void shutdown();
/// Returns the Engine instance.
///
/// @throw The OnixS::DomainException if the FIX Engine has not been initialized yet.
///
/// @note This call is thread-safe.
static Engine * instance();
/// Returns 'true' if the FIX Engine has been initialized, otherwise - 'false'.
///
/// @note This call is thread-safe.
static bool initialized();
/// Returns the listen port.
///
/// The FIX Engine listens on this port for incoming connections.
int listenPort() const;
/// Returns the Engine log directory.
///
/// Inbound and outbound FIX messages, session's state data,
/// and the FIX Engine log file are stored in this directory.
const std::string & logDirectory() const;
/// Returns the Engine's license expiration date.
Timestamp licenseExpirationDate() const;
/// Returns the array of loaded dictionaries.
Dictionaries dictionaries() const;
/// Adds the session level dictionary(s) from the XML file(s) with the description of the FIX Dictionary(s).
/// @note More than one file could be specified. The symbol '|' is used as the file name delimiter.
/// @param dictionaryFile Specifies the path(s) to the XML file(s) with the description of the FIX Dictionary(s).
/// @throw The OnixS::DomainException if there are standard dictionary(s) in the XML file(s).
///
/// @note This call is thread-safe.
void addSessionDictionary(const std::string & dictionaryFile);
/// Adds the session level dictionary(s) from the plain text string with the description of the FIX Dictionary(s).
/// @param dialectString Specifies the plain text string with the description of the FIX Dictionary(s).
/// @throw The OnixS::DomainException if there are standard dictionary(s) in the dialect string.
///
/// @note This call is thread-safe.
void addSessionDictionaryFromString(const std::string & dialectString);
/// Adds the listen port(s) for incoming connections.
/// @throw An exception if the FIX Engine cannot start listening on the specified port(s) or the telecommunication level is disabled (the Listen Port is -1 or 0).
///
/// @note This call is thread-safe.
void addListenPort(int port);
void addListenPorts(const ListenPorts & ports);
/// Removes the listen port(s) for incoming connections.
/// @throw An exception if the telecommunication level is disabled (the Listen Port is -1 or 0).
///
/// @note This call is thread-safe.
void removeListenPort(int port);
void removeListenPorts(const ListenPorts & ports);
/// Adds the ssl listen port(s) for incoming ssl connections.
/// @throw An exception if the FIX Engine cannot start listening on the specified ssl port(s) or the telecommunication level is disabled (the Listen Port is -1 or 0).
///
/// @note This call is thread-safe.
void addSslListenPort(int port);
void addSslListenPorts(const ListenPorts & ports);
/// Removes the ssl listen port(s) for incoming ssl connections.
/// @throw An exception if the telecommunication level is disabled (the Listen Port is -1 or 0).
///
/// @note This call is thread-safe.
void removeSslListenPort(int port);
void removeSslListenPorts(const ListenPorts & ports);
/// Registers the Engine listener.
/// @throw An exception if the listener is already registered.
///
/// @note This call is thread-safe.
void registerListener(IEngineListener * listener);
/// Unregisters the Engine listener.
///
/// @note This call is thread-safe.
void unregisterListener();
/// Performs the synchronization of the high-resolution internal time service with the system time on the Windows OS.
/// On OSes less than Windows 8 and Windows Server 2012, the internal high-resolution time service, is based on the QueryPerformanceCounter API.
/// This service is synchronized with the system time only once when an application is started, as a result, a time difference can occur in time.
/// Therefore, for such old windows versions, it makes sense to synchronize the internal time service periodically (e.g. once per day) with the system time to avoid time drift issues.
///
/// @throw An exception if there is a session in the non-disconnected state.
///
/// @note This call is thread-safe.
/// @note The method should be called when all sessions are disconnected to avoid time resynchronization side effects.
void synchronizeHighResolutionTimeServiceWithSystemTime();
/// Returns the current Engine-level settings.
const EngineSettings & settings() const;
class Impl;
private:
Engine();
~Engine();
};
}
}
@@ -0,0 +1,567 @@
/*
* 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 <vector>
#include <string>
#include <OnixS/FIXEngine/FIX/Session.h>
namespace OnixS {
namespace System {
class ISettings;
}
}
namespace OnixS {
namespace FIX {
class Engine;
/// Listen ports.
typedef std::vector<int> ListenPorts;
/// Local interfaces
typedef std::string LocalNetworkInterface;
typedef std::vector<LocalNetworkInterface> LocalNetworkInterfaces;
/// FIX Engine settings.
class ONIXS_FIXENGINE_API EngineSettings
{
public:
/// The constructor.
EngineSettings();
/// The constructor to create the EngineSettings from a Configuration string.
explicit EngineSettings(const std::string & configuration);
/// The copy constructor.
EngineSettings(const EngineSettings &);
/// Loads Engine settings from a Configuration file.
void loadFromConfigFile(const std::string & configFile);
/// The destructor.
~EngineSettings();
/// The assignment.
EngineSettings & operator = (const EngineSettings &);
/// The option to create the FIX Engine log file.
EngineSettings & createEngineLogFile(bool value);
/// The option to create the FIX Engine log file.
bool createEngineLogFile() const;
/// Specifies the path(s) to the XML file(s) with the description of the FIX Dictionary(s).
///
/// @note More than one file could be specified. The symbol '|' is used as the file name delimiter.
EngineSettings & dictionaryFile(const std::string & value);
/// Returns the path to the XML file with the description of the FIX Dictionary(s).
const std::string & dictionaryFile() const;
/// Specifies the plain text string with a description of the FIX dialect.
EngineSettings & dialectString(const std::string & value);
/// Returns the string that contains the plain text string with the description of the FIX dialect.
const std::string & dialectString() const;
/// The FIX Engine listens on this port for incoming "plain text" connections.
///
/// @note If '0' then only session-initiators can be created.
/// @note If '-1' then the telecommunication level is disabled and only message parsing/assembling can be used.
EngineSettings & listenPort(int value);
/// The FIX Engine listens on this port for incoming "plain text" connections.
///
/// @note If '0' then only session-initiators can be created.
/// @note If '-1' then the telecommunication level is disabled and only message parsing/assembling can be used.
int listenPort() const;
/// Set listen ports.
EngineSettings & listenPorts(const ListenPorts & value);
/// Returns listen ports.
const ListenPorts & listenPorts() const;
/// The FIX Engine listens on these local interfaces for incoming "plain text" connections.
const LocalNetworkInterfaces & localNetworkInterface() const;
/// Sets local interfaces where the engine listen for incoming connections.
/// Each local interface specification could specify the local IP address and port. For instance, "localhost" and "192.168.0.1:4501" are valid values. When
/// a local interface specification contains the same port as specified at listenPort settings the listening appears only on the interface and port specified
/// at the localInterface setting.
/// @note At least a single listen port have to be specified to make the engine able to use this setting.
EngineSettings & localNetworkInterface(const LocalNetworkInterfaces &);
/// Sets the local interface where the engine listen for incoming connections.
/// Each local interface specification could specify the local IP address and port. For instance, "localhost" and "192.168.0.1:4501" are valid values. When
/// a local interface specification contains the same port as specified at listenPort settings the listening appears only on the interface and port specified
/// at the localInterface setting.
/// @note At least a single listen port have to be specified to make the engine able to use this setting.
EngineSettings & localNetworkInterface(const LocalNetworkInterface &);
/// Returns the default mode for outbound and incoming connections.
ThreadingModel::Enum threadingModel() const;
/// Sets the default mode for outbound and incoming connections.
EngineSettings & threadingModel(ThreadingModel::Enum value);
/// Returns the default mode for using a spin lock.
bool useSpinLock() const;
/// Returns the default mode for using a spin lock.
EngineSettings & useSpinLock(bool value);
/// Sets the thread pool size.
EngineSettings & threadPoolSize(int size);
/// Returns the thread pool size.
int threadPoolSize() const;
/// Specifies the path to the license file.
///
/// @deprecated This method is deprecated, the OnixS::FIX::EngineSettings::licenseStore(const std::string&) should be used instead.
EngineSettings & licenseFile(const std::string & value);
/// Returns the path to the license file.
///
/// @deprecated This method is deprecated, the OnixS::FIX::EngineSettings::licenseStore() should be used instead.
const std::string & licenseFile() const;
/// Specifies the path to the license directory.
///
/// @note More than one license store could be specified. The symbol '|' is used as the license store delimiter.
EngineSettings & licenseStore(const std::string & value);
/// Returns the path to the license directory.
const std::string & licenseStore() const;
/// Specifies the string of the license content.
EngineSettings & licenseString(const std::string & value);
/// Returns the string of the license content.
const std::string & licenseString() const;
/// Returns the number of days to alert before the license expiration.
unsigned licenseAlertingDaysBeforeExpiration();
/// Sets the number of days to alert before the license expiration.
/// If the amount of remaining license days is less or equal to this number
/// then the warning will be reported to the FIX Engine's log and IEngineListener::onWarning callback will be invoked.
/// The verification is performed during the following events: the FIX Engine initialization, Session::logonAsAcceptor and Session::logonAsInitiator calls.
EngineSettings & licenseAlertingDaysBeforeExpiration(unsigned value);
/// Inbound and outbound messages, session's state data and the FIX Engine log file (FixEngineLog.txt) are stored in this directory.
EngineSettings & logDirectory(const std::string & value);
/// Inbound and outbound messages, session's state data and the FIX Engine log file (FixEngineLog.txt) are stored in this directory.
const std::string & logDirectory() const;
/// Returns the FIX Engine log file name
const std::string & logFileName() const;
/// Sets the FIX Engine log file name
EngineSettings & logFileName(const std::string & value);
/// Returns 'true' if inbound messages are logged, otherwise - 'false'.
bool logInboundMessages() const;
/// The option to log inbound messages.
EngineSettings & logInboundMessages(bool value);
/// Returns 'true' if outbound messages are logged, otherwise - 'false'.
bool logOutboundMessages() const;
/// The option to log outbound messages.
EngineSettings & logOutboundMessages(bool value);
/// Returns 'true' if outbound messages are logged before sending, otherwise - 'false'.
bool logBeforeSending() const;
/// The option to switch on/off logging of outbound messages before/after sending.
EngineSettings & logBeforeSending(bool value);
/// Gets the usage of the local time in FIX Engine events and log files.
bool localTimeUsage() const;
/// Specifies the usage of the local time in FIX Engine events and log files.
/// @param value If it is true - the local time is used, if it is false - the UTC time is used.
EngineSettings & localTimeUsage(bool value);
/// The option to process the DeliverToCompID (tag 128) flag.
EngineSettings & processDeliverToCompId(bool value);
/// The option to process the DeliverToCompID (tag 128) flag.
bool processDeliverToCompId() const;
/// The reasonable transmission time as % from the HeartBtInt value.
///
/// When either end of the connection has not received any data for (HeartBtInt * (100 + ReasonableTransmissionTime)/100) seconds,
/// it will transmit a Test Request message.
///
/// If there is still no a Heartbeat message received after (HeartBtInt * (100 + ReasonableTransmissionTime)/100) seconds
/// then the connection should be considered lost and a corrective action should be initiated.
///
/// @see If you need to change this option for the separate session, please use
/// the OnixS::FIX::Session::setReasonableTransmissionTime(int).
EngineSettings & reasonableTransmissionTime(int value);
/// The reasonable transmission time as % from HeartBtInt value.
///
/// When either end of the connection has not received any data for (HeartBtInt * (100 + ReasonableTransmissionTime)/100) seconds,
/// it will transmit a Test Request message.
///
/// If there is still no a Heartbeat message received after (HeartBtInt * (100 + ReasonableTransmissionTime)/100) seconds
/// then the connection should be considered lost and a corrective action should be initiated.
///
/// @see You also can get a value of this option for separate session using
/// the OnixS::FIX::Session::getReasonableTransmissionTime().
int reasonableTransmissionTime() const;
/// Sets the number of attempts to restore the FIX connection.
EngineSettings & reconnectAttempts(int value);
/// Returns the number of attempts to restore the FIX connection.
int reconnectAttempts() const;
/// Sets the time interval between the attempts to restore the FIX connection (in seconds).
EngineSettings & reconnectInterval(int value);
/// Returns the time interval between the attempts to restore the FIX connection (in seconds).
int reconnectInterval() const;
/// Sets the number of sent messages that are available for the resending on the counterparty's Resend Request <2> message.
EngineSettings & resendingQueueSize(size_t value);
/// Returns the number of sent messages that are available for the resending on the counterparty's Resend Request <2> message.
/// The zero value means that sent messages are not available for the resending.
/// The value cannot be negative.
size_t resendingQueueSize() const;
/// Sets the maximum number of messages to be requested in one Resend Request (MsgType=2) message.
EngineSettings & resendRequestMaximumRange(int value);
/// Returns the maximum number of messages to be requested in one Resend Request (MsgType=2) message.
int resendRequestMaximumRange() const;
/// Specifies the usage of the operating system default RecvBuffer size.
static const int UseDefaultReceiveBufferSize;
/// Returns the size of the TCP buffer allocated to the FIX connection for receiving data.
/// If '-1' then the default operating system value is used.
int receiveBufferSize() const;
/// Sets the size of the TCP buffer allocated to the FIX connection for receiving data.
/// If '-1' then the default operating system value is used.
EngineSettings & receiveBufferSize(int value);
/// Specifies the usage of the operating system default SendBuffer size.
static const int UseDefaultSendBufferSize;
/// Returns the size of the TCP buffer allocated to the FIX connection for sending data.
/// If '-1' then the default operating system value is used.
int sendBufferSize() const;
/// Sets the size of the TCP buffer allocated to the FIX connection for sending data.
/// If '-1' then the default operating system value is used.
EngineSettings & sendBufferSize(int value);
/// Returns the value of the option to send the Logout message before dropping the telecommunication link in case of Exception during the processing of incoming FIX message.
EngineSettings & sendLogoutOnException(bool value);
/// The option to send the Logout message before dropping the telecommunication link in case of an Exception during the processing of an incoming FIX message.
bool sendLogoutOnException() const;
/// Returns the value of the option to send the Logout message before dropping the telecommunication link in case of an invalid logon attempt.
EngineSettings & sendLogoutOnInvalidLogon(bool value);
/// The option to send the Logout message before dropping the telecommunication link in case of an invalid logon attempt.
bool sendLogoutOnInvalidLogon() const;
/// Sets the path to the SSL certificate file in the (Privacy Enhanced Mail) Base64 encoded (.pem) format.
EngineSettings & sslCertificateFile(const std::string & value);
/// Returns the path to the SSL certificate file in the (Privacy Enhanced Mail) Base64 encoded (.pem) format.
const std::string & sslCertificateFile() const;
/// Sets the path to the SSL private key file in the (Privacy Enhanced Mail) Base64 encoded (.pem) format.
EngineSettings & sslPrivateKeyFile(const std::string & value);
/// Returns the path to the SSL private key file in the (Privacy Enhanced Mail) Base64 encoded (.pem) format.
const std::string & sslPrivateKeyFile() const;
/// Set the password to load private keys that are protected by a password.
EngineSettings & sslPrivateKeyPassword(const Cryptography::SecureString & value);
/// Returns the password to load private keys that are protected by a password.
Cryptography::SecureString sslPrivateKeyPassword() const;
/// The FIX Engine listens on this port for incoming SSL connections.
///
/// @note If '0' then only session-initiators can be created.
/// @note If '-1' then the telecommunication level is disabled and only message parsing/assembling can be used.
EngineSettings & sslListenPort(int value);
/// The FIX Engine listens on this port for incoming SSL connections.
///
/// @note If '0' then only session-initiators can be created.
/// @note If '-1' then the telecommunication level is disabled and only message parsing/assembling can be used.
int sslListenPort() const;
/// Sets SSL listen ports.
EngineSettings & sslListenPorts(const ListenPorts & value);
/// Returns SSL listen ports.
const ListenPorts & sslListenPorts() const;
/// The FIX Engine listens on these local interfaces for incoming SSL connections.
const LocalNetworkInterfaces & sslLocalInterface() const;
/// Sets local interfaces where the engine listen for incoming SSL connections.
/// @note At least a single SSL-listen port have to be specified to make the engine able to use this setting.
EngineSettings & sslLocalInterface(const LocalNetworkInterfaces &);
/// Set the option to request client certificates and perform the certificate verification.
EngineSettings & sslVerifyPeer(bool verify);
/// Returns the option to request client certificates and perform the certificate verification.
bool sslVerifyPeer() const;
/// Sets the path to the trusted certification authority certificate file in the (Privacy Enhanced Mail) Base64 encoded (.pem) format.
EngineSettings & sslCaFile(const std::string & value);
/// Returns the path to trusted certification authority certificate file in the (Privacy Enhanced Mail) Base64 encoded (.pem) format.
const std::string & sslCaFile() const;
/// Sets the CPU affinity of Engine service threads.
EngineSettings & serviceThreadAffinity(const OnixS::Threading::CpuIndexes & cpuIndexes);
/// Sets the CPU affinity of Engine service threads.
EngineSettings & serviceThreadAffinity(const OnixS::Threading::CpuIndex cpuIndex);
/// Returns the CPU affinity of Engine service threads.
const OnixS::Threading::CpuIndexes & serviceThreadAffinity();
/// Returns the priority of Engine service threads.
int serviceThreadPriority() const;
/// Sets the priority of Engine service threads.
EngineSettings & serviceThreadPriority(int priority);
/// Returns the policy of Engine service threads.
int serviceThreadPolicy() const;
/// Sets the policy of Engine service threads.
EngineSettings & serviceThreadPolicy(int policy);
/// Sets the option to improve the latency at the expense of the message throughput (TCP_NODELAY).
EngineSettings & tcpNoDelayOption(bool value);
/// Gets the option to improve the latency at the expense of the message throughput (TCP_NODELAY).
bool tcpNoDelayOption() const;
/// Sets the non-blocking receive spinning timeout (in microseconds) before the receiving thread enters into the blocking wait mode
/// @note Should not be greater than 1 sec (minimal Heartbeat interval).
EngineSettings & receiveSpinningTimeout(int value);
/// Gets the current receive spinning timeout value (in microseconds).
int receiveSpinningTimeout() const;
/// Sets the send spinning timeout (in microseconds) of the Session::send(..) method to wait for the socket sending buffer availability
/// in the spin loop mode before placing the message to the outgoing queue (to be sent later by the sending thread).
/// @note Should not be greater than 1 sec (minimal Heartbeat interval).
EngineSettings & sendSpinningTimeout(int value);
/// Gets the current send spinning timeout value (in microseconds).
int sendSpinningTimeout() const;
/// Sets the message grouping option:
/// Value 0 means the default grouping - the messages will be tried to send ASAP and pending messages (if any) will be grouped till reaching of the TCP buffer size.
/// Value 1 means the messages will be sent ASAP and never will be grouped.
/// Value 2 (or greater) means the messages will be sent ASAP and pending messages will be grouped maximum by 2 (or greater).
EngineSettings & messageGrouping(unsigned value);
/// Gets the message grouping option.
unsigned messageGrouping() const;
/// Gets the segment size for the file based session storage.
unsigned long long fileBasedStorageSegmentSize() const;
/// Sets the segment size for the file based session storage.
/// @param value The maximum size of the single segment (single file) of the storage, in bytes.
EngineSettings & fileBasedStorageSegmentSize(unsigned long long value);
/// Gets the log queue maximum size of the asynchronous session storage.
unsigned asyncFileBasedStorageQueueMaxSize() const;
/// Sets the log queue maximum size of the asynchronous session storage.
EngineSettings & asyncFileBasedStorageQueueMaxSize(unsigned value);
/// Sets the CPU affinity of asynchronous session storage threads.
EngineSettings & asyncFileBasedStorageThreadAffinity(const OnixS::Threading::CpuIndexes & cpuIndexes);
/// Sets the CPU affinity of asynchronous session storage threads.
EngineSettings & asyncFileBasedStorageThreadAffinity(const OnixS::Threading::CpuIndex cpuIndex);
/// Returns the CPU affinity of asynchronous session storage threads.
const OnixS::Threading::CpuIndexes & asyncFileBasedStorageThreadAffinity();
/// Gets mode of the file based storage integrity errors checking. Valuable only when the value of fileBasedStorageSegmentSize != 0.
bool ignoreFileBasedStorageIntegrityErrors() const;
/// Sets mode of the file based storage integrity errors checking. Valuable only when the value of fileBasedStorageSegmentSize != 0.
/// @param value The mode of checking: true - ignore errors and create a new storage, false - throw an exception.
EngineSettings & ignoreFileBasedStorageIntegrityErrors(bool value);
/// Gets the option to specify the ApplVerID(1128) tag in all application FIX messages when a FIX protocol version FIX 5.0 and above is used.
bool specifyApplVerIdField() const;
/// Sets the option to specify the ApplVerID(1128) tag in all application FIX messages when a FIX protocol version FIX 5.0 and above is used.
EngineSettings & specifyApplVerIdField(bool value);
/// Gets the option to specify the LastMsgSeqNumProcessed (tag=369) field on every message sent. Useful for detecting a backlog with a counterparty.
bool specifyLastMsgSeqNumProcessed() const;
/// Sets the option to specify the LastMsgSeqNumProcessed (tag=369) field on every message sent. Useful for detecting a backlog with a counterparty.
EngineSettings & specifyLastMsgSeqNumProcessed(bool value);
/// When the message gap is detected the "Resend Request" FIX Message is sent and the Session state is changed to "AwaitReplyOnResendRequest".
/// By default, in this state the incoming new messages (without the PossDupFlag (tag #43) flag) are ignored because we expect them to be re-sent later again with the PossDupFlag flag.
///
/// This property allows to change this behavior and report the new messages anyway.
///
/// @note In this mode, messages could be reported out of the original order: e.g. MsgSeqNum could be: 3 (original), 4 (original), 2 (PossDupFlag='Y'), 3 (PossDupFlag='Y'), 4 (PossDupFlag='Y')
/// and some messages could be received two times: first time without PossDupFlag='Y' and second time - with this flag.
bool reportNewMessagesWhileWaitingForMissedMessages() const;
/// Sets the option to report new messages while waiting for missed messages.
EngineSettings & reportNewMessagesWhileWaitingForMissedMessages(bool value);
/// Gets the expected incoming FIX message size. The value represents an average FIX message size that is expected to be received by the session during the lifetime.
/// It is used as a hint for the optimization of the deserialization of large FIX messages with a lot of repeating groups.
///
/// @note The large value of the setting can increase the memory consumption by the incoming `Message` object,
/// so try to increase the value only in case of a latency degradation of the large incoming FIX messages deserialization.
int expectedIncomingMessageSize() const;
/// Sets the expected incoming FIX message size.
EngineSettings & expectedIncomingMessageSize(int value);
/// Sets the option to scramble fields in the Logon(A) message, in the session storage and the FIX Engine log, for security reasons.
EngineSettings & scrambleLogonFields(const Session::ScrambledFields & fields);
/// Gets scrambled fields in the Logon(A) message.
Session::ScrambledFields scrambleLogonFields() const;
/// Sets the send queue maximum size in bytes.
EngineSettings & sendQueueMaxSize(size_t size);
/// Gets the send queue maximum size in bytes.
size_t sendQueueMaxSize() const;
/// Sets the timeout (in seconds) between an incoming TCP connection is detected and the first Logon message is received.
/// If the first Logon message is not received during this timeout + reasonable transmission time, the connection will be closed.
EngineSettings & firstLogonTimeout(unsigned timeout);
/// Gets the first Logon timeout.
unsigned firstLogonTimeout() const;
/// Gets the option to validate the presence of unknown FIX messages (messages that do not belong to the message in accordance with the FIX protocol or its FIX Dictionary).
bool validateUnknownMessages() const;
/// Sets the option to validate the presence of unknown FIX messages (messages that do not belong to the message in accordance with the FIX protocol or its FIX Dictionary).
EngineSettings & validateUnknownMessages(bool);
/// Gets the option to validate the presence of unknown fields (fields that do not belong to the message in accordance with the FIX protocol or its FIX Dictionary.
bool validateUnknownFields() const;
/// Sets the option to validate the presence of unknown fields (fields that do not belong to the message in accordance with the FIX protocol or its FIX Dictionary.
EngineSettings & validateUnknownFields(bool);
/// Gets the option to validate the presence of required fields in inbound and outbound messages.
bool validateRequiredFields() const;
/// Sets the option to validate the presence of required fields in inbound and outbound messages.
EngineSettings & validateRequiredFields(bool);
/// Gets the option to validate the field values of FIX messages in accordance with the FIX protocol or its FIX Dictionary.
bool validateFieldValues() const;
/// Sets the option to validate the field values of FIX messages in accordance with the FIX protocol or its FIX Dictionary.
EngineSettings & validateFieldValues(bool);
/// Gets the option to validate the empty field values of FIX messages in accordance with the FIX protocol or its FIX Dictionary.
bool validateEmptyFieldValues() const;
/// Sets the option to validate the empty field values of FIX messages in accordance with the FIX protocol or its FIX Dictionary.
EngineSettings & validateEmptyFieldValues(bool);
/// Gets the option to validate the repeating group size of FIX messages in accordance with the FIX protocol or its FIX Dictionary.
bool validateRepeatingGroupEntryCount() const;
/// Sets the option to validate the repeating group size of FIX messages in accordance with the FIX protocol or its FIX Dictionary.
EngineSettings & validateRepeatingGroupEntryCount(bool);
/// Gets the option to validate the repeating group leading tag of FIX messages in accordance with the FIX protocol or its FIX Dictionary.
bool validateRepeatingGroupLeadingTag() const;
/// Sets the option to validate the repeating group leading tag of FIX messages in accordance with the FIX protocol or its FIX Dictionary.
EngineSettings & validateRepeatingGroupLeadingTag(bool);
/// Gets the option to validate the duplicated field.
bool validateDuplicatedField() const;
/// Sets the option to validate the duplicated field.
EngineSettings & validateDuplicatedField(bool);
/// Gets the option to validate the checksum of incoming messages.
bool validateChecksum() const;
/// Sets the option to validate the checksum of incoming messages.
EngineSettings & validateChecksum(bool);
/// The heartbeat resolution enum.
enum HeartbeatResolution
{
// The heartbeat is measured in deciseconds.
DecisecondsHeartbeatResolution = 100,
// The heartbeat is measured in seconds.
SecondsHeartbeatResolution = 1000
};
/// Sets the heartbeat resolution.
/// @note This setting should be used only to speed up heartbeat related Unit Tests.
EngineSettings & heartbeatResolution(HeartbeatResolution resolution);
/// Gets the heartbeat resolution.
HeartbeatResolution heartbeatResolution() const;
private:
friend class Engine;
const OnixS::System::ISettings & settings() const;
struct Implementation;
Implementation * impl;
};
}
}
@@ -0,0 +1,190 @@
/*
* 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.
*/
#if !defined(__ONIXS_EVENTBASEDDECODER_H__)
#define __ONIXS_EVENTBASEDDECODER_H__
#include <string>
#include <vector>
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/FIX/Tag.h>
#include <OnixS/FIXEngine/FIX/IDecodeListener.h>
#include <OnixS/FIXEngine/FIX/InputDataTraits.h>
#include <OnixS/FIXEngine/Sockets/Definitions.h>
#include <OnixS/FIXEngine/FIX/ProtocolVersion.h>
namespace OnixS {
namespace FIX {
ONIXS_FIXENGINE_API_DECL(class, Message);
ONIXS_FIXENGINE_API_DECL(class, Dictionary);
namespace FAST {
/// Performs the FAST decoding using IDecodeListener to inform a user about the decoding process.
class ONIXS_FIXENGINE_API EventBasedDecoder
{
public:
/// Creates a FAST Decoder.
///
/// @param xmlTemplates XML-based FAST templates.
/// @param fixVersion The FIX Protocol version.
/// @param decodeEachMessageIndependently The option to reset the previous
/// values dictionaries before decoding a new FAST stream chunk.
/// @param inputDataTraits Traits of input data, has effect only when @c decodeEachMessageIndependently is @c false. See InputDataTraits::Enum for details.
EventBasedDecoder(const std::string & xmlTemplates, ProtocolVersion::Enum fixVersion,
bool decodeEachMessageIndependently, InputDataTraits::Enum inputDataTraits);
/// Creates a FAST Decoder.
///
/// @param xmlTemplates XML-based FAST templates.
/// @param fixDictionary The customized FIX dictionary used for decoded messages
/// @param decodeEachMessageIndependently The option to reset the previous
/// values dictionaries before decoding a new FAST stream chunk.
/// @param inputDataTraits Traits of input data, has effect only when @c decodeEachMessageIndependently is @c false. See InputDataTraits::Enum for details.
EventBasedDecoder(const std::string & xmlTemplates,
const OnixS::FIX::Dictionary & fixDictionary, bool decodeEachMessageIndependently,
InputDataTraits::Enum inputDataTraits);
/// Creates a FAST to FIX Decoder for the FIX dictionary-independent mode.
/// The generic FIX dictionary is created by the provided FAST-template content, it uses the FIX 4.0 as a base FIX dictionary and has a generic name.
///
/// @param xmlTemplates XML-based FAST templates.
/// @param decodeEachMessageIndependently The option to reset the previous
/// values dictionaries before decoding a new FAST stream chunk.
/// @param inputDataTraits Traits of input data, has effect only when @c decodeEachMessageIndependently is @c false. See InputDataTraits::Enum for details.
EventBasedDecoder(const std::string & xmlTemplates, bool decodeEachMessageIndependently,
InputDataTraits::Enum inputDataTraits);
/// Creates a FAST to FIX Decoder for the FIX dictionary-independent mode.
/// The generic FIX dictionary is created by the provided FAST-template content, it uses the specified FIX dictionary as a base and has a generic name.
///
/// @param baseVersion This version of the FIX protocol becomes the base for the newly generated FIX dictionary.
/// @param xmlTemplates XML-based FAST templates to generate the FIX dictionary. This FIX dictionary takes a generic identifier generated on a base of the XML content and @c baseVersion
/// @param decodeEachMessageIndependently The option to reset the previous
/// values dictionaries before decoding a new FAST stream chunk.
/// @param inputDataTraits Traits of input data, has effect only when @c decodeEachMessageIndependently is @c false. See InputDataTraits::Enum for details.
EventBasedDecoder(ProtocolVersion::Enum baseVersion, const std::string & xmlTemplates,
bool decodeEachMessageIndependently, InputDataTraits::Enum inputDataTraits);
/// Creates a FAST to FIX Decoder for the FIX dictionary-independent mode.
/// The generic FIX dictionary is created by the provided FAST-template content, it uses the specified FIX dictionary as a base and has the specified name.
/// @note The new FIX dictionary instance will be generated if and only if there is no a FIX dictionary with the same name.
///
/// @param baseVersion This version of the FIX protocol becomes the base for the newly generated FIX dictionary.
/// @param xmlTemplates XML-based FAST templates.
/// @param genericFixDictionaryId The identifier which is applied to the generic FIX dictionary. This FIX dictionary is generated using @c xmlTemplates and @c baseVersion.
/// @param decodeEachMessageIndependently The option to reset the previous
/// values dictionaries before decoding a new FAST stream chunk.
/// @param inputDataTraits Traits of input data, has effect only when @c decodeEachMessageIndependently is @c false. See InputDataTraits::Enum for details.
EventBasedDecoder(ProtocolVersion::Enum baseVersion, const std::string & xmlTemplates,
const std::string & genericFixDictionaryId, bool decodeEachMessageIndependently,
InputDataTraits::Enum inputDataTraits);
/// The destructor.
~EventBasedDecoder(void);
/// Input data traits of the decoder.
/// @return Input data traits provided during the construction of the decoder.
InputDataTraits::Enum inputDataTraits() const;
/// Decodes the given FAST stream chunk.
///
/// @param buffer The buffer that contains the FAST stream chunk to be decoded.
/// @param bufferSize The size of the buffer.
/// @param listener The listener which receives decoding events.
/// @param usedSize The number of sequential bytes in the chunk which were recognized as FAST-encoded messages.
///
/// @throw An exception if the message cannot be decoded.
///
/// @return true if at least a single message was successfully decoded.
bool decode(const char * buffer, size_t bufferSize, IDecodeListener * listener, size_t * usedSize); // Deprecated
bool decode(const unsigned char * buffer, size_t bufferSize, IDecodeListener * listener, size_t * usedSize);
/// Decodes the given FAST stream chunk.
///
/// @param chunk The FAST stream chunk to be decoded.
/// @param listener The listener which receives decoding events.
/// @param usedSize The number of sequential bytes in the chunk which were recognized as FAST-encoded messages.
///
/// @throw An exception if the message cannot be decoded.
///
/// @return true if at least a single message was successfully decoded.
bool decode(const std::vector<char> & chunk, IDecodeListener * listener, size_t * usedSize); // Deprecated
bool decode(const OnixS::Sockets::Bytes & chunk, IDecodeListener * listener, size_t * usedSize);
/// Decodes the first message from the given FAST stream chunk.
///
/// @param buffer The buffer that contains the FAST stream chunk to be decoded.
/// @param bufferSize The size of the buffer.
/// @param listener The listener which receives decoding events.
/// @param usedSize The number of sequential bytes in the chunk which were recognized as a FAST-encoded message.
///
/// @throw An exception if the message cannot be decoded.
///
/// @return true if the message was successfully decoded.
bool decodeSingleMessage(const char * buffer, size_t bufferSize, IDecodeListener * listener, size_t * usedSize); // Deprecated
bool decodeSingleMessage(const unsigned char * buffer, size_t bufferSize, IDecodeListener * listener, size_t * usedSize);
/// Decodes the first message from the given FAST stream chunk.
///
/// @param chunk The FAST stream chunk to be decoded.
/// @param listener The listener which receives decoding events.
/// @param usedSize The number of sequential bytes in the chunk which were recognized as a FAST-encoded message.
///
/// @throw An exception if the message cannot be decoded.
///
/// @return true if the message was successfully decoded.
bool decodeSingleMessage(const std::vector<char> & chunk, IDecodeListener * listener, size_t * usedSize); // Deprecated
bool decodeSingleMessage(const OnixS::Sockets::Bytes & chunk, IDecodeListener * listener, size_t * usedSize);
/// Decodes the FAST-encoded unsigned integer.
///
/// @param buffer The buffer that contains the FAST stream chunk to be decoded.
/// @param bufferSize The size of the buffer.
/// @param value The decoded value.
/// @param fieldLength The number of bytes that contained the encoded value.
///
/// @return 'true' if the stop bit was found and the value was decoded, otherwise - 'false'.
static bool tryDecodeUnsignedInteger(const char * buffer, size_t bufferSize, unsigned int * value, size_t * fieldLength); // Deprecated
static bool tryDecodeUnsignedInteger(const unsigned char * buffer, size_t bufferSize, unsigned int * value, size_t * fieldLength);
/// Resets the state of the previous values dictionaries (sets the state of the previous values to undefined).
///
/// @see decodeEachMessageIndependently.
void reset();
/// The FIX dictionary used by the decoder instance.
///
/// @return The FIX dictionary currently used by the decoder instance. If the decoder was initialized with the FIX dictionary-independent mode, the method returns
/// a reference to the internally generated FIX dictionary.
OnixS::FIX::Dictionary fixDictionary() const;
private:
friend ONIXS_FIXENGINE_API_DECL(class, OnixS::FIX::Dictionary);
EventBasedDecoder(const EventBasedDecoder &);
EventBasedDecoder & operator = (const EventBasedDecoder &);
class Impl;
Impl * impl_;
};
}
}
}
#endif // __ONIXS_EVENTBASEDDECODER_H__
@@ -0,0 +1,173 @@
#pragma once
/*
* 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.
*/
#include <exception>
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Compiler.h>
#include <OnixS/FIXEngine/FIX/Message.h>
#include <OnixS/FIXEngine/FIX/FlatMessage.h>
namespace OnixS {
namespace FIX {
/// The Engine-level exception.
typedef std::exception Exception;
/// The Engine-level runtime error;
typedef std::runtime_error RuntimeError;
/// The first received message is not a Logon (MsgType=A) FIX Message.
class ONIXS_FIXENGINE_THROWABLE_API FirstMessageNotLogonException : public RuntimeError
{
public:
/// The constructor.
FirstMessageNotLogonException(const std::string & message, const Message & incomingMessage)
: RuntimeError(message)
, incomingMessage_(incomingMessage)
{}
/// The constructor.
FirstMessageNotLogonException(const std::string & message, const FlatMessage & incomingMessage)
: RuntimeError(message)
, flatIncomingMessage_(incomingMessage)
{}
/// The destructor.
~FirstMessageNotLogonException() ONIXS_FIXENGINE_NOTHROW ONIXS_FIXENGINE_OVERRIDE ONIXS_FIXENGINE_DEFAULT;
/// Returns the received message.
const Message & message() const {
return incomingMessage_;
}
/// Returns the received message.
const FlatMessage & flatMessage() const {
return flatIncomingMessage_;
}
private:
Message incomingMessage_;
FlatMessage flatIncomingMessage_;
};
/// The telecommunication link error is detected after sending the initial Logon message.
class ONIXS_FIXENGINE_THROWABLE_API LinkErrorException : public RuntimeError
{
public:
/// The constructor.
LinkErrorException(const std::string & message)
: RuntimeError(message)
{}
/// The destructor.
~LinkErrorException() ONIXS_FIXENGINE_NOTHROW ONIXS_FIXENGINE_OVERRIDE ONIXS_FIXENGINE_DEFAULT;
};
/// The first received message is a Logon message with the wrong sequence number.
class ONIXS_FIXENGINE_THROWABLE_API UnexpectedSequenceNumberException : public RuntimeError
{
public:
/// The constructor.
UnexpectedSequenceNumberException(const std::string & message)
: RuntimeError(message)
{}
/// The destructor.
~UnexpectedSequenceNumberException() ONIXS_FIXENGINE_NOTHROW ONIXS_FIXENGINE_OVERRIDE ONIXS_FIXENGINE_DEFAULT;
};
/// The Timeout is occurred after sending the initial Logon message.
class ONIXS_FIXENGINE_THROWABLE_API TimeoutException : public RuntimeError
{
public:
/// The constructor.
TimeoutException(const std::string & message)
: RuntimeError(message)
{}
/// The destructor.
~TimeoutException() ONIXS_FIXENGINE_NOTHROW ONIXS_FIXENGINE_OVERRIDE ONIXS_FIXENGINE_DEFAULT;
};
/// The first received message is an invalid Logon message.
class ONIXS_FIXENGINE_THROWABLE_API ConfirmationLogonMessageErrorException : public RuntimeError
{
public:
/// The constructor.
ConfirmationLogonMessageErrorException(const std::string & message)
: RuntimeError(message)
{}
/// The destructor.
~ConfirmationLogonMessageErrorException() ONIXS_FIXENGINE_NOTHROW ONIXS_FIXENGINE_OVERRIDE ONIXS_FIXENGINE_DEFAULT;
};
/// The message validation is failed.
class ONIXS_FIXENGINE_THROWABLE_API ValidationException : public RuntimeError
{
public:
/// The constructor.
ValidationException(const std::string & message, Tag tag, MessageValidationFlag::Enum failedValidation)
: RuntimeError(message), tag_(tag), failedValidation_(failedValidation)
{}
/// The destructor.
~ValidationException() ONIXS_FIXENGINE_NOTHROW ONIXS_FIXENGINE_OVERRIDE ONIXS_FIXENGINE_DEFAULT;
/// Returns the tag number of the invalid field.
Tag tag() const {
return tag_;
}
/// Returns the validation criteria that fails.
MessageValidationFlag::Enum failedValidation() const {
return failedValidation_;
}
private:
Tag tag_;
MessageValidationFlag::Enum failedValidation_;
};
/// An issue is occurred during the connect process.
class ONIXS_FIXENGINE_THROWABLE_API ConnectException : public RuntimeError
{
public:
/// The constructor.
ConnectException(const std::string & message, int errCode = 0)
:RuntimeError(message), errCode_(errCode)
{}
/// The destructor.
~ConnectException() ONIXS_FIXENGINE_NOTHROW ONIXS_FIXENGINE_OVERRIDE ONIXS_FIXENGINE_DEFAULT;
/// Return the system-depended error code value.
int errorCode() const {
return errCode_;
}
private:
int errCode_;
};
}
}
+297
View File
@@ -0,0 +1,297 @@
#pragma once
/*
* 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.
*/
#include <string>
#include <vector>
#include <map>
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/FIX/Tag.h>
#include <OnixS/FIXEngine/FIX/ProtocolVersion.h>
#include <OnixS/FIXEngine/FIX/InputDataTraits.h>
#include <OnixS/FIXEngine/Sockets/Definitions.h>
namespace OnixS {
namespace FIX {
ONIXS_FIXENGINE_API_DECL(class, Message);
ONIXS_FIXENGINE_API_DECL(class, Dictionary);
namespace FAST {
/// Encodes FIX messages into the FAST representation.
class ONIXS_FIXENGINE_API Encoder
{
public:
/// Creates a FIX to FAST Encoder.
///
/// @param xmlTemplates XML-based FAST templates.
/// @param fixVersion The FIX Protocol version.
/// @param encodeEachMessageIndependently The option to reset the previous values dictionaries before encoding a new FIX message.
Encoder(const std::string & xmlTemplates, ProtocolVersion::Enum fixVersion, bool encodeEachMessageIndependently);
/// Creates a FIX to FAST Encoder.
///
/// @param xmlTemplates XML-based FAST templates.
/// @param fixDictionaryId The FIX dictionary ID.
/// @param encodeEachMessageIndependently The option to reset the previous values dictionaries before encoding a new FIX message.
Encoder(const std::string & xmlTemplates, const std::string & fixDictionaryId, bool encodeEachMessageIndependently);
/// Creates a FIX to FAST Encoder for the FIX dictionary-independent mode.
/// The generic FIX dictionary is created by the provided FAST-template content, it uses the FIX 4.0 as a base and has a generic name.
///
/// @param xmlTemplates XML-based FAST templates.
/// @param encodeEachMessageIndependently The option to reset the previous
/// values dictionaries before encoding the next FIX message.
Encoder(const std::string & xmlTemplates, bool encodeEachMessageIndependently);
/// Creates a FIX to FAST Encoder for the FIX dictionary-independent mode.
/// The generic FIX dictionary is created by the provided FAST-template content, it uses the specified FIX dictionary as a base and has a generic name.
///
/// @param baseVersion This version of the FIX protocol becomes the base for the newly generated FIX dictionary.
/// @param xmlTemplates XML-based FAST templates used to generate FIX dictionary. This FIX dictionary takes the generic identifier generated on a base of the XML content and @c baseVersion
/// @param encodeEachMessageIndependently The option to reset the previous
/// values dictionaries before encoding next FIX message.
Encoder(ProtocolVersion::Enum baseVersion, const std::string & xmlTemplates, bool encodeEachMessageIndependently);
/// Creates a FIX to FAST Encoder for the FIX dictionary-independent mode.
/// The generic FIX dictionary is created by the provided FAST-template content, it uses the specified FIX dictionary as a base and has the specified name.
/// @note The new FIX dictionary instance will be generated if and only if there is no a FIX dictionary with the same name.
///
/// @param baseVersion This version of the FIX protocol becomes the base for the newly generated FIX dictionary.
/// @param xmlTemplates XML-based FAST templates.
/// @param genericFixDictionaryId The identifier which is applied to the generic FIX dictionary. This FIX dictionary is generated using @c xmlTemplates and @c baseVersion.
/// @param encodeEachMessageIndependently The option to reset the previous
/// values dictionaries before encoding the next FIX message.
Encoder(ProtocolVersion::Enum baseVersion, const std::string & xmlTemplates, const std::string & genericFixDictionaryId, bool encodeEachMessageIndependently);
/// The destructor.
~Encoder(void);
/// Encodes the given FIX message into a FAST stream.
///
/// @param fixMessage The source FIX message to be encoded.
/// @param templateID The FAST Template Identifier which uniquely describes the encoding/decoding rules.
/// @param buffer The supplied buffer that will contain the FAST stream chunk.
/// @param bufferSize The size of the supplied buffer.
///
/// @return the size of the encoded FAST stream chunk.
size_t encode(const OnixS::FIX::Message & fixMessage, int templateID, char * buffer, size_t bufferSize); // Deprecated
size_t encode(const OnixS::FIX::Message & fixMessage, int templateID, unsigned char * buffer, size_t bufferSize);
/// Encodes the given FIX message into a FAST stream using the default template ID.
///
/// @param fixMessage The source FIX message to be encoded.
/// @param buffer The supplied buffer that will contain the FAST stream chunk.
/// @param bufferSize The size of the supplied buffer.
///
/// @return the size of the encoded FAST stream chunk.
size_t encode(const OnixS::FIX::Message & fixMessage, char * buffer, size_t bufferSize); // Deprecated
size_t encode(const OnixS::FIX::Message & fixMessage, unsigned char * buffer, size_t bufferSize);
/// Resets the state of the previous values dictionaries (sets the state of the previous values to undefined).
///
/// @see encodeEachMessageIndependently.
void reset();
/// The FIX dictionary used by the encoder instance.
///
/// @return The FIX dictionary currently used by the encoder instance. If the encoder was initialized for the FIX dictionary-independent mode, the method returns
/// a reference to the internally generated FIX dictionary.
OnixS::FIX::Dictionary fixDictionary() const;
private:
friend ONIXS_FIXENGINE_API_DECL(class, OnixS::FIX::Dictionary);
Encoder(const Encoder &);
Encoder & operator = (const Encoder &);
class Impl;
Impl * impl_;
};
/// Performs the FAST to FIX decoding.
class ONIXS_FIXENGINE_API Decoder
{
public:
/// Creates a FAST to FIX Decoder.
///
/// @param xmlTemplates XML-based FAST templates.
/// @param fixDictionary The customized FIX dictionary used for the decoded message.
/// @param decodeEachMessageIndependently The option to reset the previous
/// values dictionaries before decoding a new FAST stream chunk.
/// @param inputDataTraits Traits of input data, has effect only when @c decodeEachMessageIndependently is @c false. See InputDataTraits::Enum for details.
Decoder(const std::string & xmlTemplates, const OnixS::FIX::Dictionary & fixDictionary, bool decodeEachMessageIndependently, InputDataTraits::Enum inputDataTraits);
/// Creates a FAST to FIX Decoder for the FIX dictionary-independent mode.
/// The generic FIX dictionary is created by the provided FAST-template content, it uses the FIX 4.0 as a base FIX dictionary and has a generic name.
///
/// @param xmlTemplates XML-based FAST templates.
/// @param decodeEachMessageIndependently The option to reset the previous
/// values dictionaries before decoding a new FAST stream chunk.
/// @param inputDataTraits Traits of input data, has effect only when @c decodeEachMessageIndependently is @c false. See InputDataTraits::Enum for details.
Decoder(const std::string & xmlTemplates, bool decodeEachMessageIndependently, InputDataTraits::Enum inputDataTraits);
/// Creates a FAST to FIX Decoder for the FIX dictionary-independent mode.
/// The generic FIX dictionary is created by the provided FAST-template content, it uses the specified FIX dictionary as a base and has a generic name.
///
/// @param baseVersionForGeneratedDictionary This version of the FIX protocol becomes the base for the newly generated FIX dictionary.
/// @param xmlTemplates XML-based FAST templates used to generate the FIX dictionary. This FIX dictionary takes a generic identifier generated on a base of the XML content and @c baseVersion
/// @param decodeEachMessageIndependently The option to reset the previous
/// values dictionaries before decoding a new FAST stream chunk.
/// @param inputDataTraits Traits of input data, has effect only when @c decodeEachMessageIndependently is @c false. See InputDataTraits::Enum for details.
Decoder(ProtocolVersion::Enum baseVersionForGeneratedDictionary, const std::string & xmlTemplates, bool decodeEachMessageIndependently, InputDataTraits::Enum inputDataTraits);
/// Creates a FAST to FIX Decoder for the FIX dictionary-independent mode.
/// The generic FIX dictionary is created by the provided FAST-template content, it uses the specified FIX dictionary as a base and has the specified name.
/// @note The new FIX dictionary instance will be generated if and only if there is no a FIX dictionary with the same name.
///
/// @param baseVersionForGeneratedDictionary This version of the FIX protocol becomes the base for the newly generated FIX dictionary.
/// @param xmlTemplates XML-based FAST templates.
/// @param genericFixDictionaryId The identifier which is applied to the generic FIX dictionary. This FIX dictionary is generated using @c xmlTemplates and @c baseVersion.
/// @param decodeEachMessageIndependently The option to reset the previous
/// values dictionaries before decoding a new FAST stream chunk.
/// @param inputDataTraits Traits of input data, has effect only when @c decodeEachMessageIndependently is @c false. See InputDataTraits::Enum for details.
Decoder(ProtocolVersion::Enum baseVersionForGeneratedDictionary,
const std::string & xmlTemplates, const std::string & genericFixDictionaryId,
bool decodeEachMessageIndependently, InputDataTraits::Enum inputDataTraits);
/// The destructor.
~Decoder();
/// Input data traits of the decoder.
/// @return Input data traits provided during the construction of the decoder.
InputDataTraits::Enum inputDataTraits() const;
/// Decodes the given FAST stream chunk into the corresponding FIX Message.
///
/// @param buffer The buffer that contains the FAST stream chunk to be decoded.
/// @param bufferSize The size of the buffer.
///
/// @warning The returned message is 'owned' by the Decoder.
/// @warning The previously decoded message is freed by the Decoder when this method is called again.
///
/// @throw An exception if the message cannot be decoded.
///
/// @return the decoded FIX message.
const OnixS::FIX::Message & decode(const char * buffer, size_t bufferSize); // Deprecated
const OnixS::FIX::Message & decode(const unsigned char * buffer, size_t bufferSize);
/// Decodes the given FAST stream chunk into the corresponding FIX Message.
///
/// @param chunk The FAST stream chunk to be decoded.
///
/// @warning The returned message is 'owned' by the Decoder.
/// @warning The previously decoded message is freed by the Decoder when this method is called again.
///
/// @throw An exception if the message cannot be decoded.
///
/// @return the decoded FIX message.
const OnixS::FIX::Message & decode(const std::vector<char> & chunk); // Deprecated
const OnixS::FIX::Message & decode(const OnixS::Sockets::Bytes & chunk);
/// Tries to decode the given FAST stream buffer into the corresponding FIX Message.
///
/// @param[in] buffer The FAST stream chunk to be decoded.
/// @param[in] offset The index in the buffer at which decoding begins.
/// @param[in] count The number of bytes to analyze during the decoding.
/// @param[out] message The pointer to the decoded FIX Message.
/// @param[out] numberOfDecodedBytes The number of bytes that contained the encoded FIX Message.
///
/// @warning The message should point to an existing object. This object is not owned by the Decoder and should be managed by a user.
///
/// @throw An exception if the decoding error is detected.
///
/// @return 'true' if the given bytes could be decoded into a FIX message, otherwise - 'false'.
bool tryDecode(const char * buffer, size_t offset, size_t count, OnixS::FIX::Message * message, size_t * numberOfDecodedBytes); // Deprecated
bool tryDecode(const unsigned char * buffer, size_t offset, size_t count, OnixS::FIX::Message * message, size_t * numberOfDecodedBytes);
/// Decodes the FAST-encoded unsigned integer.
///
/// @param buffer The buffer that contains the FAST stream chunk to be decoded.
/// @param bufferSize The size of the buffer.
/// @param value The decoded value.
/// @param fieldLength The number of bytes that contained the encoded value.
///
/// @return 'true' if the stop bit was found and the value was decoded, otherwise - 'false'.
static bool tryDecodeUnsignedInteger(const char * buffer, size_t bufferSize, unsigned int * value, size_t * fieldLength); // Deprecated
static bool tryDecodeUnsignedInteger(const unsigned char * buffer, size_t bufferSize, unsigned int * value, size_t * fieldLength);
/// Resets the state of the previous values dictionaries (sets the state of the previous values to undefined).
///
/// @see decodeEachMessageIndependently.
void reset();
/// The FIX dictionary used by the decoder instance.
///
/// @return The FIX dictionary currently used by the decoder instance. If the decoder was initialized with the FIX dictionary-independent mode, the method returns
/// a reference to the internally generated FIX dictionary.
OnixS::FIX::Dictionary fixDictionary() const;
/// Manages the maximum number of repeating groups, allowed for decoded messages.
///
/// This parameter is used during the decoding and is useful to detect a broken data, which, in particular cases,
/// can 'need' to allocate an unexpectedly huge number of entries (for instance - billions of entries,
/// while normally there are just a few ones). This situation results in memory exhausting and (often)
/// significantly decreases the overall system performance.
///
/// To prevent the memory exhausting and negative consequences of that, this parameter should be configured with the value,
/// which is greater then the maximum possible number of entries in valid input data, but less then the maximum integer value (default one).
/// In a lot of real cases the value of 10000 is good enough to detect broken data without the memory overloading.
///
/// Default is the maximum positive value for @c int type.
///
/// @param value The number of repeating groups, allowed for decoded messages.
void maximumNumberOfRepeatingGroupEntries(int value);
/// The maximum number of repeating groups, allowed for decoded messages.
///
/// @return The current number of repeating groups, allowed for decoded messages. The default value is the maximum positive value for @c int type.
int maximumNumberOfRepeatingGroupEntries() const;
/// Generates the FIX dictionary XML.
///
/// @param[in] fastTemplateXml The XML content of FAST template (the same as used to initialize Decoder).
///
/// @param[in] fixDictionaryId The output FIX dictionary identifier (see "id" attribute of "FIX" node).
/// @param[out] fixDictionaryXml The XML with the generated FIX dictionary.
static void generateFixDictionary(const std::string & fastTemplateXml,
const std::string & fixDictionaryId, std::string * fixDictionaryXml);
/// Generates the FIX dictionary XML.
///
/// @param[in] fastTemplateXml The XML content of the FAST template (the same as used to initialize the Decoder).
/// @param[in] baseVersion This version of the FIX protocol becomes the base for the newly generated FIX dictionary.
/// @param[in] fixDictionaryId The output FIX dictionary identifier (see "id" attribute of "FIX" node).
/// @param[out] fixDictionaryXml The XML with the generated FIX dictionary.
static void generateFixDictionary(ProtocolVersion::Enum baseVersion,
const std::string & fastTemplateXml, const std::string & fixDictionaryId,
std::string * fixDictionaryXml);
private:
friend ONIXS_FIXENGINE_API_DECL(class, OnixS::FIX::Dictionary);
Decoder(const Decoder &);
Decoder & operator = (const Decoder &);
class Impl;
Impl * impl_;
};
}
}
}
+917
View File
@@ -0,0 +1,917 @@
#pragma once
/*
* 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.
*/
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Compiler.h>
#include <OnixS/FIXEngine/FIX/Tag.h>
namespace OnixS {
namespace FIX {
namespace FIX40 {
namespace Tags {
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag Account = 1;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag AdvId = 2;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag AdvRefID = 3;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag AdvSide = 4;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag AdvTransType = 5;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag AvgPx = 6;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag BeginSeqNo = 7;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag BeginString = 8;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag BodyLength = 9;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag CheckSum = 10;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag ClOrdID = 11;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag Commission = 12;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag CommType = 13;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag CumQty = 14;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag Currency = 15;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag EndSeqNo = 16;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag ExecID = 17;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag ExecInst = 18;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag ExecRefID = 19;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag ExecTransType = 20;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag HandlInst = 21;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag IDSource = 22;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag IOIid = 23;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag IOIOthSvc = 24;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag IOIQltyInd = 25;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag IOIRefID = 26;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag IOIShares = 27;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag IOITransType = 28;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag LastCapacity = 29;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag LastMkt = 30;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag LastPx = 31;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag LastShares = 32;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag LinesOfText = 33;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag MsgSeqNum = 34;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag MsgType = 35;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag NewSeqNo = 36;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag OrderID = 37;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag OrderQty = 38;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag OrdStatus = 39;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag OrdType = 40;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag OrigClOrdID = 41;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag OrigTime = 42;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag PossDupFlag = 43;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag Price = 44;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag RefSeqNum = 45;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag RelatdSym = 46;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag Rule80A = 47;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag SecurityID = 48;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag SenderCompID = 49;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag SenderSubID = 50;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag SendingTime = 52;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag Shares = 53;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag Side = 54;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag Symbol = 55;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag TargetCompID = 56;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag TargetSubID = 57;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag Text = 58;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag TimeInForce = 59;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag TransactTime = 60;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag Urgency = 61;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag ValidUntilTime = 62;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag SettlmntTyp = 63;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag FutSettDate = 64;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag SymbolSfx = 65;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag ListID = 66;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag ListSeqNo = 67;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag ListNoOrds = 68;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag ListExecInst = 69;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag AllocID = 70;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag AllocTransType = 71;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag RefAllocID = 72;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag NoOrders = 73;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag AvgPrxPrecision = 74;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag TradeDate = 75;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag ExecBroker = 76;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag OpenClose = 77;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag NoAllocs = 78;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag AllocAccount = 79;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag AllocShares = 80;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag ProcessCode = 81;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag NoRpts = 82;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag RptSeq = 83;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag CxlQty = 84;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag NoDlvyInst = 85;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag DlvyInst = 86;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag AllocStatus = 87;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag AllocRejCode = 88;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag Signature = 89;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag SecureDataLen = 90;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag SecureData = 91;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag BrokerOfCredit = 92;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag SignatureLength = 93;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag EmailType = 94;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag RawDataLength = 95;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag RawData = 96;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag PossResend = 97;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag EncryptMethod = 98;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag StopPx = 99;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag ExDestination = 100;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag CxlRejReason = 102;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag OrdRejReason = 103;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag IOIQualifier = 104;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag WaveNo = 105;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag Issuer = 106;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag SecurityDesc = 107;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag HeartBtInt = 108;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag ClientID = 109;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag MinQty = 110;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag MaxFloor = 111;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag TestReqID = 112;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag ReportToExch = 113;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag LocateReqd = 114;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag OnBehalfOfCompID = 115;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag OnBehalfOfSubID = 116;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag QuoteID = 117;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag NetMoney = 118;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag SettlCurrAmt = 119;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag SettlCurrency = 120;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag ForexReq = 121;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag OrigSendingTime = 122;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag GapFillFlag = 123;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag NoExecs = 124;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag CxlType = 125;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag ExpireTime = 126;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag DKReason = 127;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag DeliverToCompID = 128;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag DeliverToSubID = 129;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag IOINaturalFlag = 130;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag QuoteReqID = 131;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag BidPx = 132;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag OfferPx = 133;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag BidSize = 134;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag OfferSize = 135;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag NoMiscFees = 136;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag MiscFeeAmt = 137;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag MiscFeeCurr = 138;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag MiscFeeType = 139;
ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag PrevClosePx = 140;
}
namespace Values {
struct ONIXS_FIXENGINE_API AdvSide {
static const char Buy[];
static const char Sell[];
static const char Trade[];
static const char Cross[];
};
struct ONIXS_FIXENGINE_API AdvTransType {
static const char Cancel[];
static const char New[];
static const char Replace[];
};
struct ONIXS_FIXENGINE_API CommType {
static const char per_share[];
static const char percentage[];
static const char absolute[];
};
struct ONIXS_FIXENGINE_API ExecInst {
static const char Stay_on_offerside[];
static const char Not_held[];
static const char Work[];
static const char Go_along[];
static const char Over_the_day[];
static const char Held[];
static const char Participate_don_t_initiate[];
static const char Strict_scale[];
static const char Try_to_scale[];
static const char Stay_on_bidside[];
static const char No_cross[];
static const char OK_to_cross[];
static const char Call_first[];
static const char Percent_of_volume[];
static const char Do_not_increase_DNI[];
static const char Do_not_reduce_DNR[];
static const char All_or_none_AON[];
static const char Institutions_only[];
static const char Last_peg[];
static const char Mid_price_peg[];
static const char Non_negotiable[];
static const char Opening_peg[];
static const char Market_peg[];
static const char Primary_peg[];
static const char Suspend[];
};
struct ONIXS_FIXENGINE_API ExecTransType {
static const char New[];
static const char Cancel[];
static const char Correct[];
static const char Status[];
};
struct ONIXS_FIXENGINE_API HandlInst {
static const char Automated_execution_order_private_no_Broker_intervention[];
static const char Automated_execution_order_public_Broker_intervention_OK[];
static const char Manual_order_best_execution[];
};
struct ONIXS_FIXENGINE_API IDSource {
static const char CUSIP[];
static const char SEDOL[];
static const char QUIK[];
static const char ISIN_number[];
static const char RIC_code[];
};
struct ONIXS_FIXENGINE_API IOIOthSvc {
static const char Autex[];
static const char Bridge[];
};
struct ONIXS_FIXENGINE_API IOIQltyInd {
static const char High[];
static const char Low[];
static const char Medium[];
};
struct ONIXS_FIXENGINE_API IOIShares {
static const char Large[];
static const char Medium[];
static const char Small[];
};
struct ONIXS_FIXENGINE_API IOITransType {
static const char Cancel[];
static const char New[];
static const char Replace[];
};
struct ONIXS_FIXENGINE_API LastCapacity {
static const char Agent[];
static const char Cross_as_agent[];
static const char Cross_as_principal[];
static const char Principal[];
};
struct ONIXS_FIXENGINE_API MsgType {
static const char Heartbeat[];
static const char Test_Request[];
static const char Resend_Request[];
static const char Reject[];
static const char Sequence_Reset[];
static const char Logout[];
static const char Indication_of_Interest[];
static const char Advertisement[];
static const char Execution_Report[];
static const char Order_Cancel_Reject[];
static const char Logon[];
static const char News[];
static const char Email[];
static const char Order_Single[];
static const char Order_List[];
static const char Order_Cancel_Request[];
static const char Order_Cancel_Replace_Request[];
static const char Order_Status_Request[];
static const char Allocation[];
static const char List_Cancel_Request[];
static const char List_Execute[];
static const char List_Status_Request[];
static const char List_Status[];
static const char Allocation_ACK[];
static const char Dont_Know_Trade[];
static const char Quote_Request[];
static const char Quote[];
};
struct ONIXS_FIXENGINE_API OrdStatus {
static const char New[];
static const char Partially_filled[];
static const char Filled[];
static const char Done_for_day[];
static const char Canceled[];
static const char Replaced[];
static const char Pending_Cancel_Replace[];
static const char Stopped[];
static const char Rejected[];
static const char Suspended[];
static const char Pending_New[];
static const char Calculated[];
static const char Expired[];
};
struct ONIXS_FIXENGINE_API OrdType {
static const char Market[];
static const char Limit[];
static const char Stop[];
static const char Stop_limit[];
static const char Market_on_close[];
static const char With_or_without[];
static const char Limit_or_better[];
static const char Limit_with_or_without[];
static const char On_basis[];
static const char On_close[];
static const char Limit_on_close[];
static const char Forex[];
static const char Previously_quoted[];
static const char Previously_indicated[];
static const char Pegged[];
};
struct ONIXS_FIXENGINE_API PossDupFlag {
static const char Original_transmission[];
static const char Possible_duplicate[];
};
struct ONIXS_FIXENGINE_API Rule80A {
static const char Agency_single_order[];
static const char Program_Order_non_index_arb_for_Member_firm_org[];
static const char Program_Order_index_arb_for_Member_firm_org[];
static const char Individual_Investor_single_order[];
static const char Program_Order_index_arb_for_individual_customer[];
static const char Program_Order_non_index_arb_for_individual_customer[];
static const char Program_Order_index_arb_for_other_member[];
static const char Program_Order_non_index_arb_for_other_member[];
static const char Program_Order_index_arb_for_other_agency[];
static const char All_other_orders_as_agent_for_other_member[];
static const char Program_Order_non_index_arb_for_other_agency[];
};
struct ONIXS_FIXENGINE_API Side {
static const char Buy[];
static const char Sell[];
static const char Buy_minus[];
static const char Sell_plus[];
static const char Sell_short[];
static const char Sell_short_exempt[];
};
struct ONIXS_FIXENGINE_API TimeInForce {
static const char Day[];
static const char Good_Till_Cancel[];
static const char At_the_Opening[];
static const char Immediate_or_Cancel[];
static const char Fill_or_Kill[];
static const char Good_Till_Crossing[];
static const char Good_Till_Date[];
};
struct ONIXS_FIXENGINE_API Urgency {
static const char Normal[];
static const char Flash[];
static const char Background[];
};
struct ONIXS_FIXENGINE_API SettlmntTyp {
static const char Regular[];
static const char Cash[];
static const char Next_Day[];
static const char T_plus_2[];
static const char T_plus_3[];
static const char T_plus_4[];
static const char Future[];
static const char When_Issued[];
static const char Sellers_Option[];
static const char T_plus_5[];
};
struct ONIXS_FIXENGINE_API AllocTransType {
static const char New[];
static const char Replace[];
static const char Cancel[];
};
struct ONIXS_FIXENGINE_API ProcessCode {
static const char regular[];
static const char soft_dollar[];
static const char step_in[];
static const char step_out[];
static const char soft_dollar_step_in[];
static const char soft_dollar_step_out[];
static const char plan_sponsor[];
};
struct ONIXS_FIXENGINE_API AllocStatus {
static const char accepted[];
static const char rejected[];
static const char partial_accept[];
static const char received[];
};
struct ONIXS_FIXENGINE_API AllocRejCode {
static const char unknown_accoun[];
static const char incorrect_quantity[];
static const char incorrect_average_price[];
static const char unknown_executing_broker_mnemonic[];
static const char commission_difference[];
static const char unknown_OrderID[];
static const char unknown_ListID[];
static const char other[];
};
struct ONIXS_FIXENGINE_API EmailType {
static const char New[];
static const char Reply[];
static const char Admin_Reply[];
};
struct ONIXS_FIXENGINE_API EncryptMethod {
static const char None_other[];
static const char PKCS[];
static const char DES[];
static const char PKCS_DES[];
static const char PGP_DES[];
static const char PGP_DES_MD5[];
static const char PEM_DES_MD5[];
};
struct ONIXS_FIXENGINE_API ExDestination {
static const char none[];
static const char POSIT[];
};
struct ONIXS_FIXENGINE_API CxlRejReason {
static const char Too_late_to_cancel[];
static const char Unknown_order[];
};
struct ONIXS_FIXENGINE_API OrdRejReason {
static const char Broker_option[];
static const char Unknown_symbol[];
static const char Exchange_closed[];
static const char Order_exceeds_limit[];
static const char Too_late_to_enter[];
};
struct ONIXS_FIXENGINE_API IOIQualifier {
static const char All_or_none[];
static const char At_the_close[];
static const char In_touch_with[];
static const char Limit[];
static const char More_behind[];
static const char At_the_open[];
static const char Taking_a_position[];
static const char Current_quote[];
static const char Portfolio_show_n[];
static const char Through_the_day[];
static const char Versus[];
static const char Indication_Working_away[];
static const char Crossing_opportunity[];
};
struct ONIXS_FIXENGINE_API ReportToExch {
static const char Indicates_that_party_sending_message_will_report_trade[];
static const char Indicates_that_party_receiving_message_must_report_trade[];
};
struct ONIXS_FIXENGINE_API LocateReqd {
static const char Indicates_the_broker_is_not_required_to_locate[];
static const char Indicates_the_broker_is_responsible_for_locating_the_stock[];
};
struct ONIXS_FIXENGINE_API ForexReq {
static const char Do_not_execute_Forex_after_security_trade[];
static const char Execute_Forex_after_security_trade[];
};
struct ONIXS_FIXENGINE_API GapFillFlag {
static const char Sequence_Reset_ignore_MsgSeqNum[];
static const char Gap_Fill_message_MsgSeqNum_field_valid[];
};
struct ONIXS_FIXENGINE_API CxlType {
static const char full_remaining_quantity[];
static const char partial_cancel[];
};
struct ONIXS_FIXENGINE_API DKReason {
static const char Unknown_symbol[];
static const char Wrong_side[];
static const char Quantity_exceeds_order[];
static const char No_matching_order[];
static const char Price_exceeds_limit[];
static const char Other[];
};
struct ONIXS_FIXENGINE_API IOINaturalFlag {
static const char Not_natural[];
static const char Natural[];
};
struct ONIXS_FIXENGINE_API MiscFeeType {
static const char Regulatory[];
static const char Tax[];
static const char Local_Commission[];
static const char Exchange_Fees[];
static const char Stamp[];
static const char Levy[];
static const char Other[];
};
}
namespace TypedValues {
struct ONIXS_FIXENGINE_API AdvSide {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Buy = 'B';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Sell = 'S';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Trade = 'T';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Cross = 'X';
};
struct ONIXS_FIXENGINE_API AdvTransType {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Cancel = 'C';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char New = 'N';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Replace = 'R';
};
struct ONIXS_FIXENGINE_API CommType {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char PerShare = '1';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Percentage = '2';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Absolute = '3';
};
struct ONIXS_FIXENGINE_API ExecInst {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char StayOnOfferside = '0';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char NotHeld = '1';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Work = '2';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char GoAlong = '3';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char OverTheDay = '4';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Held = '5';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ParticipateDonTInitiate = '6';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char StrictScale = '7';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char TryToScale = '8';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char StayOnBidside = '9';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char NoCross = 'A';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char OKToCross = 'B';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char CallFirst = 'C';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char PercentOfVolume = 'D';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char DoNotIncreaseDNI = 'E';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char DoNotReduceDNR = 'F';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char AllOrNoneAON = 'G';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char InstitutionsOnly = 'I';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char LastPegLastSale = 'L';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char MidPricePegMidpriceOfInsideQuote = 'M';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char NonNegotiable = 'N';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char OpeningPeg = 'O';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char MarketPeg = 'P';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char PrimaryPegPrimaryMarketBuyAtBidSellAtOffer = 'R';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Suspend = 'S';
};
struct ONIXS_FIXENGINE_API ExecTransType {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char New = '0';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Cancel = '1';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Correct = '2';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Status = '3';
};
struct ONIXS_FIXENGINE_API HandlInst {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char AutomatedExecutionOrderPrivateNoBrokerIntervention = '1';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char AutomatedExecutionOrderPublicBrokerInterventionOK = '2';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ManualOrderBestExecution = '3';
};
struct ONIXS_FIXENGINE_API IDSource {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char CUSIP = '1';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char SEDOL = '2';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char QUIK = '3';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ISINNumber = '4';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char RICCode = '5';
};
struct ONIXS_FIXENGINE_API IOIOthSvc {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Autex = 'A';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Bridge = 'B';
};
struct ONIXS_FIXENGINE_API IOIQltyInd {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char High = 'H';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Low = 'L';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Medium = 'M';
};
struct ONIXS_FIXENGINE_API IOIShares {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Large = 'L';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Medium = 'M';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Small = 'S';
};
struct ONIXS_FIXENGINE_API IOITransType {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Cancel = 'C';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char New = 'N';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Replace = 'R';
};
struct ONIXS_FIXENGINE_API LastCapacity {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Agent = '1';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char CrossAsAgent = '2';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char CrossAsPrincipal = '3';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Principal = '4';
};
struct ONIXS_FIXENGINE_API MsgType {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Heartbeat = '0';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char TestRequest = '1';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ResendRequest = '2';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Reject = '3';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char SequenceReset = '4';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Logout = '5';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char IndicationOfInterest = '6';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Advertisement = '7';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ExecutionReport = '8';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char OrderCancelReject = '9';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Logon = 'A';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char News = 'B';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Email = 'C';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char OrderSingle = 'D';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char OrderList = 'E';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char OrderCancelRequest = 'F';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char OrderCancelReplaceRequest = 'G';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char OrderStatusRequest = 'H';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Allocation = 'J';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ListCancelRequest = 'K';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ListExecute = 'L';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ListStatusRequest = 'M';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ListStatus = 'N';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char AllocationACK = 'P';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char DonTKnowTradeDK = 'Q';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char QuoteRequest = 'R';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Quote = 'S';
};
struct ONIXS_FIXENGINE_API OrdStatus {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char New = '0';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char PartiallyFilled = '1';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Filled = '2';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char DoneForDay = '3';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Canceled = '4';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Replaced = '5';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char PendingCancelReplace = '6';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Stopped = '7';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Rejected = '8';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Suspended = '9';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char PendingNew = 'A';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Calculated = 'B';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Expired = 'C';
};
struct ONIXS_FIXENGINE_API OrdType {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Market = '1';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Limit = '2';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Stop = '3';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char StopLimit = '4';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char MarketOnClose = '5';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char WithOrWithout = '6';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char LimitOrBetter = '7';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char LimitWithOrWithout = '8';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char OnBasis = '9';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char OnClose = 'A';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char LimitOnClose = 'B';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Forex = 'C';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char PreviouslyQuoted = 'D';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char PreviouslyIndicated = 'E';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char PeggedRequiresExecInstLRMPOrO = 'P';
};
struct ONIXS_FIXENGINE_API PossDupFlag {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char OriginalTransmission = 'N';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char PossibleDuplicate = 'Y';
};
struct ONIXS_FIXENGINE_API Rule80A {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char AgencySingleOrder = 'A';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ProgramOrderNonIndexArbForMemberFirmOrg = 'C';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ProgramOrderIndexArbForMemberFirmOrg = 'D';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char IndividualInvestorSingleOrder = 'I';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ProgramOrderIndexArbForIndividualCustomer = 'J';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ProgramOrderNonIndexArbForIndividualCustomer = 'K';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ProgramOrderIndexArbForOtherMember = 'M';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ProgramOrderNonIndexArbForOtherMember = 'N';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ProgramOrderIndexArbForOtherAgency = 'U';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char AllOtherOrdersAsAgentForOtherMember = 'W';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ProgramOrderNonIndexArbForOtherAgency = 'Y';
};
struct ONIXS_FIXENGINE_API Side {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Buy = '1';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Sell = '2';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char BuyMinus = '3';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char SellPlus = '4';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char SellShort = '5';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char SellShortExempt = '6';
};
struct ONIXS_FIXENGINE_API TimeInForce {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Day = '0';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char GoodTillCancelGTC = '1';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char AtTheOpeningOPG = '2';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ImmediateOrCancelOC = '3';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char FillOrKillFOK = '4';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char GoodTillCrossingGTX = '5';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char GoodTillDate = '6';
};
struct ONIXS_FIXENGINE_API Urgency {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Normal = '0';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Flash = '1';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Background = '2';
};
struct ONIXS_FIXENGINE_API SettlmntTyp {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Regular = '0';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Cash = '1';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char NextDay = '2';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char TPlus2 = '3';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char TPlus3 = '4';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char TPlus4 = '5';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Future = '6';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char WhenIssued = '7';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char SellersOption = '8';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char TPlus5 = '9';
};
struct ONIXS_FIXENGINE_API AllocTransType {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char New = '0';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Replace = '1';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Cancel = '2';
};
struct ONIXS_FIXENGINE_API ProcessCode {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Regular = '0';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char SoftDollar = '1';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char StepIn = '2';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char StepOut = '3';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char SoftDollarStepIn = '4';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char SoftDollarStepOut = '5';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char PlanSponsor = '6';
};
struct ONIXS_FIXENGINE_API AllocStatus {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int AcceptedSuccessfullyProcessed = 0;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int Rejected = 1;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int PartialAccept = 2;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int ReceivedReceivedNotYetProcessed = 3;
};
struct ONIXS_FIXENGINE_API AllocRejCode {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int UnknownAccountS = 0;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int IncorrectQuantity = 1;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int IncorrectAveragePrice = 2;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int UnknownExecutingBrokerMnemonic = 3;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int CommissionDifference = 4;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int UnknownOrderID = 5;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int UnknownListID = 6;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int Other = 7;
};
struct ONIXS_FIXENGINE_API EmailType {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char New = '0';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Reply = '1';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char AdminReply = '2';
};
struct ONIXS_FIXENGINE_API EncryptMethod {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int NoneOther = 0;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int PKCSProprietary = 1;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int DESEBCMode = 2;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int PKCSDESProprietary = 3;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int PGPDESDefunct = 4;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int PGPDESMD5SeeAppNoteOnFIXHomePage = 5;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int PEMDESMD5SeeAppNoteOnFIXHomePage = 6;
};
struct ONIXS_FIXENGINE_API ExDestination {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char None = '0';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char POSIT = '4';
};
struct ONIXS_FIXENGINE_API CxlRejReason {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int TooLateToCancel = 0;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int UnknownOrder = 1;
};
struct ONIXS_FIXENGINE_API OrdRejReason {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int BrokerOption = 0;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int UnknownSymbol = 1;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int ExchangeClosed = 2;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int OrderExceedsLimit = 3;
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR int TooLateToEnter = 4;
};
struct ONIXS_FIXENGINE_API IOIQualifier {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char AllOrNone = 'A';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char AtTheClose = 'C';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char InTouchWith = 'I';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Limit = 'L';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char MoreBehind = 'M';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char AtTheOpen = 'O';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char TakingAPosition = 'P';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char CurrentQuote = 'Q';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char PortfolioShowN = 'S';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ThroughTheDay = 'T';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Versus = 'V';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char IndicationWorkingAway = 'W';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char CrossingOpportunity = 'X';
};
struct ONIXS_FIXENGINE_API ReportToExch {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char IndicatesThatPartySendingMessageWillReportTrade = 'N';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char IndicatesThatPartyReceivingMessageMustReportTrade = 'Y';
};
struct ONIXS_FIXENGINE_API LocateReqd {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char IndicatesTheBrokerIsNotRequiredToLocate = 'N';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char IndicatesTheBrokerIsResponsibleForLocatingTheStock = 'Y';
};
struct ONIXS_FIXENGINE_API ForexReq {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char DoNotExecuteForexAfterSecurityTrade = 'N';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ExecuteForexAfterSecurityTrade = 'Y';
};
struct ONIXS_FIXENGINE_API GapFillFlag {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char SequenceResetIgnoreMsgSeqNum = 'N';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char GapFillMessageMsgSeqNumFieldValid = 'Y';
};
struct ONIXS_FIXENGINE_API CxlType {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char FullRemainingQuantity = 'F';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char PartialCancelReduceQuantity = 'P';
};
struct ONIXS_FIXENGINE_API DKReason {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char UnknownSymbol = 'A';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char WrongSide = 'B';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char QuantityExceedsOrder = 'C';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char NoMatchingOrder = 'D';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char PriceExceedsLimit = 'E';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Other = 'Z';
};
struct ONIXS_FIXENGINE_API IOINaturalFlag {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char NotNatural = 'N';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Natural = 'Y';
};
struct ONIXS_FIXENGINE_API MiscFeeType {
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char RegulatoryEGSEC = '1';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Tax = '2';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char LocalCommission = '3';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char ExchangeFees = '4';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Stamp = '5';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Levy = '6';
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR char Other = '7';
};
}
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,795 @@
/*
* 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 <vector>
#include <iterator>
#include <OnixS/FIXEngine/Compiler.h>
#include <OnixS/FIXEngine/FIX/Tag.h>
#include <OnixS/FIXEngine/FIX/FieldValueRef.h>
namespace OnixS {
namespace FIX {
ONIXS_FIXENGINE_API_DECL(class, Group);
ONIXS_FIXENGINE_API_DECL(class, Message);
/// Field primary attributes (the tag and a reference to a value).
struct ONIXS_FIXENGINE_API Field {
/// The field tag.
Tag tag;
/// The field value reference.
FieldValueRef value;
/// Initializes the field which refers to nothing.
Field()
: tag(0) {
}
/// Initializes all members.
Field(
Tag fieldTag,
const FieldValueRef & fieldValue)
: tag(fieldTag), value(fieldValue) {
}
};
/// The ordered collection of fields.
typedef
std::vector<Field>
Fields;
/// Encapsulates primary operations over the collection of FIX
/// fields like a FIX message and a repeating group instance are.
class ONIXS_FIXENGINE_API FieldSet
{
public:
/// Indicates whether an instance refers to a valid set of fields.
///
/// If the given instance doesn't refer to a valid fields set,
/// none of other members must be used.
bool valid() const;
/// Returns 'true' if the field-set contains the
/// field with the given tag, otherwise - 'false'.
///
/// @warning Due to performance considerations, doesn't
/// check whether an instance refers to a valid set of fields.
/// Use OnixS::FIX::FieldSet::valid() to check whether
/// an instance is in the valid state.
bool contain(Tag tag) const;
/// Returns a reference to the given field value.
///
/// @warning Due to performance considerations, doesn't
/// check whether an instance refers to a valid set of fields.
/// Use OnixS::FIX::FieldSet::valid() to check whether
/// an instance is in the valid state.
FieldValueRef get(Tag tag) const;
/// Returns a field value as an OnixS::FIX::Char value.
///
/// @throw std::exception if the conversion is impossible.
///
/// @warning Due to performance considerations, doesn't
/// check whether an instance refers to a valid set of fields.
/// Use OnixS::FIX::FieldSet::valid() to check whether
/// an instance is in the valid state.
Char getChar(Tag tag) const;
/// Returns a field value as an OnixS::FIX::Int32 value.
///
/// @throw std::exception if the conversion is impossible.
///
/// @warning Due to performance considerations, doesn't
/// check whether an instance refers to a valid set of fields.
/// Use OnixS::FIX::FieldSet::valid() to check whether
/// an instance is in the valid state.
Int32 getInt32(Tag tag) const;
/// Returns a field value as an OnixS::FIX::UInt32 value.
///
/// @throw std::exception if the conversion is impossible.
///
/// @warning Due to performance considerations, doesn't
/// check whether an instance refers to a valid set of fields.
/// Use OnixS::FIX::FieldSet::valid() to check whether
/// an instance is in the valid state.
UInt32 getUInt32(Tag tag) const;
/// Returns a field value as an OnixS::FIX::Int64 value.
///
/// @throw std::exception if the conversion is impossible.
///
/// @warning Due to performance considerations, doesn't
/// check whether an instance refers to a valid set of fields.
/// Use OnixS::FIX::FieldSet::valid() to check whether
/// an instance is in the valid state.
Int64 getInt64(Tag tag) const;
/// Returns a field value as an OnixS::FIX::UInt64 value.
///
/// @throw std::exception if the conversion is impossible.
///
/// @warning Due to performance considerations, doesn't
/// check whether an instance refers to a valid set of fields.
/// Use OnixS::FIX::FieldSet::valid() to check whether
/// an instance is in the valid state.
UInt64 getUInt64(Tag tag) const;
/// Returns the field value as a floating-point number.
///
/// @throw std::exception if the conversion is impossible.
///
/// @warning Due to performance considerations, doesn't
/// check whether an instance refers to a valid set of fields.
/// Use OnixS::FIX::FieldSet::valid() to check whether
/// an instance is in the valid state.
Double getDouble(Tag tag) const;
/// Returns the field value as a decimal number.
///
/// @throw std::exception if the conversion is impossible.
///
/// @warning Due to performance considerations, doesn't
/// check whether an instance refers to a valid set of fields.
/// Use OnixS::FIX::FieldSet::valid() to check whether
/// an instance is in the valid state.
Decimal getDecimal(Tag tag) const;
/// Returns the field value as a decimal number with fixed exponent.
///
/// @throw std::exception if the conversion is impossible.
///
/// @warning Due to performance considerations, doesn't
/// check whether an instance refers to a valid set of fields.
/// Use OnixS::FIX::FieldSet::valid() to check whether
/// an instance is in the valid state.
Decimal getDecimal(Tag tag, Int32 exponent) const;
/// Returns reference to a read-only text chain.
///
/// @throw std::exception if the conversion is impossible.
///
/// @warning Due to performance considerations, doesn't
/// check whether an instance refers to a valid set of fields.
/// Use OnixS::FIX::FieldSet::valid() to check whether
/// an instance is in the valid state.
StringRef getStringRef(Tag tag) const;
/// Returns the field value as a timestamp.
///
/// @throw std::exception if the conversion is impossible.
///
/// The method tries to determine the timestamp format in runtime.
/// Therefore, it makes sense to use this method when the timestamp format
/// is unknown. Otherwise, for better performance, the overloaded method
/// with the explicit timestamp format parameter should be used.
///
/// @warning Due to performance considerations, doesn't
/// check whether an instance refers to a valid set of fields.
/// Use OnixS::FIX::FieldSet::valid() to check whether
/// an instance is in the valid state.
Timestamp getTimestamp(Tag tag) const;
/// Returns the field value as a timestamp of the requested format.
///
/// @throw std::exception if the conversion is impossible.
///
/// @warning Due to performance considerations, doesn't
/// check whether an instance refers to a valid set of fields.
/// Use OnixS::FIX::FieldSet::valid() to check whether
/// an instance is in the valid state.
Timestamp getTimestamp(Tag tag, TimestampFormat::Enum) const;
/// Returns the field value as a time span.
///
/// @throw std::exception if the conversion is impossible.
///
/// @warning Due to performance considerations, doesn't
/// check whether an instance refers to a valid set of fields.
/// Use OnixS::FIX::FieldSet::valid() to check whether
/// an instance is in the valid state.
TimeSpan getTimeSpan(Tag tag) const;
/// Returns a reference to a repeating group if the underlying
/// field defines the length of the repeating group.
///
/// @param numberOfInstancesTag The Tag number of
/// the field that defines the number of instances
/// in this repeating group (the NoXXX field).
///
/// @throw std::exception if no repeating group
/// is associated with the given field (tag).
///
/// @warning The returned instance remains valid until the field is
/// modified via any of OnixS::FIX::FieldSet::set members.
Group getGroup(Tag numberOfInstancesTag) const;
/// Returns true if the given flag is present
/// and it equals to "Y", otherwise false.
///
/// @warning Due to performance considerations, doesn't
/// check whether an instance refers to a valid set of fields.
/// Use OnixS::FIX::FieldSet::valid() to check whether
/// an instance is in the valid state.
bool hasFlag(Tag tag) const;
/// Assigns the given value to the field.
///
/// Transforms the input value into the text-presentation,
/// so actually stored value is the text-presentation of the input.
/// Further, the stored text-presentation may be directly accessed
/// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
/// additional memory allocations and copying.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & set(Tag tag, Int32 value);
/// Assigns the given value to the field.
///
/// Saves the value being set as it is without transforming
/// it into the text-presentation. Assigning the field value via
/// OnixS::FIX::FieldSet::setV members saves not only value
/// but it's type as well, therefore no parsing is performed
/// during the subsequent access to the field via get&lt;Type&gt;
/// member.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & setV(Tag tag, Int32 value);
/// Assigns the given value to the field.
///
/// Transforms the input value into the text-presentation,
/// so actually stored value is the text-presentation of the input.
/// Further, the stored text-presentation may be directly accessed
/// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
/// additional memory allocations and copying.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & set(Tag tag, UInt32 value);
/// Assigns the given value to the field.
///
/// Saves the value being set as it is without transforming
/// it into the text-presentation. Assigning the field value via
/// OnixS::FIX::FieldSet::setV members saves not only value
/// but it's type as well, therefore no parsing is performed
/// during the subsequent access to the field via get&lt;Type&gt;
/// member.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & setV(Tag tag, UInt32 value);
/// Assigns the given value to the field.
///
/// Transforms the input value into the text-presentation,
/// so actually stored value is the text-presentation of the input.
/// Further, the stored text-presentation may be directly accessed
/// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
/// additional memory allocations and copying.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & set(Tag tag, Int64 value);
/// Assigns the given value to the field.
///
/// Saves the value being set as it is without transforming
/// it into the text-presentation. Assigning the field value via
/// OnixS::FIX::FieldSet::setV members saves not only value
/// but it's type as well, therefore no parsing is performed
/// during the subsequent access to the field via get&lt;Type&gt;
/// member.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & setV(Tag tag, Int64 value);
/// Assigns the given value to the field.
///
/// Transforms the input value into the text-presentation,
/// so actually stored value is the text-presentation of the input.
/// Further, the stored text-presentation may be directly accessed
/// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
/// additional memory allocations and copying.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & set(Tag tag, UInt64 value);
/// Assigns the given value to the field.
///
/// Saves the value being set as it is without transforming
/// it into the text-presentation. Assigning the field value via
/// OnixS::FIX::FieldSet::setV members saves not only value
/// but it's type as well, therefore no parsing is performed
/// during the subsequent access to the field via get&lt;Type&gt;
/// member.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & setV(Tag tag, UInt64 value);
/// Assigns the given value to the field.
///
/// Transforms the input value into the text-presentation,
/// so actually stored value is the text-presentation of the input.
/// Further, the stored text-presentation may be directly accessed
/// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
/// additional memory allocations and copying.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & set(Tag tag, Double value, size_t precision = 17);
/// Assigns the given value to the field,
/// if the string presentation of the value is greater than
/// the length it will be truncated, only digit characters
/// are counted.
///
/// Transforms the input value into the text-presentation,
/// so actually stored value is the text-presentation of the input.
/// Further, the stored text-presentation may be directly accessed
/// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
/// additional memory allocations and copying.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & set(Tag tag, Double value, size_t precision, size_t length);
/// Assigns the given value to the field.
///
/// Saves the value being set as it is without transforming
/// it into the text-presentation. Assigning the field value via
/// OnixS::FIX::FieldSet::setV members saves not only value
/// but it's type as well, therefore no parsing is performed
/// during the subsequent access to the field via get&lt;Type&gt;
/// member.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & setV(Tag tag, Double value, size_t precision = 17);
/// Assigns the given value to the field.
/// if the string presentation of the value is greater than
/// the length it will be truncated, only digit characters
/// are counted.
///
/// Saves the value being set as it is without transforming
/// it into the text-presentation. Assigning the field value via
/// OnixS::FIX::FieldSet::setV members saves not only value
/// but it's type as well, therefore no parsing is performed
/// during the subsequent access to the field via get&lt;Type&gt;
/// member.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & setV(Tag tag, Double value, size_t precision, size_t length);
/// Assigns the given value to the field.
///
/// Transforms the input value into the text-presentation,
/// so actually stored value is the text-presentation of the input.
/// Further, the stored text-presentation may be directly accessed
/// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
/// additional memory allocations and copying.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & set(Tag tag, const Decimal & value);
/// Assigns the given value to the field.
/// if the string presentation of the value is greater than
/// the length it will be truncated, only digit characters
/// are counted.
///
/// Transforms the input value into the text-presentation,
/// so actually stored value is the text-presentation of the input.
/// Further, the stored text-presentation may be directly accessed
/// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
/// additional memory allocations and copying.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & set(Tag tag, const Decimal & value, size_t length);
/// Assigns the given value to the field.
///
/// Saves the value being set as it is without transforming
/// it into the text-presentation. Assigning the field value via
/// OnixS::FIX::FieldSet::setV members saves not only value
/// but it's type as well, therefore no parsing is performed
/// during the subsequent access to the field via get&lt;Type&gt;
/// member.
///
/// @return the reference to itself for the method chaining approach..
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & setV(Tag tag, const Decimal & value);
/// Assigns the given value to the field.
/// if the string presentation of the value is greater than
/// the length it will be truncated, only digit characters
/// are counted.
///
/// Saves the value being set as it is without transforming
/// it into the text-presentation. Assigning the field value via
/// OnixS::FIX::FieldSet::setV members saves not only value
/// but it's type as well, therefore no parsing is performed
/// during the subsequent access to the field via get&lt;Type&gt;
/// member.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & setV(Tag tag, const Decimal & value, size_t length);
/// Assigns the given value to the field.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & set(Tag tag, char value);
/// Assigns the given value to the field.
///
/// The stored value represents a copy of the input.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & set(Tag tag, const std::string & value);
/// Assigns the given value to the field.
///
/// The stored value represents a copy of the input.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & set(Tag tag, const char * value);
/// Assigns the given value to the field.
///
/// The stored value represents a copy of the input.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & set(Tag tag, const StringRef & value);
/// Assigns the given value to the field.
///
/// Transforms the input value into the text-presentation,
/// so actually stored value is the text-presentation of the input.
/// Further, the stored text-presentation may be directly accessed
/// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
/// additional memory allocations and copying.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet &
set(
Tag tag,
const Timestamp & value,
TimestampFormat::Enum valueFormat =
TimestampFormat::YYYYMMDDHHMMSSNsec);
/// Assigns the given value to the field.
///
/// Saves the value being set as it is without transforming
/// it into the text-presentation. Assigning the field value via
/// OnixS::FIX::FieldSet::setV members saves not only value
/// but it's type as well, therefore no parsing is performed
/// during the subsequent access to the field via get&lt;Type&gt;
/// member.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet &
setV(
Tag tag,
const Timestamp & value,
TimestampFormat::Enum valueFormat =
TimestampFormat::YYYYMMDDHHMMSSNsec);
/// Assigns the given value to the field.
///
/// Transforms the input value into the text-presentation,
/// so actually stored value is the text-presentation of the input.
/// Further, the stored text-presentation may be directly accessed
/// using the OnixS::FIX::FieldSet::getStringRef() member to avoid
/// additional memory allocations and copying.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet &
set(
Tag tag,
const TimeSpan & value,
TimeSpanFormat::Enum valueFormat =
TimeSpanFormat::HHMMSSNsec);
/// Assigns the given value to the field.
///
/// Saves the value being set as it is without transforming
/// it into the text-presentation. Assigning the field value via
/// OnixS::FIX::FieldSet::setV members saves not only value
/// but it's type as well, therefore no parsing is performed
/// during the subsequent access to the field via get&lt;Type&gt;
/// member.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet &
setV(
Tag tag,
const TimeSpan & value,
TimeSpanFormat::Enum valueFormat =
TimeSpanFormat::HHMMSSNsec);
/// Creates a new repeating group or changes the number
/// of instances in the existing repeating group.
///
/// @param tag The Tag number of the field that defines
/// the number of instances in this repeating group (the NoXXX field).
///
/// @param value The number of instances in the repeating group.
///
/// @throw std::exception if the given field doesn't
/// define the number of repeating group instances.
Group setGroup(Tag tag, size_t value);
/// Assigns the flag value ("Y" or "N") to the field.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & setFlag(Tag tag, bool value);
/// Assigns the value to a field as a copy of another field value.
///
/// @return the reference to itself for the method chaining approach.
///
/// @warning if the field of the given tag is not defined by the
/// FIX Specification for the given field set (either a message or
/// a repeating group instance), the function may throw an exception
/// (behavior is controlled by validation-related parameters
/// from the Engine's configuration).
FieldSet & set(Tag tag, const FieldValueRef & value);
/// Erases an association of the field with its value.
/// @return 'true' if the field had a valid value before.
bool erase(Tag tag);
/// Retrieve tags and values of all non-empty fields belonged to the given @c FieldSet instance.
/// @param fields The object to receive the @c FieldSet content.
/// @return The number of fields placed to the @c fields vector.
size_t fields(Fields & fields) const;
/// The constant iterator to iterate over all fields in the given FieldSet instance.
class ONIXS_FIXENGINE_API ConstIterator
{
public:
typedef std::forward_iterator_tag iterator_category;
typedef Field value_type;
typedef Field difference_type;
typedef Field * pointer;
typedef Field & reference;
/// Initializes the iterator by a first field from which you need to iterate.
ConstIterator(const FieldSet *, Tag);
const Field & operator *() const {
return currentField_;
}
const Field * operator ->() const {
return &currentField_;
}
bool operator == (const ConstIterator &) const;
bool operator != (const ConstIterator &) const;
ConstIterator & operator ++();
private:
/// The FieldSet instance to iterate.
const FieldSet * container_;
/// The current field.
Field currentField_;
};
/// Returns the constant iterator to the first field in the FieldSet instance.
ConstIterator begin() const;
/// Returns the constant iterator to the field after the last one in the FieldSet instance.
ConstIterator end() const;
protected:
// Policies to control the field access.
typedef size_t AccessPolicies;
// The underlying implementation.
void * impl_;
// The message to which the given set belongs to.
const Message * container_;
// Policies to control the field access.
AccessPolicies policies_;
// The uninitialized set.
FieldSet();
// The uninitialized set.
FieldSet(const Message *, void *, AccessPolicies);
// The clone construction.
FieldSet(const FieldSet &);
// The destruction available via descendants.
~FieldSet() ONIXS_FIXENGINE_DEFAULT;
FieldSet & operator = (const FieldSet &);
// Swaps two instances.
void swap(FieldSet &);
private:
friend class Message;
friend class GroupInstance;
friend class MessageOperator;
};
inline
bool
FieldSet::contain(Tag tag) const
{
return get(tag).valid();
}
}
}
@@ -0,0 +1,334 @@
/*
* 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/FIXEngine/FIX/StringRef.h>
#include <OnixS/FIXEngine/FIX/Timestamp.h>
namespace OnixS {
namespace FIX {
ONIXS_FIXENGINE_API_DECL(class, Message);
ONIXS_FIXENGINE_API_DECL(class, Group);
/// Implements a concept of a read-only
/// reference to a FIX field value.
class
ONIXS_FIXENGINE_API
FieldValueRef
{
public:
/// The uninitialized value.
FieldValueRef();
/// The shallow copy from another one.
FieldValueRef(const FieldValueRef & other);
/// Indicated whether the instance
/// refers to a valid value.
bool valid() const;
/// Return the string presentation
/// of the value being referenced.
operator std::string() const;
/// Compares with another instance for equality.
bool operator == (const FieldValueRef &) const;
/// Compares with another instance for inequality.
bool operator != (const FieldValueRef &) const;
/// Compares the string presentation for
/// equality with given text reference.
bool operator == (const StringRef &) const;
/// Compares the string presentation for
/// equality with the given text reference.
bool operator != (const StringRef &) const;
/// Converts the field value into the whole number.
///
/// @return false if the conversion fails.
///
/// @warning Due to performance considerations
/// doesn't check whether an instance refers to a valid
/// value. Use the OnixS::FIX::FieldValueRef::operator bool()
/// member to check an instance for a validness.
bool toNumber(Int32 &) const;
/// Converts the field value into the whole number.
///
/// @return false if the conversion fails.
///
/// @warning Due to performance considerations
/// doesn't check whether an instance refers to a valid
/// value. Use the OnixS::FIX::FieldValueRef::operator bool()
/// member to check an instance for a validness.
bool toNumber(UInt32 &) const;
/// Converts the field value into the whole number.
///
/// @return false if the conversion fails.
///
/// @warning Due to performance considerations
/// doesn't check whether an instance refers to a valid
/// value. Use the OnixS::FIX::FieldValueRef::operator bool()
/// member to check an instance for a validness.
bool toNumber(Int64 &) const;
/// Converts the field value into the whole number.
///
/// @return false if the conversion fails.
///
/// @warning Due to performance considerations
/// doesn't check whether an instance refers to a valid
/// value. Use the OnixS::FIX::FieldValueRef::operator bool()
/// member to check an instance for a validness.
bool toNumber(UInt64 &) const;
/// Converts the field value into the floating point value.
///
/// @return false if the conversion fails.
///
/// @warning Due to performance considerations
/// doesn't check whether an instance refers to a valid
/// value. Use the OnixS::FIX::FieldValueRef::operator bool()
/// member to check an instance for a validness.
bool toNumber(Double &) const;
/// Converts the field value into the floating point value.
///
/// @return false if the conversion fails.
///
/// @warning Due to performance considerations
/// doesn't check whether an instance refers to a valid
/// value. Use the OnixS::FIX::FieldValueRef::operator bool()
/// member to check an instance for a validness.
bool toNumber(Decimal &) const;
/// Converts the field value into the timestamp of the requested format.
///
/// @return false if the conversion fails.
///
/// @warning Due to performance considerations
/// doesn't check whether an instance refers to a valid
/// value. Use the OnixS::FIX::FieldValueRef::operator bool()
/// member to check an instance for a validness.
bool
toTimestamp(
Timestamp &,
TimestampFormat::Enum =
TimestampFormat::YYYYMMDDHHMMSSNsec) const;
/// Converts the field value into the timespan
///
/// @return false if the conversion fails.
///
/// @warning Due to performance considerations
/// doesn't check whether an instance refers to a valid
/// value. Use the OnixS::FIX::FieldValueRef::operator bool()
/// member to check an instance for a validness.
bool
toTimeSpan(
TimeSpan&, TimeSpanFormat::Enum = TimeSpanFormat::HHMMSSMsec) const;
/// If the value represents a text, returns a reference to it.
///
/// @return false if the conversion fails (for example,
/// the stored value is the whole number assigned to a field
/// using the OnixS::FIX::FieldSet::setV member), otherwise - true.
///
/// @warning Due to performance considerations
/// doesn't check whether an instance refers to a valid
/// value. Use the OnixS::FIX::FieldValueRef::operator bool()
/// member to check an instance for a validness.
bool toStringRef(StringRef &) const;
/// If the value represents a text, returns a reference to it.
///
/// @return An empty StringRef if the conversion fails (for example,
/// the stored value is the whole number assigned to a field
/// using the OnixS::FIX::FieldSet::setV member), otherwise - valid StringRef.
///
/// @warning Due to performance considerations
/// doesn't check whether an instance refers to a valid
/// value. Use the OnixS::FIX::FieldValueRef::operator bool()
/// member to check an instance for a validness.
StringRef toStringRef() const;
/// If the value represent a one-char text,
/// copies it into the given variable.
///
/// @return false if the conversion fails (for example,
/// the stored value is the whole number assigned to a field
/// using the OnixS::FIX::FieldSet::setV member).
///
/// @warning Due to performance considerations
/// doesn't check whether an instance refers to a valid
/// value. Use the OnixS::FIX::FieldValueRef::operator bool()
/// member to check an instance for a validness.
bool toChar(char &) const;
/// If a repeating group is associated with
/// the field, allows to get an instance of it.
///
/// @return false if no group is associated with the field.
///
/// @warning Due to performance considerations
/// doesn't check whether an instance refers to a valid
/// value. Use the OnixS::FIX::FieldValueRef::operator bool()
/// member to check an instance for a validness.
bool toGroup(Group &) const;
/// Appends a copy of a text presentation to the std::string.
void toString(std::string &) const;
/// Return the string presentation of the field value.
std::string toString() const;
/// Updates an instance to refer to another field value.
/// @warning Does NOT perform a deep copy of field values.
/// Just updates a reference to point to the value of other field.
FieldValueRef & operator = (const FieldValueRef &);
/// Swaps two references.
void swap(FieldValueRef & other);
private:
friend class MessageOperator;
const void * impl_;
const Message * container_;
FieldValueRef(
const Message *,
const void *);
};
inline StringRef FieldValueRef::toStringRef() const
{
StringRef result;
if(toStringRef(result))
return result;
else
return StringRef();
}
inline
FieldValueRef::
operator std::string() const
{
std::string str;
toString(str);
return str;
}
inline
std::string
FieldValueRef::toString() const
{
std::string str;
toString(str);
return str;
}
// More comparison operators.
inline
bool
operator == (
const FieldValueRef & ref,
const std::string & str)
{
return ref == StringRef(str);
}
inline
bool
operator != (
const FieldValueRef & ref,
const std::string & str)
{
return ref != StringRef(str);
}
inline
bool
operator == (
const std::string & str,
const FieldValueRef & ref)
{
return ref == StringRef(str);
}
inline
bool
operator != (
const std::string & str,
const FieldValueRef & ref)
{
return ref != StringRef(str);
}
// More comparison operators.
inline
bool
operator == (
const FieldValueRef & ref,
const char * str)
{
return ref == StringRef(str);
}
inline
bool
operator != (
const FieldValueRef & ref,
const char * str)
{
return ref != StringRef(str);
}
inline
bool
operator == (
const char * str,
const FieldValueRef & ref)
{
return ref == StringRef(str);
}
inline
bool
operator != (
const char * str,
const FieldValueRef & ref)
{
return ref != StringRef(str);
}
}
}
@@ -0,0 +1,196 @@
/*
* 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 <cstdlib>
namespace OnixS {
namespace FIX {
namespace Core {
namespace Messaging {
namespace Extras {
class FlatMessage;
}
}
}
struct KnownFlatFieldKeys;
/// Represents a temporary reference to a field in an editable serialized message.
///
/// @note Reference remains valid since the moment it is obtained till the moment any other field of the same Serialized message is modified.
class FlatFieldRef
{
public:
/// Initializes as a references to nothing.
FlatFieldRef()
: valueOffset_(0),
valueSize_(0) {
}
/// Message only should use this constructor to initialize a valid reference.
FlatFieldRef(size_t valueOffset, size_t valueSize)
: valueOffset_(valueOffset), valueSize_(valueSize) {
}
/// Gets value offset.
size_t valueOffset() const {
return valueOffset_;
}
/// Gets value size.
size_t valueSize() const {
return valueSize_;
}
/// Indicates whether the instance refers to the field or not.
operator bool() const {
return (0 != valueOffset_);
}
/// Compares the instance with the given one.
bool
operator == (
const FlatFieldRef & other) const {
return (
valueOffset_ == other.valueOffset_ &&
valueSize_ == other.valueSize_);
}
/// Compares the instance with the given one.
bool
operator != (
const FlatFieldRef & other) const {
return (
valueOffset_ != other.valueOffset_ ||
valueSize_ != other.valueSize_);
}
private:
friend
class
OnixS::FIX::Core::Messaging::Extras::
FlatMessage;
size_t valueOffset_;
size_t valueSize_;
};
typedef FlatFieldRef SerializedFieldRef;
/// Key to a serialized field - represents another way of accessing fields in an editable serialized message.
///
/// In contrast to FlatFieldRef, FlatFieldKey remains constant and valid during all the life of serialized message object.
/// So they are suitable in case of multiple modifications of the same field.
class FlatFieldKey
{
public:
/// Initializes as a non-valid key.
FlatFieldKey()
: key_(static_cast<size_t>(-1)) {
}
// Initializes valid key.
explicit FlatFieldKey(size_t key)
: key_(key) {
}
/// Implicit conversion to the index value.
operator size_t() const {
return key_;
}
/// Compares to the given instance.
bool
operator ==(
const FlatFieldKey & other) const {
return (key_ == other.key_);
}
/// Compares to the given instance.
bool
operator !=(
const FlatFieldKey & other) const {
return (key_ != other.key_);
}
private:
friend
class
OnixS::FIX::Core::Messaging::Extras::
FlatMessage;
friend
struct
KnownFlatFieldKeys;
// Numeric value of the key.
size_t key_;
};
typedef FlatFieldKey SerializedFieldKey;
/// Keys are constant during the serialized message lifetime.
/// However, keys are allocated privately by each particular
/// message instance and thus may differ for same fields in
/// different instances. For commonly used fields, there are
/// pre-allocated keys which are same for all messages.
struct KnownFlatFieldKeys {
/// Key to access the BodyLength field.
static
FlatFieldKey
bodyLength() {
return FlatFieldKey(0);
}
/// Key to access the MsgType field.
static
FlatFieldKey
msgType() {
return FlatFieldKey(1);
}
/// Key to access the MsgSeqNum field.
static
FlatFieldKey
seqNumber() {
return FlatFieldKey(2);
}
/// Key to access the SendingTime field.
static
FlatFieldKey
sendingTime() {
return FlatFieldKey(3);
}
/// Value of the first key to be allocated dynamically.
static
FlatFieldKey
dynamic() {
return FlatFieldKey(4);
}
};
typedef KnownFlatFieldKeys KnownSerializedFieldKeys;
}
}
@@ -0,0 +1,145 @@
/*
* 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 <iterator>
#include <OnixS/FIXEngine/Compiler.h>
#include <OnixS/FIXEngine/FIX/FlatMessage.h>
namespace OnixS {
namespace FIX {
ONIXS_FIXENGINE_API_DECL(class, FlatMessage);
ONIXS_FIXENGINE_API_DECL(class, FlatGroup);
/// A single instance of the FIX Repeating Group. Provides an access
/// to the fields of a particular repeating group instance.
class ONIXS_FIXENGINE_API FlatGroupInstance
{
public:
/// Looks for a field using the given tag number.
/// @return A valid reference in case of success, otherwise - an invalid one.
FlatFieldRef find(Tag) const;
/// Provides an access to a field value by the given temporary reference.
StringRef operator[](const FlatFieldRef &) const;
/// Returns the reference to a repeating group - if exists.
///
/// @param numberOfInstancesRef A reference of
/// the field that defines the number of instances
/// in this repeating group (the NoXXX field).
///
/// @throw std::exception if the given field does not contain the number of instances.
FlatGroup getGroup(const FlatFieldRef & numberOfInstancesRef) const;
private:
friend class MessageOperator;
FlatGroupInstance(const FlatMessage *, const StringRef &, const FlatGroupInstance * parent);
FlatGroupInstance(const FlatMessage *, const FlatGroupInstance *, const FlatGroupInstance * parent);
const FlatMessage * container_;
Tag parentLeadingTag_;
FlatField leadingField_;
};
/// Encapsulates operations over the FIX Repeating Group.
///
/// The repeating group represents an array of repeating group instances,
/// This class exposes corresponding services to manipulate the array
/// of repeating group instances. Similar to the OnixS::FIX::FlatGroupInstance
/// it behaves like a pointer/reference to the underlying data. It's
/// a light-weight object which just wraps the internal data.
///
/// The group remains valid until corresponding group fields are updated.
class ONIXS_FIXENGINE_API FlatGroup
{
public:
/// Returns the number of instances in the repeating group.
size_t size() const { return groupSize_; }
/// Returns the StringRef value of the repeating group field.
StringRef groupFieldValue() const { return groupFieldValue_; }
/// The constant iterator to iterate over all group instances in the repeating group.
class ONIXS_FIXENGINE_API ConstIterator
{
public:
typedef std::forward_iterator_tag iterator_category;
typedef FlatGroupInstance value_type;
typedef FlatGroupInstance difference_type;
typedef FlatGroupInstance * pointer;
typedef FlatGroupInstance & reference;
/// Initializes an iterator by a first group instance from which you need to iterate.
ConstIterator(const FlatGroup *, size_t);
const FlatGroupInstance & operator*() const {
return currentGroupInstance_;
}
const FlatGroupInstance * operator->() const {
return &currentGroupInstance_;
}
bool operator == (const ConstIterator &) const;
bool operator != (const ConstIterator &) const;
ConstIterator & operator ++();
private:
/// The FlatMessage instance to iterate.
const FlatGroup * container_;
/// The current group instance index.
size_t currentGroupInstanceIndex_;
/// The current group instance.
FlatGroupInstance currentGroupInstance_;
};
/// Returns the iterator to the first group instance in the group.
ConstIterator begin() const;
/// Returns the iterator to the group instance after the last one in the group.
ConstIterator end() const;
private:
friend class MessageOperator;
FlatGroup(const FlatMessage *, FlatFieldRef, const FlatGroupInstance *);
const FlatMessage * container_;
const FlatGroupInstance * parent_;
StringRef groupFieldValue_;
size_t groupSize_;
};
}
}
@@ -0,0 +1,470 @@
/*
* 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 <iterator>
#include <OnixS/FIXEngine/FIX/Tag.h>
#include <OnixS/FIXEngine/FIX/Numeric.h>
#include <OnixS/FIXEngine/FIX/StringRef.h>
#include <OnixS/FIXEngine/FIX/Timestamp.h>
#include <OnixS/FIXEngine/FIX/FlatFieldRefAndKey.h>
#include <OnixS/FIXEngine/FIX/FieldValueRef.h>
#include <OnixS/FIXEngine/FIX/ProtocolVersion.h>
namespace OnixS {
namespace FIX {
ONIXS_FIXENGINE_API_DECL(class, Message);
ONIXS_FIXENGINE_API_DECL(class, FlatGroup);
/// The insert mode of FlatMessage::insert() methods.
struct InsertMode
{
enum Enum
{
/// The new field will be inserted before the position tag.
Before,
/// The new field will be inserted after the position tag.
After
};
};
/// Field primary attributes (a tag and a reference to a value).
struct ONIXS_FIXENGINE_API FlatField
{
/// The field tag.
Tag tag;
/// The field value reference.
StringRef value;
/// Initializes the field which refers to nothing.
FlatField()
: tag(0) {}
/// Initializes all members.
FlatField(
Tag fieldTag,
const StringRef & fieldValue)
: tag(fieldTag), value(fieldValue) {}
};
/// Provides an access to FIX fields from a flat (tag=value) message.
///
/// Fields can be accessed using temporary field references and using
/// special keys which remain constant during the lifetime of the single instance.
///
/// To access a field, a reference must be obtained using the 'find' member.
/// The 'find' member searches for a field using a regular Tag identifier.
/// If the 'find' succeeds, a temporary reference is returned. That reference can
/// be either used to modify the field or to allocate a key for that field using
/// the 'allocateKey' member. Once the key is allocated it can be used like a tag
/// to quick access the field.
///
/// There are pre-allocated keys to access service fields like MsgType, MsgSeqNum, SendingTime, etc.
///
/// @note BodyLength and CheckSum fields are not synchronized each time other fields are updated.
/// Therefore, to bring the flat message (tag=value) into the valid state, it's necessary to invoke the 'adjust' member.
class ONIXS_FIXENGINE_API FlatMessage
{
public:
/// Constructs the blank instance.
///
/// @note This constructor does not support the zero-copy feature.
FlatMessage();
/// Constructs an instance with empty required message header fields.
///
/// @note This constructor does not support the zero-copy feature.
FlatMessage(OnixS::FIX::ProtocolVersion::Enum protocolVersion, const char * msgType);
/// Constructs an instance from the tag=value form.
FlatMessage(const char * rawMessage, size_t rawMessageSize, bool useZeroCopyBuffer = true);
/// Constructs an instance from the tag=value form without session-level fields.
/// Required fields will be added during the construction.
FlatMessage(
OnixS::FIX::ProtocolVersion::Enum protocolVersion,
const char * msgType,
const char * senderCompId,
const char * targetCompId,
const char * rawMessageWithoutHeaderTrailer,
size_t rawMessageWithoutHeaderTrailerSize,
bool useZeroCopyBuffer = true);
/// Constructs an instance from the given Message object.
FlatMessage(const OnixS::FIX::Message & message, bool useZeroCopyBuffer = true);
/// Initializes as a copy of the given instance.
FlatMessage(const FlatMessage & other);
/// Utilizes internal resources.
~FlatMessage();
/// Returns the content of the flat message.
const char * chars() const;
/// The size of the flat content.
size_t size() const;
/// Returns a string that represents the flat message.
std::string toString() const;
/// Looks for a field using the given tag number.
/// @return A valid reference in case of success, otherwise - an invalid one.
FlatFieldRef find(Tag) const;
/// Looks for a field with assumption the field is located
/// after the given field using its tag number.
///
/// The member is suitable to access same fields but from
/// different repeating group instances.
///
/// @return A valid reference in case of success, otherwise - an invalid one.
FlatFieldRef find(Tag, const FlatFieldRef &) const;
/// Allocates a key to the requested field for the further access.
FlatFieldKey allocateKey(const FlatFieldRef &);
/// Finds and allocates a key to the requested field for the further access.
FlatFieldKey allocateKey(Tag);
/// Provides an access to a field value by the given temporary reference.
StringRef operator[](const FlatFieldRef &) const;
/// Provides an access to a field value by the given field key.
StringRef operator[](FlatFieldKey) const;
/// Returns the reference to a repeating group - if exists.
///
/// @param numberOfInstancesRef The reference of
/// the field that defines the number of instances
/// in this repeating group (the NoXXX field).
///
/// @throw std::exception if the given field does not contain the number of instances.
FlatGroup getGroup(const FlatFieldRef & numberOfInstancesRef) const;
/// Converts the StringRef value of the given FlatMessage to the FlatFieldRef object.
FlatFieldRef getFlatFieldRef(const StringRef & value) const;
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to
/// access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldRef &, const StringRef &);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldKey, const StringRef &);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldRef &, Char);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldKey, Char);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldRef &, Int32);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldKey, Int32);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldRef &, UInt32);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldKey, UInt32);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldRef &, Int64);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldKey, Int64);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldRef &, UInt64);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldKey, UInt64);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldRef &, const Decimal &);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldKey, const Decimal &);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldRef &, const Timestamp &, TimestampFormat::Enum);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldKey, const Timestamp &, TimestampFormat::Enum);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldRef &, const TimeSpan &, TimeSpanFormat::Enum);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldKey, const TimeSpan &, TimeSpanFormat::Enum);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldRef &, const FieldValueRef &);
/// Updates the field value.
///
/// @note Once the value is updated, only the reference used to access the field remains valid, other references become invalid.
FlatMessage & set(FlatFieldKey, const FieldValueRef &);
/// Adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & add(Tag, const StringRef &);
/// Adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & add(Tag, Char);
/// Adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & add(Tag, Int32);
/// Adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & add(Tag, UInt32);
/// Adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & add(Tag, Int64);
/// Adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & add(Tag, UInt64);
/// Adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & add(Tag, const Decimal &);
/// Adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & add(Tag, const Timestamp &, TimestampFormat::Enum);
/// Adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & add(Tag, const TimeSpan &, TimeSpanFormat::Enum);
/// Inserts the tag/value pair to the message before or after the position field.
/// If the position tag is not found, it adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & insert(Tag, const StringRef &, Tag, InsertMode::Enum = InsertMode::Before);
/// Inserts the tag/value pair to the message before or after the position field.
/// If the position tag is not found, it adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & insert(Tag, Char, Tag, InsertMode::Enum = InsertMode::Before);
/// Inserts the tag/value pair to the message before or after the position field.
/// If the position tag is not found, it adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & insert(Tag, Int32, Tag, InsertMode::Enum = InsertMode::Before);
/// Inserts the tag/value pair to the message before or after the position field.
/// If the position tag is not found, it adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & insert(Tag, UInt32, Tag, InsertMode::Enum = InsertMode::Before);
/// Inserts the tag/value pair to the message before or after the position field.
/// If the position tag is not found, it adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & insert(Tag, Int64, Tag, InsertMode::Enum = InsertMode::Before);
/// Inserts the tag/value pair to the message before or after the position field.
/// If the position tag is not found, it adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & insert(Tag, UInt64, Tag, InsertMode::Enum = InsertMode::Before);
/// Inserts the tag/value pair to the message before or after the position field.
/// If the position tag is not found, it adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & insert(Tag, const Decimal &, Tag, InsertMode::Enum = InsertMode::Before);
/// Inserts the tag/value pair to the message before or after the position field.
/// If the position tag is not found, it adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & insert(Tag, const Timestamp &, TimestampFormat::Enum, Tag, InsertMode::Enum = InsertMode::Before);
/// Inserts the tag/value pair to the message before or after the position field.
/// If the position tag is not found, it adds the tag/value pair to the end of the message.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & insert(Tag, const TimeSpan &, TimeSpanFormat::Enum, Tag, InsertMode::Enum = InsertMode::Before);
/// Removes the field value.
///
/// Once value is removed, all references
/// to other fields become invalid.
///
/// @note This method does not support the zero-copy feature.
FlatMessage & remove(Tag);
/// Updates BodyLength and CheckSum fields.
void adjust();
/// Resets the instance to the new tag=value form.
///
/// @note This method does not support the zero-copy feature.
void reset(const char * rawMessage, size_t rawMessageSize);
/// Resets the instance to the blank state.
///
/// @note This method does not support the zero-copy feature.
void reset();
// Returns the `ProtocolVersion`, which corresponds to `BeginString` and 'ApplVerID' tag values.
ProtocolVersion::Enum version() const;
/// A user data associated with the message.
///
/// @return A pointer to data was previously
/// attached to the instance or NULL.
void * userData() const;
/// Attaches a user data to the message.
void userData(void * data);
/// Re-initializes as a copy of the given instance.
FlatMessage & operator = (const FlatMessage &);
/// The constant iterator to iterate over all fields in the given FlatMessage instance.
class ONIXS_FIXENGINE_API ConstIterator
{
public:
typedef std::forward_iterator_tag iterator_category;
typedef FlatField value_type;
typedef FlatField difference_type;
typedef FlatField * pointer;
typedef FlatField & reference;
/// Initializes an iterator by a first field from which you need to iterate.
ConstIterator(const FlatMessage *, Tag);
const FlatField & operator*() const {
return currentField_;
}
const FlatField * operator->() const {
return &currentField_;
}
bool operator == (const ConstIterator &) const;
bool operator != (const ConstIterator &) const;
ConstIterator & operator ++();
private:
/// The FlatMessage instance to iterate.
const FlatMessage * container_;
/// The current field.
FlatField currentField_;
};
/// Returns the constant iterator to the first field in the FlatMessage instance.
ConstIterator begin() const;
/// Returns the constant iterator to the field after the last one in the FlatMessage instance.
ConstIterator end() const;
private:
friend class MessageOperator;
friend class FlatMessageWrapper;
FlatMessage(const OnixS::FIX::Core::Messaging::Extras::FlatMessage & other);
OnixS::FIX::Core::Messaging::Extras::FlatMessage * impl_;
const bool isOwned_;
};
typedef FlatMessage SerializedMessage;
inline
FlatFieldRef
FlatMessage::find(Tag tag) const
{
return find(tag, FlatFieldRef());
}
/// The stream output.
ONIXS_FIXENGINE_API
std::ostream & operator << (std::ostream & os, const FlatMessage & message);
}
}
+254
View File
@@ -0,0 +1,254 @@
/*
* 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 <iterator>
#include <OnixS/FIXEngine/FIX/FieldSet.h>
namespace OnixS {
namespace FIX {
ONIXS_FIXENGINE_API_DECL(class, Message);
ONIXS_FIXENGINE_API_DECL(class, Group);
/// The single instance of the FIX Repeating Group. Provides an access
/// to the fields of a particular repeating group instance.
///
/// Class behaves like a pointer/reference to a set of FIX
/// fields. Coping and assignment operations just update a reference
/// to the field-set being pointed, no deep copying is performed.
class
ONIXS_FIXENGINE_API
GroupInstance : public FieldSet
{
public:
/// The group instance which refers to nothing.
GroupInstance();
/// Initializes an instance as a reference to the other one.
GroupInstance(const GroupInstance & other);
/// Reinitializes an instance as reference of other one.
GroupInstance & operator = (const GroupInstance &);
/// Swaps two instances.
void swap(GroupInstance &);
/// Returns the string representation of the group instance using
/// the given delimiter.
///
/// @param delimiter Defines the field delimiter to be used.
std::string toString(char delimiter = 0x1) const;
/// Appends a string representation of the group instance using
/// the given delimiter.
///
/// @param str The string to which the presentation is appended.
/// @param delimiter Defines the field delimiter to be used.
void toString(std::string & str, char delimiter = 0x1) const;
private:
friend class MessageOperator;
GroupInstance(const Message *, void *);
};
inline
GroupInstance & GroupInstance::operator =(const GroupInstance & other)
{
*static_cast<FieldSet *>(this) = static_cast<const FieldSet &>(other);
return *this;
}
inline
void GroupInstance::swap(GroupInstance & other)
{
FieldSet::swap(static_cast<FieldSet &>(other));
}
inline
std::string GroupInstance::toString(char delimiter) const
{
std::string str;
toString(str, delimiter);
return str;
}
/// Encapsulates operations over the FIX Repeating Group.
///
/// The repeating group represents an array of repeating group instances,
/// So, the class exposes corresponding services to manipulate an array
/// of repeating group instances. Similar to the OnixS::FIX::GroupInstance
/// it behaves like a pointer/reference to the underlying data. It's
/// a light-weight object which just wraps internal data.
///
/// The group remains valid until the corresponding field (which defines
/// the size/length of the repeating group) from field-set (a message or an outer
/// repeating group instance) is updated.
class ONIXS_FIXENGINE_API Group
{
public:
/// The group which refers to nothing.
Group();
/// Initializes an instance as a reference to the given repeating group.
Group(const Group & other);
/// Indicated whether the group refers to a valid instance.
bool valid() const;
/// Return the number of instances in the repeating group.
///
/// @warning Due to performance considerations,
/// instance is not checked for validness. The member
/// must be used only when an instance is in the valid state.
size_t size() const;
/// Accesses to the repeating group instance.
///
/// @throw std::exception If the index exceeds allowed bounds.
///
/// @warning Due to performance considerations,
/// instance is not checked for validness. The member
/// must be used only when an instance is in the valid state.
GroupInstance at(size_t index);
/// Accesses to the repeating group instance.
///
/// @throw std::exception If the index exceeds allowed bounds.
///
/// @warning Due to performance considerations,
/// instance is not checked for validness. The member
/// must be used only when an instance is in the valid state.
const GroupInstance at(size_t index) const;
/// Accesses to the repeating group instance.
///
/// Does NOT check the index validness.
///
/// @warning Due to performance considerations,
/// instance is not checked for validness. The member
/// must be used only when an instance is in the valid state.
GroupInstance operator [](size_t index);
/// Accesses to the repeating group instance.
///
/// Does NOT check the index validness.
///
/// @warning Due to performance considerations,
/// instance is not checked for validness. The member
/// must be used only when an instance is in the valid state.
const GroupInstance operator [](size_t index) const;
/// Reinitializes the instance as a reference to other one.
Group & operator = (const Group & other);
/// Swaps two instances.
void swap(Group & other);
/// Returns the string representation of the group using
/// the given delimiter.
///
/// @param delimiter Defines the field delimiter to be used.
std::string toString(char delimiter = 0x1) const;
/// Appends the string representation of the message using
/// the given delimiter.
///
/// @param str The string to which the presentation is appended.
/// @param delimiter Defines the field delimiter to be used.
void toString(std::string & str, char delimiter = 0x1) const;
/// The mutable iterator to iterate over all group instances in the repeating group.
class ONIXS_FIXENGINE_API Iterator
{
public:
typedef std::forward_iterator_tag iterator_category;
typedef GroupInstance value_type;
typedef GroupInstance difference_type;
typedef GroupInstance * pointer;
typedef GroupInstance & reference;
/// Initializes the iterator by a first group instance from which you need to iterate.
Iterator(Group *, size_t);
GroupInstance & operator *() {
return currentGroupInstance_;
}
GroupInstance * operator ->() {
return &currentGroupInstance_;
}
bool operator == (const Iterator &) const;
bool operator != (const Iterator &) const;
Iterator & operator ++();
private:
/// The group instance to iterate.
Group * container_;
/// The current group instance index.
size_t currentGroupInstanceIndex_;
/// The current group instance.
GroupInstance currentGroupInstance_;
};
/// Returns the iterator to the first group instance in the group.
Iterator begin();
/// Returns the iterator to the group instance after the last one in the group.
Iterator end();
private:
friend class MessageOperator;
void * impl_;
const Message * container_;
Group(const Message *, void *);
};
inline
std::string Group::toString(char delimiter) const
{
std::string str;
toString(str, delimiter);
return str;
}
/// Stream output.
ONIXS_FIXENGINE_API
std::ostream & operator << (std::ostream & os, const Group & group);
/// Stream output.
ONIXS_FIXENGINE_API
std::ostream & operator << (std::ostream & os, const GroupInstance & instance);
}
}
@@ -0,0 +1,130 @@
/*
* 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.
*/
#if !defined(__ONIXS_IDECODELISTENER_H__)
#define __ONIXS_IDECODELISTENER_H__
#include <cstddef>
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Compiler.h>
namespace OnixS {
namespace FIX {
namespace FAST {
/// The decode session's listener.
/// This interface declares set of methods called by the EventBasedDecoder during the decoding process.
class ONIXS_FIXENGINE_API IDecodeListener
{
public:
/// @note The FIX Engine does NOT manage the lifetime of this listener.
virtual ~IDecodeListener() ONIXS_FIXENGINE_DEFAULT;
/// @name Entire message events
/// These events belongs to the entire message. Events occur single time per message.
/// @{
/// Called when a new FAST-encoded message found in input data.
///
/// @param templateId The identifier of the FAST template belonged to the message.
/// @param messageType The FIX type of the message.
/// @param messageTypeLength The length of the messageType string. Doe not include the terminating zero.
virtual void onBeginMessage(unsigned templateId, const char * messageType,
size_t messageTypeLength) = 0;
/// Called when the decoder finishes the current message decoding.
/// @note It is possible to reset the caller decoder during this callback.
virtual void onEndMessage() = 0;
/// @}
/// @name Data field events
/// These events denotes that particular fields were decoded. Events occurs once per a field.
/// @{
/// Called when a signed 32-bit integer field decoded.
///
/// @param tag The FIX tag of the field.
/// @param value the decoded value.
virtual void onValue(int tag, int value) = 0;
/// Called when an unsigned 32-bit integer field decoded.
///
/// @param tag The FIX tag of the field.
/// @param value the decoded value.
virtual void onValue(int tag, unsigned value) = 0;
/// Called when a signed 64-bit integer field decoded.
///
/// @param tag The FIX tag of the field.
/// @param value the decoded value.
virtual void onValue(int tag, long long value) = 0;
/// Called when an unsigned 64-bit integer field decoded.
///
/// @param tag The FIX tag of the field.
/// @param value the decoded value.
virtual void onValue(int tag, unsigned long long value) = 0;
/// Called when a decimal field decoded.
///
/// @param tag The FIX tag of the field.
/// @param mantissa The mantissa of the decoded decimal value.
/// @param exponent The exponent of the decoded decimal value (in range of -64..63).
virtual void onValue(int tag, long long mantissa, int exponent) = 0;
/// Called when a string (ASCII or Unicode) or byteVector decoded.
///
/// @param tag The FIX tag of the field.
/// @param value The pointer to start of decoded data.
/// @param valueLength The length of the decoded data (does not include the terminating zero for &lt;string&gt; fields).
virtual void onValue(int tag, const char * value, size_t valueLength) = 0;
/// @}
/// @name Sequence events
/// These callbacks embraces the sequence decoding. Each callback called once per a sequence unless the sequence is empty.
/// @{
/// Called just before first entry of the sequence decoding.
///
/// @param tag The Tag of the sequence
/// @param itemCount The number of entries in the sequence.
/// @param lengthFieldTag The Tag of the &lt;length&gt; field.
virtual void onBeginSequence(int tag, size_t itemCount, int lengthFieldTag) = 0;
/// Called immediately after the last sequence entry decoded.
virtual void onEndSequence() = 0;
/// @}
/// @name Sequence entry events
/// These callbacks embraces sequence entry decoding. Each callback called once per sequence entry.
/// @{
/// Called just before the sequence entry decoding.
/// @param index The index of the entry.
virtual void onBeginSequenceEntry(size_t index) = 0;
/// Called after the entry was decoded.
virtual void onEndSequenceEntry() = 0;
/// @}
};
}
}
}
#endif // __ONIXS_IDECODELISTENER_H__
@@ -0,0 +1,150 @@
/*
* 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 <string>
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Compiler.h>
namespace OnixS {
namespace FIX {
ONIXS_FIXENGINE_API_DECL(class, FlatMessage);
ONIXS_FIXENGINE_API_DECL(class, Session);
/// The warning reason.
struct EngineWarningReason {
enum Enum {
/// The general system-related warning.
GeneralWarning,
/// The first message cannot be received during the timeout.
CannotReceiveFirstMessageDuringTimeout,
/// A garbled message is received.
GarbledMessageReceived,
/// The session state cannot be changed.
RestoreSessionStateWarning,
/// The license expiration warning.
LicenseExpiration
};
};
/// The error reason.
struct EngineErrorReason {
enum Enum {
/// Cannot backup the file.
BackupError,
/// An exception was thrown during the reading of the sent message.
ErrorWhileReadingSentMessages,
/// The general system-related error.
GeneralError,
/// The internal error, please contact support@onixs.biz to investigate the issue.
InternalError,
/// The session state cannot be restored.
RestoreSessionStateError,
/// Socket options cannot be set.
SetSocketOptionError
};
};
/// The Engine's Listener.
class ONIXS_FIXENGINE_API IEngineListener
{
public:
/// @note The FIX Engine does NOT manage the lifetime of this listener.
virtual ~IEngineListener() ONIXS_FIXENGINE_DEFAULT;
/// Called when an unknown incoming FIX connection is detected.
///
/// To accept the connection, a dynamic new session may be created in scope of this callback with an appropriate
/// TargetCompID, SenderCompID and FIX version/dialect.
/// This dynamically created session should be logon as an acceptor otherwise the incoming connection will be rejected.
///
/// If the dynamic session will not be created, the incoming FIX connection will be rejected, and the rejectReason could be specified then the Logout(5) message will be sent to the counterparty.
///
/// @param[in] incomingLogon The incoming Logon message. In general it is needed to examine the content and properties of this message
/// to create an appropriate acceptor.
///
/// @param[in] listenPort The listen port.
///
/// @param[in] counterpartyPort The counterparty port.
///
/// @param[in] counterpartyIpAddress The counterparty IP address.
///
/// @param[out] rejectReason To send the Logout message before closing the rejected connection, set the rejection description to this parameter.
virtual void onUnknownIncomingConnection(const FlatMessage & incomingLogon, const int listenPort,
const int counterpartyPort, const std::string & counterpartyIpAddress,
std::string * rejectReason) = 0;
/// Called when an incoming FIX connection is detected.
///
/// If the rejectReason is set, the incoming FIX connection will be rejected, and the Logout(5) message will be sent to the counterparty.
///
/// @param[in] incomingLogon The incoming Logon message.
///
/// @param[in] listenPort The listen port.
///
/// @param[in] counterpartyPort The counterparty port.
///
/// @param[in] counterpartyIpAddress The counterparty IP address.
///
/// @param[out] rejectReason To send the Logout message before closing the rejected connection, set the rejection description to this parameter.
virtual void onIncomingConnection(ONIXS_FIXENGINE_UNUSED const FlatMessage & incomingLogon, ONIXS_FIXENGINE_UNUSED const int listenPort,
ONIXS_FIXENGINE_UNUSED const int counterpartyPort, ONIXS_FIXENGINE_UNUSED const std::string & counterpartyIpAddress,
ONIXS_FIXENGINE_UNUSED std::string * rejectReason) {};
/// Called when an incoming TCP connection is detected.
///
/// If the rejectReason is set, the incoming TCP connection will be rejected.
///
/// @param[in] listenPort The listen port.
///
/// @param[in] counterpartyPort The counterparty port.
///
/// @param[in] counterpartyIpAddress The counterparty IP address.
///
/// @param[out] rejectReason To send the Logout message before closing the rejected connection, set the rejection description to this parameter.
virtual void onIncomingTelecommunicationLink(ONIXS_FIXENGINE_UNUSED const int listenPort, ONIXS_FIXENGINE_UNUSED const int counterpartyPort,
ONIXS_FIXENGINE_UNUSED const std::string & counterpartyIpAddress, ONIXS_FIXENGINE_UNUSED std::string * rejectReason) {};
/// Called when an error is detected.
///
/// @param[in] reason The error reason.
///
/// @param[in] description The error description.
virtual void onError(EngineErrorReason::Enum reason, const std::string & description) = 0;
/// Called when a warning is detected.
///
/// @param[in] reason The warning reason.
///
/// @param[in] description The warning description.
virtual void onWarning(EngineWarningReason::Enum reason, const std::string & description) = 0;
};
}
}
@@ -0,0 +1,158 @@
/*
* 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.
*/
#if !defined(__ONIXS_ISBEDECODELISTENER_H__)
#define __ONIXS_ISBEDECODELISTENER_H__
#include <cstddef>
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Compiler.h>
namespace OnixS {
namespace FIX {
namespace SBE {
/// The SBE decode session's listener.
/// This interface declares set of methods called by the EventBasedDecoder during the decoding process.
class ONIXS_FIXENGINE_API IDecodeListener
{
public:
/// @note The FIX Engine does NOT manage the lifetime of this listener.
virtual ~IDecodeListener() ONIXS_FIXENGINE_DEFAULT;
/// @name Entire message events
/// These events belong to the entire message. Each one from the group occurs a single time per a message.
/// @{
/// Called when a new SBE-encoded message started to decode.
///
/// @param templateId The SBE template identifier of the message.
/// @param messageType The FIX type of the message.
/// @param messageTypeLength The length of the messageType string. Doe not include the terminating zero.
virtual void onBeginMessage(unsigned templateId, const char * messageType, size_t messageTypeLength) = 0;
/// Called when the decoder finishes the current message decoding.
/// @note It is possible to reset the caller decoder during this callback.
virtual void onEndMessage() = 0;
/// @}
/// @name Data field events
/// These events denotes that particular fields were decoded. Events occurs once per a field.
/// @{
/// Called when a single-char field decoded.
///
/// @param tag The FIX tag of the field.
/// @param value The decoded value.
virtual void onValue(int tag, char value) = 0;
/// Called when a signed 16-bit integer or signed 8-bit integer field decoded.
///
/// @param tag The FIX tag of the field.
/// @param value The decoded value.
virtual void onValue(int tag, short value) = 0;
/// Called when an unsigned 16-bit integer or unsigned 8-bit integer field decoded.
///
/// @param tag The FIX tag of the field.
/// @param value The decoded value.
virtual void onValue(int tag, unsigned short value) = 0;
/// Called when a signed 32-bit integer field decoded.
///
/// @param tag The FIX tag of the field.
/// @param value The decoded value.
virtual void onValue(int tag, int value) = 0;
/// Called when an unsigned 32-bit integer field decoded.
///
/// @param tag The FIX tag of the field.
/// @param value The decoded value.
virtual void onValue(int tag, unsigned value) = 0;
/// Called when a signed 64-bit integer field decoded.
///
/// @param tag The FIX tag of the field.
/// @param value The decoded value.
virtual void onValue(int tag, long long value) = 0;
/// Called when an unsigned 64-bit integer field decoded.
///
/// @param tag The FIX tag of the field.
/// @param value The decoded value.
virtual void onValue(int tag, unsigned long long value) = 0;
/// Called when a decimal field decoded.
///
/// @param tag The FIX tag of the field.
/// @param mantissa The mantissa of the decoded decimal value.
/// @param exponent The exponent of the decoded decimal value (in range of -64..63).
virtual void onValue(int tag, long long mantissa, int exponent) = 0;
/// Called when a string (ASCII or Unicode) or byteVector decoded.
///
/// @param tag The FIX tag of the field.
/// @param value The pointer to start of decoded data.
/// @param valueLength The length of decoded data (does not include the terminating zero for &lt;string&gt; fields).
virtual void onValue(int tag, const char * value, size_t valueLength) = 0;
/// Called when a float field decoded.
///
/// @param tag The FIX tag of the field.
/// @param value The decoded value.
virtual void onValue(int tag, float value) = 0;
/// Called when a long float (double) field decoded.
///
/// @param tag The FIX tag of the field.
/// @param value The decoded value.
virtual void onValue(int tag, double value) = 0;
/// @}
/// @name Sequence events
/// These callbacks embraces the sequence decoding. Each callback called once per a sequence unless the sequence is empty.
/// @{
/// Called just before first entry of the sequence decoding.
///
/// @param tag The Tag of the sequence
/// @param itemCount The number of entries in the sequence.
virtual void onBeginSequence(int tag, size_t itemCount) = 0;
/// Called immediately after the last sequence entry decoded.
virtual void onEndSequence() = 0;
/// @}
/// @name Sequence entry events
/// These callbacks embraces the sequence entry decoding. Each callback called once per a sequence entry.
/// @{
/// Called just before the sequence entry decoding.
/// @param index The index of the entry.
virtual void onBeginSequenceEntry(size_t index) = 0;
/// Called after the entry was decoded.
virtual void onEndSequenceEntry() = 0;
/// @}
};
}
}
}
#endif // __ONIXS_ISBEDECODELISTENER_H__
@@ -0,0 +1,164 @@
/*
* 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 <string>
#include <OnixS/FIXEngine/Compiler.h>
#include <OnixS/FIXEngine/FIX/SequenceNumber.h>
#include <OnixS/FIXEngine/FIX/SessionState.h>
namespace OnixS {
namespace FIX {
ONIXS_FIXENGINE_API_DECL(class, Message);
ONIXS_FIXENGINE_API_DECL(class, FlatMessage);
ONIXS_FIXENGINE_API_DECL(class, Session);
/// The error reason.
struct ErrorReason {
enum Enum {
/// The general system-related error.
GeneralError,
/// The first message received is not a Logon message.
FirstMessageNotALogon,
/// The incoming message has a sequence number less than expected and the PossDupFlag is not set, it indicates a serious error.
/// It is strongly recommended that the session be terminated and a manual intervention be initiated.
MsgSeqNumTooLow,
/// The FIX Connection cannot be restored.
CannotRestoreConnection,
/// An exception was thrown during processing of the incoming message.
ExceptionDuringProcessingOfIncomingMessage,
/// The FIX message received is not valid.
InvalidIncomingMessage,
/// An exception was thrown in the client event handler implementation.
ExceptionInEventHandler,
/// Socket options cannot be set.
SetSocketOptionError
};
};
/// The warning reason.
struct WarningReason {
enum Enum {
/// The general system-related warning
GeneralWarning,
/// A garbled message is received.
GarbledMessageReceived,
/// The telecommunication link error is detected.
LinkError,
/// The sequence gap in the incoming messages is detected.
SeqGapIsDetected,
/// The ResendTimeout is elapsed.
ResendTimeout,
/// Cannot re-establish the FIX Connection after the reconnect attempt.
CannotConnect
};
};
/// The session's Listener.
class ONIXS_FIXENGINE_API ISessionListener
{
public:
/// @note the FIX Engine/Session does NOT manage the lifetime of this listener.
virtual ~ISessionListener() ONIXS_FIXENGINE_DEFAULT;
/// Is called when the message mode is `Message` and the application-level message is received from the counterparty.
///
/// @note: do no call the base method if you have overridden it in the derived class.
virtual void onInboundApplicationMsg(Message & message, Session * session) = 0;
/// Is called when the message mode is `FlatMessage` and the application-level message is received from the counterparty.
///
/// @note: do no call the base method if you have overridden it in the derived class.
virtual void onInboundApplicationMsg(FlatMessage&, Session*) {}
/// Is called when the message mode is `Message` and the session-level message is received from the counterparty.
/// @note: do no call the base method if you have overridden it in the derived class.
virtual void onInboundSessionMsg(Message & /*message*/, Session * /*session*/) {}
/// Is called when the message mode is `FlatMessage` and the session-level message is received from the counterparty.
/// @note: do no call the base method if you have overridden it in the derived class.
virtual void onInboundSessionMsg(FlatMessage & /*message*/, Session * /*session*/) {}
/// Is called when the application-level message is sent to the counterparty.
///
/// @note: do no call the base method if you have overridden it in the derived class.
/// @note: The message's sequence number is the preliminary one.
///
/// @warning: It is called under the session's lock.
virtual void onOutboundApplicationMsg(Message & /*message*/, Session * /*session*/) {}
/// Is called when the session-level message is sent to the counterparty.
///
/// @note: do no call the base method if you have overridden it in the derived class.
/// @note: The message's sequence number is the preliminary one.
///
/// @warning: It is called under the session's lock.
virtual void onOutboundSessionMsg(Message & /*message*/, Session * /*session*/) {}
/// Is called as soon as bytes are received from the wire.
virtual void onReceivedBytes(const char * /*bytes*/, size_t /*size*/, Session * /*session*/) {}
/// Is called just before the FIX message is sent to the wire.
///
/// @warning: It is called under the session's lock.
virtual void onMessageSending(SequenceNumber /*msgSeqNum*/, char * /*bytes*/, size_t /*size*/, Session * /*session*/) {}
/// Is called when the session changes its state.
virtual void onStateChange(SessionState::Enum /*newState*/, SessionState::Enum /*prevState*/, Session * /*session*/) {}
/// Is called when the message mode is `Message` and the sent application-level message is about to be
/// re-sent to the counterparty in reply to the ResendRequest<2> message.
///
/// @return `true` if the message should be re-sent, otherwise - `false`.
virtual bool onResendRequest(Message & /*message*/, Session * /*session*/) { return false; }
/// Is called when the message mode is `FlatMessage` and the sent application-level message is about to be
/// re-sent to the counterparty in reply to the ResendRequest<2> message.
///
/// @return `true` if the message should be re-sent, otherwise - `false`.
virtual bool onResendRequest(FlatMessage & /*message*/, Session * /*session*/) { return false; }
/// Is called when the ResendRequest<2> message is received and the session is about to start to resend messages.
virtual void onResendingStarted(SequenceNumber /*beginSeqNo*/, SequenceNumber /*endSeqNo*/, Session* /*session*/) {}
/// Is called when the resending process is completed.
virtual void onResendingFinished(SequenceNumber /*beginSeqNo*/, SequenceNumber /*endSeqNo*/, Session* /*session*/) {}
/// Is called when an error condition is detected.
virtual void onError(ErrorReason::Enum /*reason*/, const std::string & /*description*/, Session * /*session*/) {}
/// Is called when a warning condition is detected.
virtual void onWarning(WarningReason::Enum /*reason*/, const std::string & /*description*/, Session * /*session*/) {}
};
}
}
@@ -0,0 +1,64 @@
/*
* 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/FIXEngine/Threading/Definitions.h>
namespace OnixS {
namespace FIX {
/// The network reactor type.
struct ReactorType {
enum Enum {
/// The undefined reactor.
Undefined = 0,
/// The Solarflare TCPDirect reactor.
TcpDirect = 1,
/// The standard TCP reactor.
TcpStandard = 2
};
};
/// The session's network stack reactor interface.
class ONIXS_FIXENGINE_API ISessionReactor
{
public:
/// The destructor.
virtual ~ISessionReactor() ONIXS_FIXENGINE_DEFAULT;
/// Processes events on a stack and performs the necessary handling.
///
/// These events include transmit and receive events raised by the hardware,
/// and also software events such as TCP and FIX protocol timers.
virtual void dispatchEvents() = 0;
/// \return A boolean value indicating whether a stack is quiescent.
virtual bool isQuiescent() const = 0;
/// \return The ID of the thread that created the stack.
virtual Threading::ThreadId threadId() const = 0;
/// \return The type of the stack.
virtual ReactorType::Enum type() const = 0;
};
}
}
@@ -0,0 +1,174 @@
/*
* 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 <string>
#include <vector>
#include <OnixS/FIXEngine/Compiler.h>
#include <OnixS/FIXEngine/FIX/Timestamp.h>
#include <OnixS/FIXEngine/FIX/Message.h>
#include <OnixS/FIXEngine/FIX/FlatMessage.h>
namespace OnixS {
namespace FIX {
/// The session's pluggable storage.
class ONIXS_FIXENGINE_API ISessionStorage
{
public:
/// The destructor.
virtual ~ISessionStorage() ONIXS_FIXENGINE_DEFAULT;
/// Clears the storage.
virtual void clear() = 0;
/// Closes the storage.
///
/// @param keepSequenceNumbers The flag to indicate if it needs to clear sequence numbers on close or not. It corresponds to the same parameter in the Session's constructor.
/// @param doBackup The flag to indicate if it needs to back up the stored data. It is true, when the Session::resetLocalSequenceNumbers() method is called.
virtual void close(bool keepSequenceNumbers, bool doBackup) = 0;
/// The pointer to the native (tag=value) FIX Message.
struct ONIXS_FIXENGINE_API RawMessagePointer {
RawMessagePointer();
RawMessagePointer(const char * buffer, size_t length);
/// @note The buffer is NOT owned by the RawMessagePointer.
const char * buffer_;
size_t length_;
};
/// The Session Storage listener that is used to replay messages.
class ISessionStorageListener
{
public:
/// @note The FIX Engine/Session Storage does NOT manage the lifetime of this listener.
virtual ~ISessionStorageListener() ONIXS_FIXENGINE_DEFAULT;
/// The Implementation should pass required messages one by one to this method.
virtual void onReplayedMessage(const RawMessagePointer & pointer) = 0;
};
/// Gets the messages that have been sent earlier.
/// The implementation should pass required messages one by one to the ISessionStorageListener::onReplayedMessage(const RawMessagePointer& pointer) method.
/// It is possible to omit some or even all messages in the requested range, in this case the Engine will automatically
/// generate appropriate \a SequenceReset-GapFill messages to replace omitted ones.
///
/// @param beginSequenceNumber The sequence number of first message to resend.
/// @param endSequenceNumber the sequence number of last message to resend.
/// @param listener Requested messages have to be passed to the interface using the ISessionStorageListener::onReplayedMessage method.
/// @note The FIX Engine/Session Storage does NOT manage the lifetime of this listener.
virtual void getOutbound(SequenceNumber beginSequenceNumber, SequenceNumber endSequenceNumber, ISessionStorageListener * listener) = 0;
/// Returns the last inbound sequence number.
virtual SequenceNumber inSeqNum() = 0;
/// Sets the last inbound sequence number.
virtual void inSeqNum(SequenceNumber messageSequenceNumber) = 0;
/// Stores the given inbound message.
///
/// @param message The incoming message.
/// @param sequenceNumber The sequence number of the inbound message.
/// @param pointer The raw buffer of the inbound message.
/// @param logMessage The flag to indicate whether it needs to store the content of the message in the session storage or not.
/// This parameter depends on the Session::logInboundMessages() and Session::inboundMessageLogFilter() settings.
virtual void storeInbound(const Message & message, SequenceNumber sequenceNumber, const RawMessagePointer & pointer, bool logMessage) = 0;
/// Stores the given inbound message.
///
/// @param message The incoming message.
/// @param sequenceNumber The sequence number of the inbound message.
/// @param pointer The raw buffer of the inbound message.
/// @param logMessage The flag to indicate whether it needs to store the content of the message in the session storage or not.
/// This parameter depends on the Session::logInboundMessages() and Session::inboundMessageLogFilter() settings.
virtual void storeInbound(const FlatMessage & message, SequenceNumber sequenceNumber, const RawMessagePointer & pointer, bool logMessage) = 0;
/// Stores the given outgoing message.
/// It is called when the `messageMode` is set to `Message`.
///
/// @param message The outgoing message.
/// @param pointer The raw buffer of the outgoing message.
/// @param logMessage The flag to indicate whether it needs to store the content of the message in the session storage or not.
/// This parameter depends on the Session::logOutboundMessages() and Session::outboundMessageLogFilter() settings.
virtual void storeOutbound(const Message & message, const RawMessagePointer & pointer, bool logMessage) = 0;
/// Stores the given outgoing message.
/// It is called when the `messageMode` is set to `FlatMessage`.
///
/// @param message The outgoing message.
/// @param sequenceNumber The sequence number of the outgoing message.
/// @param pointer The raw buffer of the outgoing message.
/// @param logMessage The flag to indicate whether it needs to store the content of the message in the session storage or not.
/// This parameter depends on the Session::logOutboundMessages() and Session::outboundMessageLogFilter() settings.
virtual void storeOutbound(const FlatMessage & message, SequenceNumber sequenceNumber, const RawMessagePointer & pointer, bool logMessage) = 0;
/// Sets the session termination flag.
///
/// @param terminated If 'true' then the session is terminated and its state information is not needed any more.
/// It happens when the session is disconnected gracefully, and the `keepSequenceNumbers` parameter is false.
virtual void setSessionTerminationFlag(bool terminated) = 0;
/// Returns the last outgoing sequence number.
virtual SequenceNumber outSeqNum() = 0;
/// Sets the last outgoing sequence number.
virtual void outSeqNum(SequenceNumber messageSequenceNumber) = 0;
/// Sets the session creation time.
/// The implementation should store the \a timestamp value. This value have to be returned without changes
/// by subsequent ISessionStorage::sessionCreationTime() calls.
///
/// @param timestamp The timestamp to store in the storage.
virtual void sessionCreationTime(Timestamp timestamp) = 0;
/// Returns a value stored by the ISessionStorage::sessionCreationTime(Timestamp) call.
/// If the timestamp was never updated the method should return an instance
/// of the OnixS::FIX::Timestamp class created by the default constructor.
///
/// The code snippet below illustrate this approach:
///
/// virtual Timestamp sessionCreationTime() {
///
/// if (!creationTimeUpdated_)
/// return Timestamp();
///
/// /* Return previously stored value. */
///
/// }
///
virtual Timestamp sessionCreationTime() = 0;
/// Flushes all internal buffers
virtual void flush() = 0;
/// Returns the number of sent messages that are available for resending on counterparty's Resend Request <2> message
virtual size_t resendingQueueSize() const = 0;
/// Sets the number of sent messages that are available for resending on counterparty's Resend Request <2> message
virtual void resendingQueueSize(size_t value) = 0;
/// Warm ups the storage
virtual void warmup(size_t /*messageSize*/) {}
};
}
}
@@ -0,0 +1,57 @@
/*
* 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
namespace OnixS {
namespace FIX {
namespace FAST {
/// @brief Characteristics of the input data stream for decoding.
///
/// This enumeration allows to setup decoder in dependent-decoding (i.e. @c decodeEachMessageIndependently == false) mode for particular characteristics of the input data stream.
///
/// The `CompleteMessagesOnly` allows to perform decoding faster, but requires explicit call of Decoder::reset when someone error occurs or
/// Decoder::decode returns NULL. Decoder::decode() will fire exception if such reset was omitted after exception.
///
/// This commonly prohibits usage of the mode for decoding streaming data like TCP/IP stream. On another hand the mode is highly recommended for the data distributed via
/// UDP multicast or other packet transport which requires reset of decoder at someone strongly determined points.
///
/// The `CouldContainPartialMessages` initiates a bit slower decoding then the `CompleteMessagesOnly` but could be used for stream data decoding using following method:
///
/// Decoder decoder(templates, dictionary, false, InputDataTraits::CouldContainPartialMessages);
/// ...
/// const Message *message = 0;
/// while(!message) {
/// /* consume some data */
/// decoder.tryDecode(buffer, offset, count, &message, &numberOfDecodedBytes);
/// }
///
struct InputDataTraits {
enum Enum {
/// Faster decoding but requires explicit decoder reset when error occurs.
CompleteMessagesOnly = 0,
/// Slower decoding, allows to try to decode incomplete messages as well as handling of wrong/damaged data without subsequent explicit reset.
CouldContainPartialMessages = 1
};
};
}
}
}
+354
View File
@@ -0,0 +1,354 @@
/*
* 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 <iosfwd>
#include <string>
#include <OnixS/FIXEngine/FIX/SequenceNumber.h>
#include <OnixS/FIXEngine/FIX/FieldSet.h>
#include <OnixS/FIXEngine/FIX/Dictionary.h>
#include <OnixS/FIXEngine/FIX/MessageStringingFlags.h>
#include <OnixS/FIXEngine/FIX/MessageParsingFlags.h>
#include <OnixS/FIXEngine/FIX/MessageValidationFlags.h>
#include <OnixS/FIXEngine/FIX/RawMessage.h>
namespace OnixS {
namespace FIX {
/// Encapsulates operations over a FIX Message.
///
/// Message supports the 'unconstructed' state which can be
/// treated as a pointer in the null state. However, in contrast to
/// OnixS::FIX::Group and OnixS::FIX::GroupInstance classes it
/// does NOT represent a light-weight wrapper over internal structures.
/// In fact, it holds all the data which is fully copied on an assignment
/// or a copy construction and disposed at the instance destruction.
///
/// FIX field related operations now available via the OnixS::FIX::FieldSet
/// class from which the OnixS::FIX::Message class is now derived.
class
ONIXS_FIXENGINE_API
Message : public FieldSet
{
public:
/// Initializes a message in the unconstructed state.
///
/// @param expectedMessageSize An expected size of the FIX message.
/// The 'expectedMessageSize' parameter is used as a hint for the optimization of the manipulation (parsing, setting, etc.)
/// of large FIX messages with a lot of repeating groups.
///
/// @note The large value of the 'expectedMessageSize' parameter can increase the memory consumption by the `Message` object,
/// so try to increase the value only in case of a latency degradation of the large FIX messages manipulation.
explicit Message(size_t expectedMessageSize = DefaultExpectedMessageSize);
/// Constructs a FIX message of the given type which belongs to
/// the given dictionary of the FIX protocol (messaging specification).
///
/// @param type Defines the type of the message (MsgType field value).
/// @param dictionary The FIX protocol dictionary to which the message belongs to.
/// @param expectedMessageSize An expected size of the FIX message.
/// The 'expectedMessageSize' parameter is used as a hint for the optimization of the manipulation (parsing, setting, etc.)
/// of large FIX messages with a lot of repeating groups.
///
/// @note The large value of the 'expectedMessageSize' parameter can increase the memory consumption by the `Message` object,
/// so try to increase the value only in case of a latency degradation of the large FIX messages manipulation.
///
/// @warning The type of the message can't be changed by updating the MsgType
/// field value. Changing the MsgType field value have no effect for the known
/// message which are defined by the dictionary associated with message.
Message(const char * type, const Dictionary & dictionary, size_t expectedMessageSize = DefaultExpectedMessageSize);
/// Initializes an instance as a deep copy of other one.
///
/// @param other The message to be copied from.
Message(const Message & other);
/// Disposes all internal data structures.
///
/// @warning Once an instance is destructed, all instances of
/// OnixS::FIX::Group and OnixS::FIX::GroupInstance classes
/// obtained from this instance must not be used any more.
virtual ~Message();
/// An instance of the FIX dictionary or standard FIX messages
/// dictionary to which the message belongs to.
Dictionary dictionary() const;
/// Returns the message type (MsgType(35) field value).
FieldValueRef type() const;
/// Returns the message sequence number
/// (the MsgSeqNum (tag=34) field value).
SequenceNumber seqNum() const;
/// Sets the message sequence number
/// (the MsgSeqNum (tag=34) field value).
void seqNum(SequenceNumber value);
/// Returns the assigned value used to identify
/// the firm sending message (SenderCompID (49) field value).
FieldValueRef senderCompId() const;
/// Sets the assigned value used to identify the firm
/// sending message (SenderCompID (49) field value).
void senderCompId(const std::string &);
/// Returns the assigned value used to identify
/// the receiving firm (TargetCompID(56) field value).
FieldValueRef targetCompId() const;
/// Sets the assigned value used to identify
/// the receiving firm (TargetCompID(56) field value).
void targetCompId(const std::string &);
/// A user data associated with the message.
///
/// @return The pointer to data was previously
/// attached to the instance or NULL.
void * userData() const;
/// Attaches a user data to the message.
void userData(void * data);
/// Compares two messages. The comparison is performed
/// using 'tag=value' message presentations.
bool operator == (const Message &) const;
/// Compares two messages. The comparison is performed
/// using 'tag=value' message presentations.
bool operator != (const Message &) const;
/// Ensures the message satisfies basic FIX Specification requirements.
///
/// @throw The std::exception if the validation fails.
///
/// @note This method validates required fields for the application level only, without the message header/trailer
void validate() const;
/// Validates the message according to specified criteria.
///
/// @param validationFlags Specifies validation criteria.
///
/// @throw The std::exception if the validation fails.
///
/// @note This method validates required fields for the application level only, without the message header/trailer
void validate(MessageValidationFlags validationFlags) const;
/// Tries to validate the message according to specified criteria.
/// Returns 'true' if the validation is successful, otherwise - 'false'.
///
/// @param validationFlags Validation criteria.
/// @param errorDescription Contains the error description in case the validation fails.
///
/// @note This method validates required fields for the application level only, without the message header/trailer
bool tryValidate(MessageValidationFlags validationFlags, std::string & errorDescription) const;
/// Brings the message to the 'blank' state as it was just constructed.
///
/// @warning For messages constructed with the certain message type
/// member wipes out field values for all the fields except several
/// service fields (MsgType, BeginString, etc). For the message in
/// the unconstructed state does actually nothing.
void clear();
/// Builds the FIX-compliant 'tag=value' presentation of the message.
void toRaw(RawMessage &) const;
/// Returns the string representation of the message using
/// the given delimiter and additional control flags.
///
/// @param delimiter Defines the field delimiter to be used.
/// @param flags Affects how the message presentation looks like.
std::string
toString(
char delimiter = 0x1,
MessageStringingFlags flags =
MessageStringingFlag::IncludeFieldTagNumber) const;
/// Appends the string representation of the message using
/// the given delimiter and additional control flags.
///
/// @param str The string to which the presentation is appended.
/// @param delimiter Defines the field delimiter to be used.
/// @param flags Affects how the message presentation looks like.
void
toString(
std::string & str,
char delimiter = 0x1,
MessageStringingFlags flags =
MessageStringingFlag::IncludeFieldTagNumber) const;
/// Returns the XML representation of the message.
std::string
toXml() const;
/// Appends the XML representation of the message.
///
/// @param str The string to which the presentation is appended.
void
toXml(std::string & str) const;
/// Returns the JSON representation of the message.
std::string
toJson() const;
/// Appends the JSON representation of the message.
///
/// @param str The string to which the presentation is appended.
void
toJson(std::string & str) const;
/// Calculates the message body length and checkSum and updates corresponding fields.
void updateBodyLengthAndCheckSum();
// Reassigns the message as a copy of other one.
Message & operator = (const Message &);
// Copies all message fields (except the protocol version) from another message object.
void copyFields(const Message &);
/// De-serializes the FIX message from its raw (tag=value) presentation.
///
/// @param rawMessage The buffer in which the raw FIX message is stored.
/// @param rawMessageSize The size of the buffer in which the raw FIX message is stored.
/// @param message The parsed FIX message if the parsing succeeds.
///
/// @throw The std::exception if the parsing fails.
static
void
parse(
const char * rawMessage,
size_t rawMessageSize,
Message & message);
/// De-serializes the FIX message from its raw (tag=value) presentation.
///
/// @param rawMessage The buffer in which the raw FIX message is stored.
/// @param rawMessageSize The Size of the buffer in which the raw FIX message is stored.
/// @param parsingFlags Flags which affect the parsing behavior.
/// @param message The parsed FIX message if the parsing succeeds.
///
/// @throw The std::exception if the parsing fails.
static
void
parse(
const char * rawMessage,
size_t rawMessageSize,
MessageParsingFlags parsingFlags,
Message & message);
/// De-serializes the FIX message from its raw (tag=value) presentation.
///
/// @param rawMessage The buffer in which the raw FIX message is stored.
/// @param rawMessageSize The Size of the buffer in which the raw FIX message is stored.
/// @param dictionary The FIX dictionary to which the message supposed to belong.
/// @param parsingFlags Flags which affect the parsing behavior.
/// @param message The parsed FIX message if the parsing succeeds.
///
/// @throw The std::exception if the parsing fails.
static
void
parse(
const char * rawMessage,
size_t rawMessageSize,
const Dictionary & dictionary,
MessageParsingFlags parsingFlags,
Message & message);
/// De-serializes the FIX message from its raw (tag=value)
/// presentation which may be truncated.
///
/// @param rawMessage The buffer in which the raw FIX message is stored.
/// @param rawMessageSize The Size of the buffer in which the raw FIX message is stored.
/// @param message The parsed FIX message if the parsing succeeds.
///
/// @return true if the message can be recognized from the input.
static
bool
parsePartial(
const char * rawMessage,
size_t rawMessageSize,
Message & message);
/// De-serializes the FIX message from its raw (tag=value)
/// presentation which may be truncated.
///
/// @param rawMessage The buffer in which the raw FIX message is stored.
/// @param rawMessageSize The Size of the buffer in which the raw FIX message is stored.
/// @param dictionary The FIX dictionary to which the message supposed to belong.
/// @param message The parsed FIX message if the parsing succeeds.
///
/// @return true if the message can be recognized from the input.
static
bool
parsePartial(
const char * rawMessage,
size_t rawMessageSize,
const Dictionary & dictionary,
Message & message);
struct MakeShallowCopy {};
protected:
/// Initializes an instance as a shallow copy of other one.
///
/// @param other The message to be copied from.
Message(const Message & other, MakeShallowCopy);
private:
friend class MessageWrapper;
friend class MessageOperator;
Message(const void *);
private:
virtual void userDataImpl(void * data);
unsigned char impl_[6 * sizeof(size_t)];
unsigned char allocator_[4 * sizeof(size_t)];
static const size_t DefaultExpectedMessageSize = 10240;
void construct(size_t expectedMessageSize = DefaultExpectedMessageSize);
void destruct();
};
inline
std::string
Message::toString(
char delimiter,
MessageStringingFlags flags) const
{
std::string str;
toString(str, delimiter, flags);
return str;
}
/// The stream output.
ONIXS_FIXENGINE_API
std::ostream & operator << (std::ostream & os, const Message & message);
}
}
@@ -0,0 +1,51 @@
/*
* 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/FIXEngine/ABI.h>
namespace OnixS {
namespace FIX {
/// The collection of flags which affect the way the FIX message
/// is parsed from its raw (tag=value) presentation.
struct
ONIXS_FIXENGINE_API
MessageParsingFlag {
enum Enum {
None = 0x0,
VerifyBodyLength = 0x1,
VerifyCheckSum = 0x2,
VerifyRepeatingGroupEntryCount = 0x4,
VerifyRepeatingGroupLeadingTag = 0x8,
VerifyDuplicatedField = 0x10,
Strict = VerifyBodyLength |
VerifyCheckSum |
VerifyRepeatingGroupEntryCount |
VerifyRepeatingGroupLeadingTag |
VerifyDuplicatedField
};
};
/// The collection of message parsing flags.
typedef unsigned MessageParsingFlags;
}
}
@@ -0,0 +1,49 @@
/*
* 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/FIXEngine/ABI.h>
namespace OnixS {
namespace FIX {
/// Contains flags which affect the FIX message textual presentation.
struct
ONIXS_FIXENGINE_API
MessageStringingFlag {
/// Flags which affect the FIX message textual presentation.
enum Enum {
/// Only field values are serialized.
NoFieldInfo = 0x0,
/// Field tag numbers are included during the serialization.
IncludeFieldTagNumber = 0x1,
/// Field names are included during the serialization.
IncludeFieldName = 0x2,
/// Value descriptions are included (if exist) during the serialization.
IncludeValueDescription = 0x4
};
};
/// The collection of message stringing flags.
typedef unsigned MessageStringingFlags;
}
}
@@ -0,0 +1,51 @@
/*
* 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/FIXEngine/ABI.h>
namespace OnixS {
namespace FIX {
/// The collection of flags which affect the way FIX message
/// is validated.
struct
ONIXS_FIXENGINE_API
MessageValidationFlag {
enum Enum {
None = 0x0,
VerifyEmptyFieldValues = 0x1,
VerifyFieldValues = 0x2,
VerifyRequiredFields = 0x4,
VerifyUnknownFields = 0x8,
VerifyUnknownMessages = 0x10,
Strict = VerifyEmptyFieldValues |
VerifyFieldValues |
VerifyRequiredFields |
VerifyUnknownFields |
VerifyUnknownMessages
};
};
/// The collection of message validation flags.
typedef unsigned MessageValidationFlags;
}
}
+322
View File
@@ -0,0 +1,322 @@
/*
* 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/FIXEngine/ABI.h>
#include <string>
#include <stdexcept>
#include <iosfwd>
namespace OnixS {
namespace FIX {
typedef char Char;
typedef short int Int16;
typedef short unsigned int UInt16;
typedef int Int32;
typedef unsigned int UInt32;
typedef long long Int64;
typedef unsigned long long UInt64;
typedef double Double;
typedef Int64 DecimalMantissa;
typedef Int32 DecimalExponent;
/// The Decimal type for a better precision.
class ONIXS_FIXENGINE_API Decimal
{
public:
/// Initializes an instance from compound components.
Decimal(
DecimalMantissa mantissa = 0,
DecimalExponent exponent = 0);
/// Converts the Double value to a decimal.
/// @param value The double precision floating-point value.
/// @param precision Defines the conversion precision.
explicit Decimal(Double value, size_t precision = 17);
/// Returns the mantissa part of the decimal.
DecimalMantissa mantissa() const;
/// Updates the mantissa part of the decimal.
void mantissa(DecimalMantissa);
/// Returns the exponent part of the decimal.
DecimalExponent exponent() const;
/// Updates the exponent part of the decimal.
void exponent(DecimalExponent);
/// Compares two numbers.
bool operator == (const Decimal &) const;
/// Compares two numbers.
bool operator != (const Decimal &) const;
/// Compares two numbers.
bool operator < (const Decimal &) const;
/// Compares two numbers.
bool operator > (const Decimal &) const;
/// Casts to the whole integer number as a regular
/// floating point value is casted.
/// @throw The domain_error exception on a failure.
operator Int32() const;
/// Casts to the whole integer number as a regular
/// floating point value is casted.
/// @throw The domain_error exception on a failure.
operator UInt32() const;
/// Casts to the whole integer number as a regular
/// floating point value is casted.
/// @throw The domain_error exception on a failure.
operator Int64() const;
/// Casts to the whole integer number as a regular
/// floating point value is casted.
/// @throw The domain_error exception on a failure.
operator UInt64() const;
/// Casts to the whole integer number as a regular
/// floating point value is casted.
/// @throw The domain_error exception on a failure.
operator Double() const;
/// Casts to the whole integer number as a regular
/// floating point value is casted.
/// @return false if the conversion fails.
bool toNumber(Int32 &) const;
/// Casts to the whole integer number as a regular
/// floating point value is casted.
/// @return false if the conversion fails.
bool toNumber(UInt32 &) const;
/// Casts to the whole integer number as a regular
/// floating point value is casted.
/// @return false if the conversion fails.
bool toNumber(Int64 &) const;
/// Casts to the whole integer number as a regular
/// floating point value is casted.
/// @return false if the conversion fails.
bool toNumber(UInt64 &) const;
/// Casts to the floating point number.
/// @return false if the conversion fails.
bool toNumber(Double &) const;
/// Appends the text presentation to the given string.
void toString(std::string &) const;
/// Returns the text presentation of the decimal.
std::string toString() const;
/// Attempts to parse the decimal value
/// from its string/text presentation.
/// @return false on the parsing failure.
static
bool
tryParse(
const char * buffer,
size_t bufferSize,
Decimal &);
/// Parses the decimal from the string presentation.
/// @throw The std::exception on a failure.
static
Decimal
parse(
const char * buffer,
size_t bufferSize);
private:
/// The mantissa.
DecimalMantissa mantissa_;
/// The exponent.
DecimalExponent exponent_;
};
ONIXS_FIXENGINE_API std::ostream & operator<<(std::ostream &, Decimal const &);
inline
Decimal::Decimal(
DecimalMantissa mantissa,
DecimalExponent exponent)
: mantissa_(mantissa),
exponent_(exponent)
{
}
inline
DecimalMantissa
Decimal::mantissa() const
{
return mantissa_;
}
inline
void
Decimal::mantissa(
DecimalMantissa value)
{
mantissa_ = value;
}
inline
DecimalExponent
Decimal::exponent() const
{
return exponent_;
}
inline
void
Decimal::exponent(
DecimalExponent value)
{
exponent_ = value;
}
inline
Decimal::operator Int32() const
{
Int32 number;
if(toNumber(number))
return number;
throw std::domain_error(
"Cannot cast value to target type. ");
}
inline
Decimal::operator UInt32() const
{
UInt32 number;
if(toNumber(number))
return number;
throw std::domain_error(
"Cannot cast value to target type. ");
}
inline
Decimal::operator Int64() const
{
Int64 number;
if(toNumber(number))
return number;
throw std::domain_error(
"Cannot cast value to target type. ");
}
inline
Decimal::operator UInt64() const
{
UInt64 number;
if(toNumber(number))
return number;
throw std::domain_error(
"Cannot cast value to target type. ");
}
inline
Decimal::operator Double() const
{
Double number;
if(toNumber(number))
return number;
throw std::domain_error(
"Cannot cast value to target type. ");
}
inline
std::string
Decimal::toString() const
{
std::string presentation;
toString(presentation);
return presentation;
}
/// The helper class for the conversion from a string to a number.
struct
ONIXS_FIXENGINE_API
Number {
static
bool
tryParse(
const char * buffer,
size_t bufferSize,
Int32 & number);
static
bool
tryParse(
const char * buffer,
size_t bufferSize,
UInt32 & number);
static
bool
tryParse(
const char * buffer,
size_t bufferSize,
Int64 & number);
static
bool
tryParse(
const char * buffer,
size_t bufferSize,
UInt64 & number);
static
bool
tryParse(
const char * buffer,
size_t bufferSize,
Double & number);
static
bool
tryParse(
const char * buffer,
size_t bufferSize,
Decimal & number);
};
}
}
@@ -0,0 +1,47 @@
/*
* 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.
*/
#include <OnixS/FIXEngine/ABI.h>
#pragma once
namespace OnixS {
namespace FIX {
/// The FIX Protocol version.
struct ProtocolVersion {
enum Enum {
UNKNOWN = 0,
FIX_40 = 1,
FIX_41 = 2,
FIX_42 = 3,
FIX_43 = 4,
FIX_44 = 5,
FIX_50 = 6,
FIX_50_SP1 = 7,
FIX_50_SP2 = 8
};
ONIXS_FIXENGINE_API
static
const char *
toString(Enum version);
};
}
}
@@ -0,0 +1,58 @@
/*
* 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 <iosfwd>
#include <OnixS/FIXEngine/ABI.h>
namespace OnixS {
namespace FIX {
/// The helper class to represent a raw FIX message.
class ONIXS_FIXENGINE_API RawMessage
{
public:
RawMessage();
RawMessage(const RawMessage & other);
~RawMessage();
const char * data() const;
size_t size() const;
bool empty() const;
void clear();
bool operator == (const RawMessage &) const;
bool operator != (const RawMessage &) const;
RawMessage & operator = (const RawMessage &);
private:
friend class MessageOperator;
unsigned char impl_[4 * sizeof(size_t)];
};
/// The stream output.
ONIXS_FIXENGINE_API std::ostream & operator << (std::ostream & os, const RawMessage & message);
}
}
+247
View File
@@ -0,0 +1,247 @@
#pragma once
/*
* 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.
*/
#include <string>
#include <vector>
#include <map>
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Compiler.h>
#include <OnixS/FIXEngine/FIX/Tag.h>
#include <OnixS/FIXEngine/FIX/ProtocolVersion.h>
#include <OnixS/FIXEngine/FIX/SbeCustomization.h>
namespace OnixS {
namespace FIX {
ONIXS_FIXENGINE_API_DECL(class, Message);
ONIXS_FIXENGINE_API_DECL(class, Dictionary);
namespace SBE {
/// Encodes FIX messages into the SBE representation.
class ONIXS_FIXENGINE_API Encoder
{
public:
/// Creates a FIX to SBE Encoder.
///
/// @param xmlTemplates XML-based SBE templates.
/// @param customCoders The custom coders library.
Encoder(const std::string & xmlTemplates, ISbeCustomCoderLibrary *customCoders = ONIXS_FIXENGINE_NULLPTR);
/// Destructor.
~Encoder(void);
/// Encodes the given FIX message into a SBE stream.
///
/// @param[in] fixMessage The source FIX message to be encoded.
/// @param[in] templateID the SBE Template Identifier which uniquely describes the encoding/decoding rules.
/// @param[in] version The version of the template.
/// @param[in] buffer The supplied buffer that will contain the SBE stream chunk.
/// @param[in] bufferSize The size of the supplied buffer.
/// @param[out] rootBlockLength The size of the root block, used for the encoded message.
///
/// @return The size of the entire encoded SBE message.
size_t encode(const OnixS::FIX::Message & fixMessage, int templateID, int version,
unsigned char * buffer, size_t bufferSize, size_t * rootBlockLength) const;
/// Encodes the given FIX message into a SBE stream and prepends the message header.
///
/// @param[in] fixMessage The source FIX message to be encoded.
/// @param[in] templateID The SBE Template Identifier which uniquely describes the encoding/decoding rules.
/// @param[in] version The version of the template.
/// @param[in] buffer The supplied buffer that will contain the SBE stream chunk.
/// @param[in] bufferSize The size of the supplied buffer.
/// @param[out] rootBlockLength The size of the root block, used for the encoded message.
///
/// @return The size of the entire encoded SBE message.
size_t encodeWithHeader(const OnixS::FIX::Message& fixMessage, int templateID, int version,
unsigned char* buffer, size_t bufferSize, size_t* rootBlockLength) const;
/// The maximum known version of the SBE schema.
unsigned schemaVersion() const;
/// The schema identifier.
unsigned schemaId() const;
/// The semantic version of the SBE schema.
std::string schemaSemanticVersion() const;
/// The name of the encoding type of the message header, which is
/// the same for all messages in a schema.
std::string schemaHeaderType() const;
private:
Encoder(const Encoder &);
Encoder & operator = (const Encoder &);
struct Impl;
Impl * impl_;
};
/// Performs SBE to FIX decoding.
class ONIXS_FIXENGINE_API Decoder
{
public:
/// Creates a SBE to FIX Decoder.
///
/// @param xmlTemplates XML-based SBE templates.
/// @param fixDictionary The customized FIX dictionary used for the decoded message.
/// @param customCoders The custom coders library.
Decoder(const std::string & xmlTemplates, const OnixS::FIX::Dictionary & fixDictionary, ISbeCustomCoderLibrary* customCoders = ONIXS_FIXENGINE_NULLPTR);
/// Creates a SBE to FIX Decoder for the FIX dictionary-independent mode.
/// The generic FIX dictionary is created by the provided SBE-template content, uses the FIX 4.0 as a base FIX dictionary and has a generic name.
///
/// @param xmlTemplates XML-based SBE templates.
/// @param customCoders The custom coders library.
Decoder(const std::string & xmlTemplates, ISbeCustomCoderLibrary* customCoders = ONIXS_FIXENGINE_NULLPTR);
/// Creates a SBE to FIX Decoder for the FIX dictionary-independent mode.
/// The generic FIX dictionary is created by the provided SBE-template content, uses the specified FIX dictionary as a base and has a generic name.
///
/// @param baseVersion The version of the FIX protocol which the dictionary becomes a base for the newly generated FIX dictionary.
/// @param xmlTemplates XML-based SBE templates used to generate the FIX dictionary. This FIX dictionary takes a generic identifier generated on a base of the XML content and @c baseVersion
/// @param customCoders The custom coders library.
Decoder(ProtocolVersion::Enum baseVersion, const std::string & xmlTemplates, ISbeCustomCoderLibrary* customCoders = ONIXS_FIXENGINE_NULLPTR);
/// The destructor.
~Decoder();
/// Decodes the given SBE stream chunk into the corresponding FIX Message.
///
/// @param[in] templateId The identifier of the SBE template, used to decode the input data.
/// @param[in] version The version of the SBE schema, used to decode the input data.
/// @param[in] rootBlockLength The length of the root block. This value should be extracted from the message preamble, or from other source.
/// @param[in] buffer The buffer that contains the SBE stream chunk to be decoded.
/// @param[in] bufferSize The size of the buffer.
/// @param[out] numberOfDecodedBytes The number of bytes that contains the encoded FIX Message.
///
/// @warning The returned message is 'owned' by the Decoder.
/// @warning The previously decoded message is freed by the Decoder when this method is called again.
///
/// @throw An exception if the message cannot be decoded.
///
/// @return The decoded FIX message.
const OnixS::FIX::Message & decode(int templateId, int version, size_t rootBlockLength,
const unsigned char * buffer, size_t bufferSize, size_t * numberOfDecodedBytes = ONIXS_FIXENGINE_NULLPTR) const;
/// Decodes the given SBE stream chunk into the corresponding FIX Message using the message header.
///
/// This method decodes the given SBE stream chunk using the message header decoder that was built on a base of the SBE template.
///
/// @param[in] buffer The buffer that contains the SBE stream chunk to be decoded.
/// @param[in] bufferSize The size of the buffer.
/// @param[out] numberOfDecodedBytes The number of bytes that contained the encoded FIX Message.
/// @param[out] templateId The identifier of the SBE template, that was used to decode the input data.
/// @param[out] version The version of the SBE schema, that was used to decode the input data.
///
/// @warning The returned message is 'owned' by the Decoder.
/// @warning The previously decoded message is freed by the Decoder when this method is called again.
///
/// @throw An exception if the message cannot be decoded.
///
/// @return The decoded FIX message.
const OnixS::FIX::Message& decode(const unsigned char* buffer, size_t bufferSize, size_t* numberOfDecodedBytes = ONIXS_FIXENGINE_NULLPTR,
int *templateId = ONIXS_FIXENGINE_NULLPTR, int *version = ONIXS_FIXENGINE_NULLPTR) const;
/// Tries to decode the given SBE stream buffer into the corresponding FIX Message.
///
/// @param[in] templateId The identifier of the SBE template, used to decode the input data.
/// @param[in] version The version of the SBE schema, used to decode the input data.
/// @param[in] rootBlockLength The length of the root block. This value should be extracted from the message preamble, or from other source.
/// @param[in] buffer The SBE stream chunk to be decoded.
/// @param[in] offset The index in the buffer at which decoding begins.
/// @param[in] count The number of bytes to analyze during the decoding.
/// @param[out] message The pointer to the decoded FIX Message.
/// @param[out] numberOfDecodedBytes The number of bytes that contained the encoded FIX Message.
///
/// @warning the message should point to an existing object. This object is not owned by the Decoder and should be managed by a user.
///
/// @throw An exception if the decoding error is detected.
///
/// @return 'true' if the given bytes could be decoded into a FIX message, otherwise - 'false'.
bool tryDecode(int templateId, int version, size_t rootBlockLength,
const unsigned char * buffer, size_t offset, size_t count, OnixS::FIX::Message * message,
size_t * numberOfDecodedBytes) const;
/// The FIX dictionary used by the decoder instance.
///
/// @return The FIX dictionary currently used by the decoder instance. If the decoder was initialized with the FIX dictionary-independent mode, the method returns
/// a reference to the internally generated FIX dictionary.
OnixS::FIX::Dictionary fixDictionary() const;
/// Manage the maximum number of repeating groups, allowed for decoded messages.
///
/// This parameter is used during the decoding and is useful to detect a broken data, which, in particular cases,
/// can 'need' to allocate an unexpectedly huge number of entries (for an instance - billions of entries,
/// while normally there are just a few ones). This situation results in a memory exhausting and (often)
/// significantly decrease the overall system performance.
///
/// To prevent the memory exhausting and negative consequences of that, this parameter should be configured with the value,
/// which is greater then maximum possible number of entries in the valid input data, but less then the maximum integer value (default one).
/// In a lot of real cases value of 10000 is good enough to detect broken data without a memory overloading.
///
/// Default is the maximum positive value for the @c int type.
///
/// @param value The number of repeating groups, allowed for decoded messages.
void maximumNumberOfRepeatingGroupEntries(int value);
/// The maximum number of repeating groups, allowed for decoded messages.
///
/// @return The current number of repeating groups, allowed for decoded messages. The default value is the maximum positive value for the @c int type.
int maximumNumberOfRepeatingGroupEntries() const;
/// Generates the FIX dictionary XML.
///
/// @param[in] sbeTemplateXml The XML content of the SBE template (the same as used to initialize the Decoder).
///
static Dictionary generateFixDictionary(const std::string & sbeTemplateXml);
/// Generates the FIX dictionary XML.
///
/// @param[in] sbeTemplateXml The XML content of the SBE template (the same as used to initialize the Decoder).
/// @param[in] baseVersion The version of the FIX protocol which the dictionary becomes a base for the newly generated FIX dictionary.
static Dictionary generateFixDictionary(ProtocolVersion::Enum baseVersion,
const std::string & sbeTemplateXml);
/// The maximum known version of the SBE schema.
unsigned schemaVersion() const;
/// The schema identifier.
unsigned schemaId() const;
/// The semantic version of the SBE schema.
std::string schemaSemanticVersion() const;
/// The name of the encoding type of the message header, which is
/// the same for all messages in a schema.
std::string schemaHeaderType() const;
private:
friend ONIXS_FIXENGINE_API_DECL(class, OnixS::FIX::Dictionary);
Decoder(const Decoder &);
Decoder & operator = (const Decoder &);
struct Impl;
Impl * impl_;
};
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,96 @@
#pragma once
/*
* 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.
*/
#include <string>
#include <vector>
#include <map>
#include <limits>
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/FIX/Tag.h>
#include <OnixS/FIXEngine/FIX/ProtocolVersion.h>
#include <OnixS/FIXEngine/FIX/SbeCustomization.h>
namespace OnixS {
namespace FIX {
ONIXS_FIXENGINE_API_DECL(class, Message);
ONIXS_FIXENGINE_API_DECL(class, Dictionary);
namespace SBE {
ONIXS_FIXENGINE_API_DECL(class, IDecodeListener);
/// Performs the SBE to FIX decoding.
class ONIXS_FIXENGINE_API EventBasedDecoder
{
public:
/// Creates the SBE to FIX Decoder.
///
/// @param xmlTemplates XML-based SBE templates.
/// @param customCoders The custom coders library.
EventBasedDecoder(const std::string & xmlTemplates, ISbeCustomCoderLibrary* customCoders = ONIXS_FIXENGINE_NULLPTR);
/// Destructor.
~EventBasedDecoder();
/// Tries to decode the given FAST stream buffer into the corresponding FIX Message.
///
/// @param[in] templateId The identifier of the SBE template, used to decode the input data.
/// @param[in] version The version of the SBE schema, used to decode the input data.
/// @param[in] rootBlockLength The length of the root block. This value should be extracted from the message preamble, or from other source.
/// @param[in] buffer The FAST stream chunk to be decoded.
/// @param[in] offset The index in the buffer at which decoding begins.
/// @param[in] count The number of bytes to analyze during the decoding.
/// @param[in] listener The listener which receives decoding events.
/// @param[out] numberOfDecodedBytes The number of bytes that contained the encoded FIX Message.
///
/// @warning The message should point to an existing object. This object is not owned by the Decoder and should be managed by the user.
///
/// @throw An exception if the decoding error is detected.
///
/// @return 'true' if the given bytes could be decoded into a FIX message, otherwise - 'false'.
bool decodeSingleMessage(int version, int templateId, size_t rootBlockLength,
const unsigned char * buffer, size_t offset, size_t count, IDecodeListener * listener,
size_t * numberOfDecodedBytes) const;
/// The maximum known version of the SBE schema.
unsigned schemaVersion() const;
/// The schema identifier.
unsigned schemaId() const;
/// The semantic version of the SBE schema.
std::string schemaSemanticVersion() const;
/// The name of the encoding type of the message header, which is
/// the same for all messages in a schema.
std::string schemaHeaderType() const;
private:
friend ONIXS_FIXENGINE_API_DECL(class, OnixS::FIX::Dictionary);
EventBasedDecoder(const EventBasedDecoder &);
EventBasedDecoder & operator = (const EventBasedDecoder &);
struct Impl;
Impl * impl_;
};
}
}
}
@@ -0,0 +1,244 @@
/*
* 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 <string>
#include <vector>
#include <OnixS/FIXEngine/FIX/Session.h>
namespace OnixS {
namespace FIX {
namespace Scheduling {
/// The counterparty host name.
typedef std::string Host;
/// The counterparty socket port.
typedef unsigned Port;
/// The collection of parameters required to establish
/// a connection with a counterparty (session-acceptor).
class ONIXS_FIXENGINE_API Counterparty
{
public:
/// Initializes the blank instance.
Counterparty();
/// Identifies a counterparty.
Counterparty(const Host & host, Port port);
/// Initializes as a clone of another instance.
Counterparty(const Counterparty & other);
/// Cleans everything up.
~Counterparty();
/// Defines the remote host to which the session must connect to.
const Host & host() const;
/// Defines the port number to which the session must connect to.
Port port() const;
/// Reinitializes an instance from another one.
Counterparty & operator = (const Counterparty & other);
private:
Host * host_;
Port port_;
};
/// The ordered series of counterparties.
typedef std::vector<Counterparty> Counterparties;
/// The collection of connection-related attributes for the session.
class ONIXS_FIXENGINE_API SessionConnectionSettings
{
public:
/// Initializes an instance from another one.
SessionConnectionSettings(
const SessionConnectionSettings & other);
/// Cleans an instance up.
virtual ~SessionConnectionSettings();
/// Specifies whether the session must be
/// connected as an acceptor or initiator.
SessionRole::Enum role() const;
/// If the session must be logged on in the role of an initiator,
/// defines the value for the heartbeat interval in seconds.
/// Otherwise it has an undefined value.
unsigned heartBeatInterval() const;
/// If the session must be logged on in the role of an initiator,
/// defines whether the 'SetResetSequenceNumbers' flag must be
/// sent within the logon message. Otherwise it has an undefined value.
bool setResetSequenceNumbers() const;
/// If the session must be logged on in the role of an initiator,
/// defines the custom logon message which must be sent at
/// the logon. Otherwise it returns the NULL value.
Message * logonMessage() const;
/// The list of all counterparties.
/// It is not used if the session must be logged on as an acceptor.
const Counterparties & counterparties() const;
/// Copies all settings from another instance.
SessionConnectionSettings &
operator = (const SessionConnectionSettings & other);
protected:
/// Initializes an instance with the given session role.
SessionConnectionSettings(SessionRole::Enum role);
/// Updates the heartbeat interval value.
void heartBeatInterval(unsigned interval);
/// Updates the session reset sequence numbers policy.
void setResetSequenceNumbers(bool resetSeqNumbers);
/// Assigns the custom logon message.
void logonMessage(const Message & message);
/// The editable collection of counterparties.
Counterparties & counterparties();
private:
SessionRole::Enum role_;
unsigned heartBeatInterval_;
bool resetSeqNumbers_;
Message * logonMessage_;
Counterparties * counterparties_;
};
inline
SessionRole::Enum
SessionConnectionSettings::role() const
{
return role_;
}
inline
unsigned
SessionConnectionSettings::heartBeatInterval() const
{
return heartBeatInterval_;
}
inline
bool
SessionConnectionSettings::setResetSequenceNumbers() const
{
return resetSeqNumbers_;
}
inline
Message *
SessionConnectionSettings::logonMessage() const
{
return logonMessage_;
}
inline
const Counterparties &
SessionConnectionSettings::counterparties() const
{
return *counterparties_;
}
/// Session connection settings for session-acceptors.
class
ONIXS_FIXENGINE_API
AcceptorConnectionSettings
: public SessionConnectionSettings
{
public:
/// Initializes settings for sessions-acceptors.
AcceptorConnectionSettings();
};
/// Session connection settings for session-initiators.
class
ONIXS_FIXENGINE_API
InitiatorConnectionSettings
: public SessionConnectionSettings
{
public:
/// Initializes an instance with session-initiator related attributes.
/// @param host Defines the remote host to which the session must connect to.
/// @param port Defines the port number to which the session must connect to.
InitiatorConnectionSettings(
const Host & host, Port port);
/// Initializes an instance with session-initiator related attributes.
/// @param host Defines the remote host to which the session must connect to.
/// @param port Defines the port number to which the session must connect to.
/// @param resetSessionSequenceNumbers Defines whether
/// the 'SetResetSequenceNumbers' flag must be sent within the logon message.
InitiatorConnectionSettings(
const Host & host, Port port,
bool resetSessionSequenceNumbers);
/// Initializes an instance with session-initiator related attributes.
/// @param host Defines the remote host to which the session must connect to.
/// @param port Defines the port number to which the session must connect to.
/// @param heartbeatInterval Defines the time interval between heartbeats
/// messages.
InitiatorConnectionSettings(
const Host & host, Port port,
unsigned heartbeatInterval);
/// Initializes an instance with session-initiator related attributes.
/// @param host Defines the remote host to which the session must connect to.
/// @param port Defines the port number to which the session must connect to.
/// @param customLogonMessage Defines the custom logon message which should
/// be used at the logon.
InitiatorConnectionSettings(
const Host & host, Port port,
const Message & customLogonMessage);
/// Initializes an instance with session-initiator related attributes.
/// @param host Defines the remote host to which the session must connect to.
/// @param port Defines the port number to which the session must connect to.
/// @param heartbeatInterval Defines the time interval between heartbeats
/// @param resetSessionSequenceNumbers Defines whether
/// the 'SetResetSequenceNumbers' flag must be sent within the logon message.
/// @param customLogonMessage Optionally defines the custom logon message
/// which should be used at the logon.
InitiatorConnectionSettings(
const Host & host,
Port port,
unsigned heartbeatInterval,
bool resetSessionSequenceNumbers,
const Message * customLogonMessage = ONIXS_FIXENGINE_NULLPTR);
/// Adds one more counterparty for the list of counterparties session should try to connect to.
void addCounterparty(const Host & host, Port port);
};
}
}
}
@@ -0,0 +1,343 @@
/*
* 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 <string>
#include <vector>
#include <OnixS/FIXEngine/ABI.h>
#if !defined (MINMAX_ABUSER)
#define UNDEF_MINMAX_ABUSER
#define MINMAX_ABUSER
#endif
namespace OnixS {
namespace FIX {
namespace Scheduling {
/// Specifies an activity time frame for the session.
struct
ONIXS_FIXENGINE_API
SessionDuration {
enum Enum {
/// The session continues not more than 24 hours.
/// That is the session logon and logout are
/// performed within bounds of the single day.
Day,
/// The session logon/logout occurs only once per week.
Week
};
/// Transforms the string presentation into a valid constant.
static Enum parse(const std::string & value);
/// Builds the string presentation for a given constant.
static std::string toString(Enum value);
};
/// Defines the session sequence number reset policy.
struct
ONIXS_FIXENGINE_API
SequenceNumberResetPolicy {
enum Enum {
/// The session sequence number must never
/// be reset by scheduling services.
Never,
/// The session sequence number reset
/// is performed on daily basis.
Daily,
/// The session sequence number reset
/// is performed once per week.
Weekly
};
/// Transforms the string presentation into a valid constant.
static Enum parse(const std::string & value);
/// Builds the string presentation for a given constant.
static std::string toString(Enum value);
};
/// Specifies a day of the week.
struct
ONIXS_FIXENGINE_API
DayOfWeek {
enum Enum {
Sunday,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Total
};
/// Transforms the string presentation into a valid constant.
static Enum parse(const std::string & value);
/// Builds the string presentation for a given constant.
static std::string toString(Enum value);
};
// The alias of the number of hours.
typedef int Hours;
// The alias of the number of minutes.
typedef int Minutes;
// The alias of the number of seconds.
typedef int Seconds;
/// Represents the time of the day.
class ONIXS_FIXENGINE_API TimeOfDay
{
public:
/// The default initialization.
TimeOfDay();
/// Initializes an instance to a specified
/// number of hours, minutes, and seconds.
TimeOfDay(
Hours hours,
Minutes minutes,
Seconds = 0);
/// Initializes from another instance.
TimeOfDay(const TimeOfDay &);
/// Gets hours of the time of the day.
Hours hours() const;
/// Gets minutes of the time of the day.
Minutes minutes() const;
/// Gets the seconds component of the time of the day.
Seconds seconds() const;
/// Gets the total number of seconds since the midnight.
Seconds sinceMidnight() const;
/// Builds the string presentation.
std::string toString() const;
/// Checks whether the instance is equal to another one.
bool operator == (const TimeOfDay & other) const;
/// Checks whether the instance is unequal to another one.
bool operator != (const TimeOfDay & other) const;
// Reinitializes the instance from another one.
TimeOfDay & operator = (const TimeOfDay &);
/// Returns the current time of the day value.
static TimeOfDay now();
/// The 'Zero' point of the time of the day.
static TimeOfDay midnight();
/// An instance of the ill-formed time of the day.
static TimeOfDay bad();
/// Parses the time of day from its string presentation.
static TimeOfDay parse(const std::string &);
private:
Seconds seconds_;
TimeOfDay(Seconds);
};
inline
Seconds
TimeOfDay::sinceMidnight() const
{
return seconds_;
}
inline
bool
TimeOfDay::operator == (
const TimeOfDay & other) const
{
return seconds_ == other.seconds_;
}
inline
bool
TimeOfDay::operator != (
const TimeOfDay & other) const
{
return seconds_ != other.seconds_;
}
/// The collection of the time of day values indexed by the day of the week.
typedef TimeOfDay TimeOfDayOfWeek[DayOfWeek::Total];
/// Defines activity time frames for the session.
/// Also provides the ability to define the sequence number
/// reset policy for the session.
class ONIXS_FIXENGINE_API SessionSchedule
{
public:
/// Initializes the session schedule according to the given parameters.
///
/// If the session duration is a single day, then logon and logout
/// are performed each day from the first day of the week till the last
/// day of the week. If the session duration is defined as the entire week
/// then the session logon occurs on the first day of the week and
/// the corresponding logout is performed on the last day of the week.
///
/// The session sequence number reset policy must correspond to
/// the session duration time. In particular, if the session continues
/// for an entire week it's not possible to request the scheduler to reset
/// the session sequence number on daily basis.
///
/// @param firstDay Defines the first day of an activity week for the session.
///
/// @param lastDay Defines the last day of an activity week for the session.
///
/// @param logonTime Defines the time of the logon for the session for each
/// activity day if the session duration is a single day. If the session must
/// continue for an entire week, defines the time of the logon performed on
/// the first day of an activity week.
///
/// @param logoutTime Defines the time of the logout for the session for each
/// activity day if the session duration is a single day. If the session must
/// continue for an entire week, defines the time of the logout performed on the
/// last day of an activity week.
///
/// @param sessionDuration Defines whether the session continues
/// for an entire week or the activity time frame is limited for a single day.
///
/// @param seqNumberResetPolicy Defines the session sequence number reset policy.
SessionSchedule(
DayOfWeek::Enum firstDay,
DayOfWeek::Enum lastDay,
TimeOfDay logonTime,
TimeOfDay logoutTime,
SessionDuration::Enum sessionDuration,
SequenceNumberResetPolicy::Enum seqNumberResetPolicy);
/// Initializes a clone of the given instance.
SessionSchedule(const SessionSchedule & other);
/// The logon time for the session for the given day.
///
/// If the logon is not performed on the given day, it returns
/// the corresponding value equals to the TimeOfDay::bad() value.
TimeOfDay logonTime(DayOfWeek::Enum day) const;
/// Defines the logon time for the session for the given day.
void logonTime(DayOfWeek::Enum day, TimeOfDay time);
/// The logout time for the session for the given day.
///
/// If the logout is not performed on the given day, it returns
/// the corresponding value equals to the TimeOfDay::bad() value.
TimeOfDay logoutTime(DayOfWeek::Enum day) const;
/// Defines logout time for the session for given day.
void logoutTime(DayOfWeek::Enum day, TimeOfDay time);
/// Defines whether the session continues the entire week
/// or an activity time frame is limited for the single day.
SessionDuration::Enum sessionDuration() const;
/// Defines the session sequence number reset policy.
SequenceNumberResetPolicy::Enum sequenceNumberResetPolicy() const;
/// The day of the week on which the session message sequence numbers are reset.
DayOfWeek::Enum sequenceNumberWeeklyResetDay() const;
/// Reinitializes the instance from another one.
SessionSchedule & operator = (const SessionSchedule & other);
std::string toString() const;
private:
friend class SessionStateChanger;
TimeOfDayOfWeek logonTimes_;
TimeOfDayOfWeek logoutTimes_;
SessionDuration::Enum sessionDuration_;
SequenceNumberResetPolicy::Enum seqNumberResetPolicy_;
DayOfWeek::Enum startOfWeek_;
DayOfWeek::Enum endOfWeek_;
};
inline
TimeOfDay
SessionSchedule::logonTime(DayOfWeek::Enum day) const
{
return logonTimes_[day];
}
inline
void
SessionSchedule::logonTime(
DayOfWeek::Enum day, TimeOfDay logonTime)
{
logonTimes_[day] = logonTime;
}
inline
TimeOfDay
SessionSchedule::logoutTime(DayOfWeek::Enum day) const
{
return logoutTimes_[day];
}
inline
void
SessionSchedule::logoutTime(
DayOfWeek::Enum day, TimeOfDay logoutTime)
{
logoutTimes_[day] = logoutTime;
}
inline
SessionDuration::Enum
SessionSchedule::sessionDuration() const
{
return sessionDuration_;
}
inline
SequenceNumberResetPolicy::Enum
SessionSchedule::sequenceNumberResetPolicy() const
{
return seqNumberResetPolicy_;
}
inline
DayOfWeek::Enum
SessionSchedule::sequenceNumberWeeklyResetDay() const
{
return startOfWeek_;
}
}
}
}
@@ -0,0 +1,284 @@
/*
* 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 <string>
#include <set>
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Threading/Thread.h>
namespace OnixS {
namespace FIX {
ONIXS_FIXENGINE_API_DECL(class, Session);
namespace Scheduling {
ONIXS_FIXENGINE_API_DECL(class, SessionScheduler);
ONIXS_FIXENGINE_API_DECL(class, SessionSchedule);
ONIXS_FIXENGINE_API_DECL(class, SessionConnectionSettings);
ONIXS_FIXENGINE_API_DECL(class, Counterparty);
typedef std::string SessionScheduleId;
typedef std::string SessionConnectionSettingsId;
/// SessionScheduler events notifications.
class
ONIXS_FIXENGINE_API
SessionSchedulerListener
{
public:
/// Notifies if the FIX session is about to be closed.
/// @param scheduler Identifies an instance of the session
/// scheduler which is about to close the scheduled session.
/// @param session Identifies the session which is about to be closed.
/// @param allowLogout Defines whether the session
/// scheduler must perform the logout. To prohibit
/// the session logout it's necessary to set it to 'false'.
virtual
void
onLoggingOut(
const SessionScheduler & scheduler,
Session * session,
bool * allowLogout) = 0;
/// Allows scheduler's users to be notified when an initiator will try
/// to connect to the next counterparty.
/// The parameter `Counterparty` provides a counterparty,
/// to which the session will connect.
virtual
void
onInitiatorConnecting(
const SessionScheduler &,
Session *,
const Counterparty &) {}
/// Notifies about a non-critical issue occurred
/// while maintaining the state for the given session.
virtual
void
onWarning(
const SessionScheduler & scheduler,
Session * session,
const std::string & warningReason) = 0;
/// Notifies about an error occurred while
/// maintaining the state for the given session.
virtual
void
onError(
const SessionScheduler & scheduler,
Session * session,
const std::string & errorReason) = 0;
protected:
/// The class is not used for the object life time managing.
/// Therefore, destructor is in the protected area.
virtual ~SessionSchedulerListener() ONIXS_FIXENGINE_DEFAULT;
};
/// The way in which the Scheduler will utilize threads.
struct SchedulerThreadingModel
{
enum Enum
{
/// Scheduler will use its own threads.
DedicatedThreads,
/// Scheduler events are handled by rolling an event loop in a user thread.
ExternalThread
};
/// Returns the textual representation of the SchedulerThreadingModel::Enum value.
ONIXS_FIXENGINE_API static const char * toString(SchedulerThreadingModel::Enum value);
};
/// The collection of miscellaneous parameters
/// which affect the session scheduler behavior.
class
ONIXS_FIXENGINE_API
SessionSchedulerOptions
{
public:
/// Initializes parameters with default values.
SessionSchedulerOptions();
/// Cleans everything up.
~SessionSchedulerOptions();
/// The path to the scheduler configuration file.
const std::string & configurationFile() const;
/// Updates the path to the scheduler configuration file.
void configurationFile(const std::string & file);
/// An instance of the event listener to notify about events.
SessionSchedulerListener * eventListener() const;
/// Associates the given event listener with the scheduler.
void eventListener(SessionSchedulerListener * listener);
/// The threading model.
SchedulerThreadingModel::Enum threadingModel() const;
/// Updates the threading model.
void threadingModel(SchedulerThreadingModel::Enum threadingModel);
private:
std::string * configurationFile_;
SessionSchedulerListener * eventListener_;
SchedulerThreadingModel::Enum threadingModel_;
};
/// The scheduler performs the session connection maintenance according
/// to the specified schedule for session activities. It monitors
/// whenever criteria to log a particular session, either on or off,
/// is triggered and automatically executes an appropriate action.
class ONIXS_FIXENGINE_API SessionScheduler
{
public:
/// Initializes the Scheduler instance according to the options
/// specified in the given configuration file.
///
/// If specified, the Scheduler extracts from the configuration a set
/// of predefined session schedules and connection settings later
/// available through Schedules and ConnectionSettings properties.
SessionScheduler(
const SessionSchedulerOptions & options);
/// Performs the graceful shutdown of scheduling services.
~SessionScheduler();
/// Looks for the predefined session schedule
/// associated with the given unique names (ids) as it
/// was specified in the Scheduler's configuration file.
/// @return NULL if no a schedule available under the given id.
const
SessionSchedule *
findSchedule(const SessionScheduleId & id) const;
/// Looks for the predefined session connection settings
/// associated with the given unique names (ids) as it was
/// specified in the Scheduler's configuration file.
/// @return NULL if no settings available under the given id.
const
SessionConnectionSettings *
findConnectionSettings(
const SessionConnectionSettingsId & id) const;
/// Adds the session to the automatic connection management.
///
/// If the session is added during an active time frame,
/// it will be connected immediately. If the session is
/// registered during an inactive time frame and has an active state,
/// it will be disconnected. If the session is already registered,
/// an exception will be thrown.
///
/// @param session An instance of the session to be maintained.
/// @param schedule The schedule which defines the session connection
/// time, periodicity as well as other attributes.
/// @param connection Settings for the given session to
/// be used when the session must be connected.
void
add(
Session * session,
const SessionSchedule & schedule,
const SessionConnectionSettings & connection);
/// Adds the session to the automatic connection management.
///
/// If the session is added during an active time frame,
/// it will be connected immediately. If the session is
/// registered during an inactive time frame and has an active state,
/// it will be disconnected. If the session is already registered,
/// an exception will be thrown.
///
/// @param session An instance of the session to be maintained.
/// @param scheduleId The id of the predefined schedule
/// to use for the given session.
/// @param connectionId The id of the predefined connection
/// settings to use for the given session.
void
add(
Session * session,
const SessionScheduleId & scheduleId,
const SessionConnectionSettingsId & connectionId);
/// Removes the session from the automatic connection management services.
/// If the session were not registered before, it does actually nothing.
void remove(Session * session);
/// Processes events on the Scheduler and performs the necessary session management.
///
/// This method should be called periodically and only when the ExternalThread threading model is used.
/// This method is not thread-safe.
void dispatchEvents();
/**
* Sets the CPU affinity of the Scheduler service thread.
*/
void serviceThreadAffinity(const OnixS::Threading::CpuIndexes & cpuIndexes);
/**
* Returns the CPU affinity of the Scheduler service thread.
*/
const OnixS::Threading::CpuIndexes & serviceThreadAffinity() const;
/**
* Sets the number of logon attempts in case of a logon failure.
*/
void reconnectAttempts(int value);
/**
* Returns the number of logon attempts in case of a logon failure.
* By default, the option value is equal to 3.
*/
int reconnectAttempts() const;
/**
* Sets the time interval between logon attempts in case of a logon failure. (in seconds).
*/
void reconnectInterval(int value);
/**
* Returns the time interval between logon attempts in case of a logon failure. (in seconds).
* By default, the option value is equal to 180 seconds.
*/
int reconnectInterval() const;
/**
* This property allows switching the local time to the UTC time usage.
*/
void utcTimeUsage(bool value);
/**
* Returns true if the UTC time is used otherwise false.
* By default, the option value is false.
*/
bool utcTimeUsage() const;
private:
class Impl;
Impl * impl_;
};
}
}
}
@@ -0,0 +1,29 @@
/*
* 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/FIXEngine/ABI.h>
namespace OnixS {
namespace FIX {
/// Alias for the sequence number.
typedef unsigned int SequenceNumber;
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,40 @@
/*
* 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/FIXEngine/ABI.h>
namespace OnixS {
namespace FIX {
/// The session role.
struct SessionRole {
enum Enum {
/// Undefined.
Undefined,
/// The Initiator.
Initiator,
/// The Acceptor.
Acceptor
};
};
}
}
@@ -0,0 +1,34 @@
/*
* 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/FIXEngine/ABI.h>
namespace OnixS {
namespace FIX {
/// The session send mode.
struct SessionSendMode {
enum Enum {
/// The Zero-Copy send mode.
OnloadZeroCopy
};
};
}
}
@@ -0,0 +1,49 @@
/*
* 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/FIXEngine/ABI.h>
namespace OnixS {
namespace FIX {
/// The session state.
struct SessionState {
enum Enum {
/// The session is disconnected.
Disconnected,
/// The login operation is in progress.
LoginInProgress,
/// The logout operation is in progress.
LogoutInProgress,
/// The session is active (connected).
Active,
/// The session being reconnected.
Reconnecting
};
/// Returns the session state as a string.
static ONIXS_FIXENGINE_API const char * toString(Enum state);
};
}
}
@@ -0,0 +1,54 @@
/*
* 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 <string>
#include <OnixS/FIXEngine/ABI.h>
namespace OnixS {
namespace FIX {
/// The session Storage type.
struct SessionStorageType {
enum Enum {
/// The storage type is undefined.
Undefined,
/// The file based storage. The session's state and messages are persisted to the file system.
FileBased,
/// The asynchronous file based storage. The session's state and messages are persisted to the file system asynchronous in the separated thread.
AsyncFileBased,
/// The memory based storage. The session's state and messages are NOT persisted.
MemoryBased,
/// The custom session storage.
Pluggable
};
/// Returns the string representation of the given Session Storage type.
ONIXS_FIXENGINE_API
static
const char *
toString(SessionStorageType::Enum value);
};
}
}
@@ -0,0 +1,336 @@
#pragma once
/*
* 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.
*/
#include <cstring>
#include <functional>
#include <ostream>
#include <string>
#include <OnixS/FIXEngine/Compiler.h>
#include <OnixS/FIXEngine/FIX/Numeric.h>
#ifdef ONIXS_FIXENGINE_CXX17
#include <string_view>
#endif
namespace OnixS {
namespace FIX {
#ifdef ONIXS_FIXENGINE_CXX17
using StringRef = std::basic_string_view<Char>;
#else
/// Provides an efficient way of accessing text-based FIX field values.
///
/// By default, OnixS::FIX::Message and OnixS::FIX::GroupInstance classes
/// convert all values assigned to the fields into their text presentations
/// and store textual data. This approach optimizes message reuse when the same
/// message instance is used to update a few fields and is sent over the FIX
/// session multiple times. Also, when a message comes from the network and is
/// deserialized from its raw (tag=value) presentation, all field values
/// represent text segments. To access textual values, the StringRef class
/// was added together with new access members (FieldSet::getStringRef()).
/// If value is accessed using FieldSet::getStringRef() member, instance of
/// StringRef class is returned. That instance holds a reference to a read-only
/// segment of text. An important aspect is that no memory is allocated and
/// copied while accessing field values that way.
class
ONIXS_FIXENGINE_API
StringRef
{
public:
/// An immutable iterator over chars.
typedef const char * ConstIterator;
/// Initializes the blank instance.
StringRef()
: chars_(ONIXS_FIXENGINE_NULLPTR),
size_(0) {
}
/// The full initialization.
ONIXS_FIXENGINE_CONSTEXPR
StringRef(
const char * chars,
size_t size)
: chars_(chars),
size_(size) {
}
/// Initializes an instance from the string content.
explicit StringRef(
const std::string & stdStr)
: chars_(stdStr.c_str()),
size_(stdStr.size()) {
}
/// Initializes an instance from the zero-terminated string.
StringRef(const char * cStr)
: chars_(cStr),
size_(cStr ? strlen(cStr) : 0) {
}
/// Indicates whether the array has zero length.
bool empty() const {
return (0 == size_);
}
/// Returns the read-only content.
const char * data() const {
return chars_;
}
/// The STL-like begin().
ConstIterator begin() const {
return chars_;
}
/// The STL-like end().
ConstIterator end() const {
return chars_ + size_;
}
/// The number of chars.
size_t size() const {
return size_;
}
/// The number of chars.
size_t length() const {
return size_;
}
/// Resets the reference to nothing.
void reset() {
reset(ONIXS_FIXENGINE_NULLPTR, 0);
}
/// Updates data being referenced.
void
reset(
const char * chars,
size_t size) {
chars_ = chars;
size_ = size;
}
const char &
operator [](size_t index) const {
return chars_[index];
}
const char &
at(size_t index) const {
if(index < size_)
return chars_[index];
throw std::invalid_argument("index");
}
/// Returns the number if the text is a string
/// representation of an integer.
template
<
typename NumericType
>
bool
toNumber(NumericType & number) const {
return OnixS::FIX::Number::
tryParse(chars_, size_, number);
}
// Appends a copy of the text to the std::string.
void
toString(std::string & str) const {
str.append(chars_, size_);
}
// Returns a copy of the text as the std::string.
std::string
toString() const {
return std::string(chars_, size_);
}
/// Compares with another instance.
bool
operator == (
const StringRef & other) const {
return (
size_ == other.size_
&&
0 == std::memcmp(
chars_, other.chars_, size_));
}
/// Compares with another instance.
bool
operator != (
const StringRef & other) const {
return (
size_ != other.size_
||
0 != std::memcmp(
chars_, other.chars_, size_));
}
/// Swaps the content with another instance.
void
swap(StringRef & other) {
std::swap(chars_, other.chars_);
std::swap(size_, other.size_);
}
friend std::ostream & operator<< (std::ostream & out, const StringRef & ref);
private:
/// Items being referenced.
const char * chars_;
/// The number of chars being referenced.
size_t size_;
};
inline
bool
operator == (
const StringRef & ref,
const std::string & str)
{
return ref == StringRef(str);
}
inline
bool
operator != (
const StringRef & ref,
const std::string & str)
{
return ref != StringRef(str);
}
inline
bool
operator == (
const std::string & str,
const StringRef & ref)
{
return ref == StringRef(str);
}
inline
bool
operator != (
const std::string & str,
const StringRef & ref)
{
return ref != StringRef(str);
}
//
inline
bool
operator == (
const StringRef & ref,
const char * str)
{
return ref == StringRef(str);
}
inline
bool
operator != (
const StringRef & ref,
const char * str)
{
return ref != StringRef(str);
}
inline
bool
operator == (
const char * str,
const StringRef & ref)
{
return ref == StringRef(str);
}
inline
bool
operator != (
const char * str,
const StringRef & ref)
{
return ref != StringRef(str);
}
inline std::ostream & operator<< (std::ostream & out, const StringRef & ref)
{
if(! ref.empty())
out.write(ref.chars_, ref.size_);
return out;
}
#endif
template <size_t Size>
ONIXS_FIXENGINE_NODISCARD
inline
ONIXS_FIXENGINE_CONSTEXPR
StringRef constructStrRef(const char (&value)[Size]) ONIXS_FIXENGINE_NOTHROW
{
return StringRef(value, Size - 1);
}
}
}
namespace std {
/// Allows the use of the StringRef in collections like std::map.
template<>
struct
ONIXS_FIXENGINE_API
less<OnixS::FIX::StringRef> {
bool
operator()(
const OnixS::FIX::StringRef & left,
const OnixS::FIX::StringRef & right) const {
ptrdiff_t
compareResult = std::memcmp(
left.data(), right.data(),
left.size() < right.size()
? left.size() : right.size());
if(0 == compareResult) {
compareResult =
static_cast<ptrdiff_t>(
left.size() - right.size());
}
return (0 > compareResult);
}
};
}
+37
View File
@@ -0,0 +1,37 @@
/*
* 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/FIXEngine/Compiler.h>
#include <OnixS/FIXEngine/FIX/Numeric.h>
namespace OnixS {
namespace FIX {
/// Alias for tag numbers.
typedef unsigned Tag;
/// Tag traits.
struct TagTraits {
/// Represents the value which is not used in the real-time
/// thus can be used to identify the non-existent field.
static ONIXS_FIXENGINE_CONST_OR_CONSTEXPR Tag Zero = 0;
};
}
}
@@ -0,0 +1,114 @@
/*
* 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/FIXEngine/ABI.h>
#include <string>
#include <stdint.h>
namespace OnixS {
namespace FIX {
namespace TCPDirect {
/**
* TCPDirect attributes to pass configuration details (a wrapper around the zf_Attributes struct).
*
* The default values for attributes may be overridden by setting the
* environment variable ZF_Attributes. For example:
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.sh}
* ZF_Attributes="interface=enp4s0f0;log_level=3;reactor_spin_count=1"
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
class ONIXS_FIXENGINE_API Attributes
{
public:
/** Allocate an attribute object.
*
* \throws The std::bad_alloc is thrown if the memory could not be allocated.
* \throws The std::runtime_error if the ZF_Attributes environment variable is malformed.
*/
Attributes();
~Attributes();
Attributes(const Attributes& other);
Attributes& operator=(const Attributes& other);
/// Sets the network interface name.
void networkInterface(const std::string& ifName)
{
set("interface", ifName);
}
/**
* Gets the attribute value.
*
* \param name The name of the attribute.
*
* \throws The std::logic_error is thrown if the @p name is not a valid attribute name
* or if the @p name does not have a string type.
*/
std::string getString(const std::string& name);
/**
* Sets an attribute to a string value.
*
* \param name The name of the attribute.
* \param value The new value for the attribute.
*
* \throws The std::logic_error is thrown if the @p name is not a valid attribute name
* or if the attribute is not a string attribute.
*/
void set(const std::string& name, const std::string& value);
/**
* Gets the attribute value.
*
* \param name The name of the attribute.
*
* \throws The std::logic_error is thrown if the @p name is not a valid attribute name
* or if the @p name does not have an integer type.
*/
int64_t getInt(const std::string& name);
/**
* Sets an attribute to an integer value.
*
* \param name The name of the attribute.
* \param value The new value for the attribute.
*
* \throws The std::logic_error is thrown if the @p name is not a valid attribute name.
* \throws The std::domain_error is thrown if the @p value is not within the range of values this
* attribute can take.
*/
void set(const std::string& name, uint64_t value);
private:
class Impl;
Impl* const impl_;
friend class Stack;
};
}
}
}
@@ -0,0 +1,127 @@
/*
* 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/FIXEngine/FIX/ISessionReactor.h>
#include <OnixS/FIXEngine/FIX/TcpDirectAttr.h>
#include <OnixS/FIXEngine/Threading/Thread.h>
#include <cassert>
namespace OnixS {
namespace FIX {
class ReactorOperator;
namespace TCPDirect {
/**
* A high-level wrapper over the TCPDirect stack.
*/
class ONIXS_FIXENGINE_API Stack : public ISessionReactor
{
public:
/** Allocates a stack with the supplied attributes.
*
* \param attr A set of properties to apply to the stack.
*
* A stack binds to a single network interface, specified by the `interface` attribute in @p attr. *
*
* Relevant attributes to set in @p attr are those in the `zf_stack`,
* `zf_pool` and `zf_vi` categories described in the attributes documentation.
*
* \throws The std::bad_alloc is thrown in case of out of memory. N.B. Huge pages are required.
* \throws The std::runtime_error is thrown if the TCPDirect library reported an error.
* \throws The std::exception is thrown if a system call reported an error.
*/
explicit Stack(const Attributes & attr);
#ifdef ONIXS_FIXENGINE_CXX11
Stack(const Stack &) = delete;
Stack(Stack &&) = delete;
Stack & operator=(const Stack &) = delete;
Stack & operator=(Stack &&) = delete;
#endif
~Stack();
/**
* Processes events on a stack and performs the necessary handling.
*
* These events include transmit and receive events raised by the hardware,
* and also software events such as TCP and FIX protocol timers.
*
* Please see the "Stack polling" section in the TCPDirect User Guide for further information.
*
* \warning The event dispatching should be performed from the same thread that created the stack.
*/
void dispatchEvents() ONIXS_FIXENGINE_OVERRIDE {
// The TCPDirect middleware is NOT thread-safe.
// Therefore, the event dispatching should be performed from the same thread that created the stack.
assert(threadId() == Threading::ThisThread::id() && "should be performed from the same thread that created the stack");
dispatchEventsImpl();
}
/**
* \return a boolean value indicating whether a stack is quiescent.
*
* This can be used to ensure that all connections have been closed gracefully before the destroying of a stack
* (or exiting the application). The destroying of a stack while it is not quiescent is permitted by the API,
* but when doing so there is no guarantee that sent data has been acknowledged by the peer or even transmitted,
* and there is the possibility that peers' connections will be reset.
*/
bool isQuiescent() const ONIXS_FIXENGINE_OVERRIDE {
assert(threadId() == Threading::ThisThread::id() && "should be performed from the same thread that created the stack");
return isQuiescentImpl();
}
/**
* Returns the ID of the thread that created the stack.
*
* \return the ID of the thread that created the stack.
*/
Threading::ThreadId threadId() const ONIXS_FIXENGINE_OVERRIDE {
return threadId_;
}
ReactorType::Enum type() const ONIXS_FIXENGINE_OVERRIDE {
return ReactorType::TcpDirect;
}
private:
void dispatchEventsImpl();
bool isQuiescentImpl() const;
class Impl;
Impl * const impl_;
Threading::ThreadId const threadId_;
#ifndef ONIXS_FIXENGINE_CXX11
Stack(const Stack &);
Stack & operator=(const Stack &);
#endif
friend class FIX::ReactorOperator;
};
}}}
@@ -0,0 +1,112 @@
/*
* 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/FIXEngine/FIX/ISessionReactor.h>
#include <OnixS/FIXEngine/Threading/Thread.h>
#include <cassert>
namespace OnixS {
namespace FIX {
class ReactorOperator;
namespace TCPStandard {
/**
* A high-level wrapper over the TCP standard stack.
*/
class ONIXS_FIXENGINE_API Stack : public ISessionReactor
{
public:
/**
* Allocates a TCP stack.
*/
Stack();
#ifdef ONIXS_FIXENGINE_CXX11
Stack(const Stack &) = delete;
Stack(Stack &&) = delete;
Stack & operator=(const Stack &) = delete;
Stack & operator=(Stack &&) = delete;
#endif
~Stack();
/**
* Processes events on a stack and performs the necessary handling.
*
* These events include transmit and receive events raised by the hardware,
* and also software events such as TCP and FIX protocol timers.
*
* \warning The event dispatching should be performed from the same thread that created the stack.
*/
void dispatchEvents() ONIXS_FIXENGINE_OVERRIDE {
// The TCPStandard middleware is NOT thread-safe.
// Therefore, the event dispatching should be performed from the same thread that created the stack.
assert(threadId() == Threading::ThisThread::id() && "should be performed from the same thread that created the stack");
dispatchEventsImpl();
}
/**
* \return a boolean value indicating whether a stack is quiescent.
*
* This can be used to ensure that all connections have been closed gracefully before the destroying of a stack
* (or exiting the application). The destroying of a stack while it is not quiescent is permitted by the API,
* but when doing so there is no guarantee that sent data has been acknowledged by the peer or even transmitted,
* and there is the possibility that peers' connections will be reset.
*/
bool isQuiescent() const ONIXS_FIXENGINE_OVERRIDE {
assert(threadId() == Threading::ThisThread::id() && "should be performed from the same thread that created the stack");
return isQuiescentImpl();
}
/**
* \return the ID of the thread that created the stack.
*/
Threading::ThreadId threadId() const ONIXS_FIXENGINE_OVERRIDE {
return threadId_;
}
ReactorType::Enum type() const ONIXS_FIXENGINE_OVERRIDE {
return ReactorType::TcpStandard;
}
private:
void dispatchEventsImpl();
bool isQuiescentImpl() const;
class Impl;
Impl * const impl_;
Threading::ThreadId const threadId_;
#ifndef ONIXS_FIXENGINE_CXX11
Stack(const Stack &);
Stack & operator=(const Stack &);
#endif
friend class FIX::ReactorOperator;
};
}}}
@@ -0,0 +1,52 @@
/*
* 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 <string>
#include <OnixS/FIXEngine/ABI.h>
namespace OnixS {
namespace FIX {
/// The way in which the Engine will work with sockets.
struct ThreadingModel {
enum Enum {
/// By default, the session will use the mode that was configured for the whole Engine.
Default,
/// The session will use its own sending and receiving threads.
DedicatedThreads = 3,
/// The session will share the thread pool.
ThreadPool = 4,
/// Session events are handled by rolling an event loop in a user thread.
ExternalThread = 5,
};
/// Returns a textual representation of the ThreadingModel::Enum value.
ONIXS_FIXENGINE_API static const char * toString(ThreadingModel::Enum value);
/// Parses the ThreadingModel::Enum value from the textual representation.
ONIXS_FIXENGINE_API static Enum parse(const std::string & fromText);
};
}
} // namespace FIX, OnixS
@@ -0,0 +1,277 @@
/*
* 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 <string>
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/FIX/Numeric.h>
#define ONIXS_MINMAX_ABUSER
namespace OnixS {
namespace FIX {
typedef UInt32 Amount;
typedef UInt64 HugeAmount;
typedef Int32 Interval;
typedef Int64 HugeInterval;
typedef Interval Days;
typedef Interval Hours;
typedef Interval Minutes;
typedef Interval Seconds;
typedef Interval Milliseconds;
typedef Interval Microseconds;
typedef Interval Nanoseconds;
typedef HugeInterval Picoseconds;
typedef HugeInterval TotalSeconds;
typedef HugeInterval TotalMilliseconds;
typedef HugeInterval TotalMicroseconds;
typedef HugeInterval TotalNanoseconds;
typedef HugeInterval TotalPicoseconds;
/// Time related constants.
struct ONIXS_FIXENGINE_API TimeDetails {
static const Hours HoursPerDay;
static const Minutes MinutesPerHour;
static const Seconds SecondsPerMinute;
static const Seconds SecondsPerHour;
static const Seconds SecondsPerDay;
static const Milliseconds MillisecondsPerSecond;
static const Microseconds MicrosecondsPerSecond;
static const Nanoseconds NanosecondsPerSecond;
static const Picoseconds PicosecondsPerNanosecond;
static const Picoseconds PicosecondsPerMicrosecond;
static const Picoseconds PicosecondsPerMillisecond;
static const Picoseconds PicosecondsPerSecond;
};
/// The collection of time span formats supported.
struct ONIXS_FIXENGINE_API TimeSpanFormat {
enum Enum {
/// Indicates the time span in the "HH:MM:SS" format.
HHMMSS,
/// Indicates the time span in the "HH:MM:SS.sss" format.
HHMMSSMsec,
/// Indicates the time span in the "HH:MM:SS.ssssss" format.
HHMMSSUsec,
/// Indicates the time span in the "HH:MM:SS.sssssssss" format.
HHMMSSNsec,
/// Indicates the time span in the "HH:MM:SS.ssssssssssss" format.
HHMMSSPsec
};
};
/// The time span related functionality.
class ONIXS_FIXENGINE_API TimeSpan
{
public:
/// Constructs an uninitialized instance.
TimeSpan();
/// Initializes the TimeSpan from seconds and nanoseconds.
TimeSpan(
TotalSeconds seconds,
Nanoseconds nanoseconds);
/// Initializes the TimeSpan from seconds and picoseconds.
TimeSpan(
TotalSeconds seconds,
Picoseconds picoseconds);
/// Initializes the TimeSpan from hours, minutes and seconds.
TimeSpan(
Hours hours,
Minutes minutes,
Seconds seconds);
/// Initializes the TimeSpan from days, hours, minutes, seconds and nanoseconds.
TimeSpan(
Days days,
Hours hours,
Minutes minutes,
Seconds seconds,
Nanoseconds nanoseconds);
/// Initializes the TimeSpan from days, hours, minutes, seconds and picoseconds.
TimeSpan(
Days days,
Hours hours,
Minutes minutes,
Seconds seconds,
Picoseconds picooseconds);
/// The total number of seconds.
TotalSeconds totalSeconds() const;
/// Current days.
Days days() const;
/// Current hours.
Hours hours() const;
/// Current minutes.
Minutes minutes() const;
/// Current seconds.
Seconds seconds() const;
/// Current milliseconds.
Milliseconds milliseconds() const;
/// Current microseconds.
Microseconds microseconds() const;
/// Current nanoseconds.
Nanoseconds nanoseconds() const;
/// Current nanoseconds.
Picoseconds picoseconds() const;
/// The current absolute time span.
TimeSpan absolute() const;
/// Compares the instance with another one.
bool operator == (const TimeSpan &) const;
/// Compares the instance with another one.
bool operator != (const TimeSpan &) const;
/// Tests whether the instance is less than another one.
bool operator < (const TimeSpan &) const;
/// Increases the instance by another one
TimeSpan & operator += (const TimeSpan &);
/// Decreases the instance by another one
TimeSpan & operator -= (const TimeSpan &);
/// The minimum value of the time span
static TimeSpan min ONIXS_MINMAX_ABUSER();
/// The maximum value of the time span
static TimeSpan max ONIXS_MINMAX_ABUSER();
/// The zero value of the time span
static TimeSpan zero();
/// Returns the time span text presentation in the requested
/// format ("HH:MM:SS.sssssssss" by default).
std::string toString(TimeSpanFormat::Enum = TimeSpanFormat::HHMMSSNsec) const;
void toString(std::string &, TimeSpanFormat::Enum = TimeSpanFormat::HHMMSSNsec) const;
/// Parses time span from its text presentation
static
TimeSpan
parse(const std::string &);
protected:
friend class TimeManager;
TotalSeconds seconds_;
Picoseconds picoseconds_;
void normalize();
};
inline
TotalSeconds
TimeSpan::totalSeconds() const
{
return seconds_;
}
inline
Picoseconds
TimeSpan::picoseconds() const
{
return picoseconds_;
}
class ONIXS_FIXENGINE_API DaySpan : public TimeSpan
{
public:
DaySpan(Days days);
};
/// The hour time span presentation.
class ONIXS_FIXENGINE_API HourSpan : public TimeSpan
{
public:
HourSpan(Hours hours);
};
/// The minute time span presentation.
class ONIXS_FIXENGINE_API MinuteSpan : public TimeSpan
{
public:
MinuteSpan(Minutes minutes);
};
/// The second time span presentation.
class ONIXS_FIXENGINE_API SecondSpan : public TimeSpan
{
public:
SecondSpan(TotalSeconds seconds);
};
/// The millisecond time span presentation.
class ONIXS_FIXENGINE_API MillisecondSpan : public TimeSpan
{
public:
MillisecondSpan(
TotalMilliseconds milliseconds);
};
/// The microsecond time span presentation.
class ONIXS_FIXENGINE_API MicrosecondSpan : public TimeSpan
{
public:
MicrosecondSpan(
TotalMicroseconds microseconds);
};
/// The nanosecond time span presentation.
class ONIXS_FIXENGINE_API NanosecondSpan : public TimeSpan
{
public:
NanosecondSpan(
TotalNanoseconds nanoseconds);
};
/// The picosecond time span presentation.
class ONIXS_FIXENGINE_API PicosecondSpan : public TimeSpan
{
public:
PicosecondSpan(
TotalPicoseconds picoseconds);
};
}
}
@@ -0,0 +1,290 @@
/*
* 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 <string>
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/FIX/TimeSpan.h>
namespace OnixS {
namespace FIX {
typedef Amount Year;
typedef Amount Day;
typedef Amount Hour;
typedef Amount Minute;
typedef Amount Second;
typedef Amount Millisecond;
typedef Amount Microsecond;
typedef Amount Nanosecond;
typedef HugeAmount Picosecond;
/// Defines all the months in the year.
struct ONIXS_FIXENGINE_API Month {
enum Enum {
Undefined,
January,
February,
March,
April,
May,
June,
July,
August,
September,
October,
November,
December
};
};
/// Year, month, day fields.
struct ONIXS_FIXENGINE_API YearMonthDay {
Year year;
Month::Enum month;
Day day;
};
/// The collection of timestamp formats supported.
struct ONIXS_FIXENGINE_API TimestampFormat {
enum Enum {
/// Indicates the timestamp in the "YYYYMMDD" format.
YYYYMMDD,
/// Indicates the timestamp in the "YYYYMMDD-HH:MM:SS" format.
YYYYMMDDHHMMSS,
/// Indicates the timestamp in the "YYYYMMDD-HH:MM:SS.sss" format.
YYYYMMDDHHMMSSMsec,
/// Indicates the timestamp in the "YYYYMMDD-HH:MM:SS.ssssss" format.
YYYYMMDDHHMMSSUsec,
/// Indicates the timestamp in the "YYYYMMDD-HH:MM:SS.sssssssss" format.
YYYYMMDDHHMMSSNsec,
/// Indicates the timestamp in the "YYYYMMDD-HH:MM:SS.ssssssssssss" format.
YYYYMMDDHHMMSSPsec
};
};
/// The timestamps related functionality.
class ONIXS_FIXENGINE_API Timestamp
{
public:
/// Constructs an uninitialized instance.
Timestamp();
/// Initializes from seconds and nanoseconds since Jan 1, 0001, 00:00:00.
Timestamp(
TotalSeconds seconds,
Nanosecond nanosecond);
/// Initializes from seconds and picoseconds since Jan 1, 0001, 00:00:00.
Timestamp(
TotalSeconds seconds,
Picosecond picosecond);
/// Initializes date-time from all details.
Timestamp(
Year year, Month::Enum month, Day day,
Hour hour = 0, Minute minute = 0, Second second = 0,
Nanosecond nanosecond = 0);
/// Initializes date-time from all details.
Timestamp(
Year year, Month::Enum month, Day day,
Hour hour, Minute minute, Second second,
Picosecond picosecond);
/// Initializes from nanoseconds since Jan 1, 1970, 00:00:00 (Unix epoch).
explicit Timestamp(TotalNanoseconds unixTimestampNanoseconds);
/// The current year.
Year year() const;
/// The current month.
Month::Enum month() const;
/// The current day of month.
/// Valid values are 1 through 31.
Day day() const;
/// Returns the date part of the timestamp.
void date(YearMonthDay &) const;
/// The current hour.
/// Valid values are 0 through 23.
Hour hour() const;
/// The current minute.
/// Valid values are 0 through 59.
Minute minute() const;
/// The current second.
/// Valid values are 0 through 59.
Second second() const;
/// The current millisecond.
/// Valid values are 0 through 999.
Millisecond millisecond() const;
/// The current microsecond.
/// Valid values are 0 through 999999.
Microsecond microsecond() const;
/// The current nanosecond.
/// Valid values are 0 through 999999999.
Nanosecond nanosecond() const;
/// The current picosecond.
/// Valid values are 0 through 999999999999.
Picosecond picosecond() const;
/// The total number of seconds since Jan 1, 0001, 00:00:00.
TotalSeconds totalSeconds() const;
/// Compares the instance with another one.
bool operator == (const Timestamp &) const;
/// Compares the instance with another one.
bool operator != (const Timestamp &) const;
/// Tests whether the instance is less than another one.
bool operator < (const Timestamp &) const;
/// Increases the instance by time span
Timestamp & operator += (const TimeSpan &);
/// Decreases the instance by time span
Timestamp & operator -= (const TimeSpan &);
/// Returns the timestamp text presentation in the requested
/// format ("YYYYMMDD-HH:MM:SS.sssssssss" by default).
std::string
toString(
TimestampFormat::Enum =
TimestampFormat::YYYYMMDDHHMMSSNsec) const;
/// Appends the timestamp text presentation in the requested
/// format ("YYYYMMDD-HH:MM:SS.sssssssss" by default).
void
toString(
std::string & str,
TimestampFormat::Enum =
TimestampFormat::YYYYMMDDHHMMSSNsec) const;
/// Returns the nanosecond timestamp since the Unix epoch.
TotalNanoseconds toUnixNanosecondTimestamp() const;
/// Returns the current UTC time.
///
/// @note The timestamp resolution depends on
/// capabilities of an operating system.
static Timestamp utc();
/// Returns the current local time.
///
/// @note The timestamp resolution depends on
/// capabilities of an operating system.
static Timestamp local();
/// Parses the timestamp from its text presentation assuming it's in
/// the specified format ("YYYYMMDD-HH:MM:SS.sssssssss" by default).
static
Timestamp
parse(
const std::string &,
TimestampFormat::Enum =
TimestampFormat::YYYYMMDDHHMMSSNsec);
private:
friend class TimeManager;
TotalSeconds totalSeconds_;
Picosecond picoseconds_;
};
inline
Timestamp::Timestamp(
TotalSeconds totalSeconds, Nanosecond subseconds)
: totalSeconds_(totalSeconds),
picoseconds_(subseconds * static_cast<Picosecond>(TimeDetails::PicosecondsPerNanosecond))
{
}
inline
Timestamp::Timestamp(
TotalSeconds totalSeconds, Picosecond subseconds)
: totalSeconds_(totalSeconds),
picoseconds_(subseconds)
{
}
inline
TotalSeconds
Timestamp::totalSeconds() const
{
return totalSeconds_;
}
inline
Millisecond
Timestamp::millisecond() const
{
return static_cast<Millisecond>(picoseconds_ / TimeDetails::PicosecondsPerMillisecond);
}
inline
Microsecond
Timestamp::microsecond() const
{
return static_cast<Microsecond>(picoseconds_ / TimeDetails::PicosecondsPerMicrosecond);
}
inline
Nanosecond
Timestamp::nanosecond() const
{
return static_cast<Nanosecond>(picoseconds_ / TimeDetails::PicosecondsPerNanosecond);
}
inline
Picosecond
Timestamp::picosecond() const
{
return picoseconds_;
}
inline
std::string
Timestamp::toString(
TimestampFormat::Enum format) const
{
std::string str;
toString(str, format);
return str;
}
}
}
@@ -0,0 +1,91 @@
#pragma once
/*
* 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.
*/
#include <OnixS/FIXEngine/ABI.h>
#include <iosfwd>
#include <string>
namespace OnixS {
namespace FIX {
/// Alias for the numeric component of the version.
typedef unsigned short VersionComponent;
/// Identifies the version of the product.
///
/// Provides an access to single components which compound the whole version,
/// comparing and serialization/deserialization facilities.
class ONIXS_FIXENGINE_API Version
{
public:
/// Initializes instances from all the components.
Version(
VersionComponent majorNumber,
VersionComponent minorNumber,
VersionComponent improvement,
VersionComponent build);
/// The 'major' component of the version.
VersionComponent majorNumber() const;
/// The 'minor' component of the version.
VersionComponent minorNumber() const;
/// The 'improvement' component of the version.
VersionComponent improvement() const;
/// The 'build number' component of the version.
VersionComponent build() const;
/// Compares with other instance for the equality.
bool operator ==(const Version &) const;
/// Compares with other instance for the inequality.
bool operator !=(const Version &) const;
/// Checks whether the version is less then the other.
bool operator <(const Version &) const;
/// Checks whether the version is grater then the other.
bool operator >(const Version &) const;
/// Serializes into the point-separated presentation.
void toString(std::string &) const;
/// Serializes into the point-separated presentation.
std::string toString() const;
/// Extracts the version from the point-separated presentation.
/// Updates the version parameter if the buffer is parsed successfully.
static bool parse(const char *, size_t, Version &);
/// Identifies the current version of the product.
static Version current();
private:
VersionComponent major_;
VersionComponent minor_;
VersionComponent improvement_;
VersionComponent build_;
};
ONIXS_FIXENGINE_API std::ostream & operator<<(std::ostream &, Version const &);
}
}
@@ -0,0 +1,69 @@
#pragma once
/*
* 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.
*/
#if defined (_WIN32) // Windows platform.
#if !defined (STRICT)
#define STRICT
#endif
#include <Windows.h>
#if defined (WIN32_LEAN_AND_MEAN)
#include <winsock2.h>
#endif
#endif
#include <vector>
namespace OnixS {
namespace Sockets {
/// Type alias for byte.
typedef unsigned char Byte;
/// Sequence of bytes.
typedef std::vector<Byte> Bytes;
#if defined (_WIN32)
/// Type alias for socket handle
typedef SOCKET Handle;
#else
/// Type alias for socket handle
typedef int Handle;
#endif
/// Socket option of the SOL_SOCKET level
struct SocketOption {
SocketOption()
: optname(0), optval(), optlen(0) {}
SocketOption(int optionName, void * optionValue, int optionLength)
: optname(optionName), optval(optionValue), optlen(optionLength) {}
int optname;
const void * optval;
int optlen;
};
/// Storage type of socket options
typedef std::vector<SocketOption> SocketOptions;
}
}
@@ -0,0 +1,83 @@
#pragma once
/*
* 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.
*/
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Sockets/Definitions.h>
#include <string>
namespace OnixS {
namespace Sockets {
/// Provides the User Datagram Protocol (UDP)
/// multicast mode network services.
class ONIXS_FIXENGINE_API MulticastClient
{
public:
/// Creates a MulticastClient.
MulticastClient();
/// Finalize the instance.
virtual ~MulticastClient();
/// Adds a MulticastClient to the multicast
/// group using all network interfaces.
void join(const std::string & ip, int port);
/// Adds a MulticastClient to the multicast
/// group using the given network interface.
void join(const std::string & ip, int port, const std::string & networkInterface);
/// Leaves the multicast group.
void drop();
/// Receives a multicast packet.
///
/// @note Blocks until the packet is received.
/// @note The multicast group must be joined first.
///
/// @return The received multicast packet.
const Bytes & receive();
/// Receives a multicast packet.
///
/// @note Blocks until the packet is received or the timeout period is elapsed.
/// @note The multicast group must be joined first.
///
/// @return The received multicast packet or an empty vector if the timeout period is elapsed.
const Bytes & receive(long timeoutInMilliseconds);
/// Sends the given multicast packet.
void send(const std::string & packet);
/// Sends the given multicast packet.
void send(const void * packet, size_t packetSize);
/// The maximum UDP packet size.
enum { MaximumUdpPacketSize = 65535 };
private:
MulticastClient(const MulticastClient &);
MulticastClient & operator = (const MulticastClient &);
struct Impl;
Impl * impl_;
};
}
}
@@ -0,0 +1,108 @@
#pragma once
/*
* 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.
*/
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Sockets/Definitions.h>
#include <string>
namespace OnixS {
namespace Sockets {
/// Provides client connections for TCP network services.
class ONIXS_FIXENGINE_API TcpClient
{
public:
/// Initializes a new instance of the TcpClient class and connects to the specified port on the specified host.
///
/// @param hostname The DNS name of the remote host to which you intend to connect (or its IP address).
/// @param port The port number of the remote host to which you intend to connect.
/// @param timeoutInMillisecons The timeout value in milliseconds. If 0 then the method blocks until some data is received.
TcpClient(const std::string & hostname, int port, int timeoutInMillisecons = 0);
/// Initializes a new instance of the TcpClient class.
TcpClient();
/// The destructor.
~TcpClient(void);
/// Connects to the specified port on the specified host.
///
/// @param hostname The DNS name of the remote host to which you intend to connect (or its IP address).
/// @param port The port number of the remote host to which you intend to connect.
/// @param timeoutInMillisecons The timeout value in milliseconds. If 0 then the method blocks until some data is received.
void connect(const std::string & hostname, int port, int timeoutInMillisecons = 0);
/// Closes the TCP connection.
void close();
/// Sets a value that disables a delay when send or receive buffers are not full.
///
/// When the setTcpNoDelayOption is false, a TcpClient does not send a packet over the network until it has collected a significant amount of the outgoing data.
/// Because of the amount of overhead in a TCP segment, sending small amounts of data is inefficient.
/// However, situations do exist where you need to send very small amounts of data or expect immediate responses from each packet you send.
/// Your decision should weigh the relative importance of network efficiency versus application requirements.
void noDelay(bool setTcpNoDelayOption);
/// Gets a value that disables a delay when send or receive buffers are not full.
bool noDelay() const;
/// Returns the size of the TCP buffer allocated to the TCP connection for the receiving data.
int receiveBufferSize() const;
/// Sets the size of the TCP buffer allocated to the TCP connection for the receiving data.
void receiveBufferSize(int size);
/// Returns the size of the TCP buffer allocated to the TCP connection for the sending data.
int sendBufferSize() const;
/// Sets the size of the TCP buffer allocated to the TCP connection for the sending data.
void sendBufferSize(int size);
static const Handle InvalidSocketHandle;
/// Returns the socket handle which the TCP connection uses to transmit data.
Handle socketHandle();
/// Sends the given value.
void send(const std::string & value);
/// Sends the given value.
void send(const void * buffer, size_t bufferLength);
/// Receives the data.
///
/// @param timeoutInMillisecons The timeout value in milliseconds. If 0 then the method blocks until some data is received.
const Bytes & receive(int timeoutInMillisecons = 0);
/// Receives exactly the given number of bytes.
///
/// @param numberOfBytesToReceive The number of bytes to received.
/// @param timeoutInMillisecons The timeout value in milliseconds. If 0 then the method blocks until all bytes are received.
const Bytes & receive(size_t numberOfBytesToReceive, int timeoutInMillisecons = 0);
private:
TcpClient(const TcpClient &);
TcpClient & operator = (const TcpClient &);
struct Impl;
Impl * impl_;
};
}
}
@@ -0,0 +1,63 @@
/*
* 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/FIXEngine/Threading/Mutex.h>
namespace OnixS {
namespace Threading {
/// The condition variable - a synchronization objects that
/// allows threads to wait for certain events (conditions)
/// to occur.
///
/// The condition variable enables threads to atomically block
/// and test a condition under the protection of the mutual exclusion
/// lock (Mutex) until the condition is satisfied.
class ONIXS_FIXENGINE_API Condition
{
public:
/// Initializes the instance.
Condition();
/// Destructs the instance.
~Condition();
/// Signals the one waiting thread.
void signal();
/// Signals all waiting threads.
void signalAll();
/// Blocks on a condition.
/// @param lock Represents a reference to the Mutex
/// which is used to protect the condition testing.
void wait(Mutex & lock);
private:
// Implementation details.
void * impl_;
// Copying & assignment is prohibited.
Condition(const Condition &);
Condition & operator = (const Condition &);
};
}
}
@@ -0,0 +1,111 @@
/*
* 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
#if defined (_WIN32) // The Windows platform.
#if !defined (STRICT)
#define STRICT
#endif
#if !defined (WIN32_LEAN_AND_MEAN)
#define WIN32_LEAN_AND_MEAN
#endif
#include <Windows.h>
#else // The Linux platform.
#include <pthread.h>
#endif // The Platform Selector.
#include <OnixS/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Compiler.h>
#include <OnixS/FIXEngine/Definitions.h>
namespace OnixS {
namespace Threading {
#if defined (_WIN32)
/// Type alias for the thread identifier.
typedef DWORD ThreadId;
#else
/// Type alias for thread identifier.
typedef pthread_t ThreadId;
#endif
/// The infinite timeout value.
enum { InfiniteTimeout = -1 };
/// The base class for custom items which can be stored in thread-safe containers.
class ONIXS_FIXENGINE_API ItemBase
{
public:
/// Initializes the instance.
ItemBase() : next_() {}
/// Destructs the instance.
virtual ~ItemBase() ONIXS_FIXENGINE_DEFAULT;
/// Returns the next item.
ItemBase * next() const
{
return next_;
}
/// Sets the next item.
void setNext(ItemBase * nextNode)
{
next_ = nextNode;
}
/// Performs a required processing of the item.
virtual void process() = 0;
private:
// The pointer to the next item.
ItemBase * volatile next_;
};
typedef PtrTraits<ItemBase>::UniquePtr ItemBaseUniquePtr;
/// The base class for a custom pool allocator to provide
/// a strategy to create/destroy items for the thread-safe pool.
class ONIXS_FIXENGINE_API PoolAllocatorBase
{
public:
/// Destructs the instance.
virtual ~PoolAllocatorBase() ONIXS_FIXENGINE_DEFAULT;
/// A strategy to create an item.
virtual ItemBase * alloc() = 0;
/// A strategy to destroy an item.
virtual void free(ItemBase * element) const
{
delete element;
}
};
}
}
@@ -0,0 +1,511 @@
/*
* 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/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Compiler.h>
#include <OnixS/FIXEngine/Threading/Definitions.h>
#ifdef ONIXS_FIXENGINE_CXX11
#include <exception>
#endif
namespace OnixS {
namespace System
{
class FutureSharedState;
}
namespace Threading {
/// The state of a \c SharedFuture object (similar to std::future_status, @see http://en.cppreference.com/w/cpp/thread/future_status ).
struct FutureStatus
{
enum Enum
{
/// The shared state is ready.
ready,
/// The shared state did not become ready before the specified timeout duration has passed.
timeout,
/// The shared state contains a deferred function, so the result will be computed only when explicitly requested.
deferred
};
};
namespace Implementation {
class FutureHelper;
class PromiseBase;
// Implementation details.
class ValueBase
{
public:
virtual ~ValueBase() ONIXS_FIXENGINE_DEFAULT;
virtual ValueBase * clone() const = 0;
};
/// Implementation details.
class FutureValue
{
public:
FutureValue(ValueBase * value);
FutureValue();
FutureValue(const FutureValue & other);
~FutureValue();
ValueBase * value() const { return value_; }
private:
ValueBase * value_;
};
/// Implementation details.
template<typename ValueType>
class Value : public ValueBase
{
typedef Value<ValueType> Type;
public:
static const ValueType & value(const ValueBase * value)
{
return static_cast<const Type*>(value)->value();
}
static ValueBase * create(const ValueType & value)
{
return new Type(value);
}
ValueBase * clone() const ONIXS_FIXENGINE_OVERRIDE
{
return create(value_);
}
private:
explicit Value(const ValueType & value) : value_(value) {}
const ValueType & value() const { return value_; }
const ValueType value_;
};
/// The base implementation of the SharedFuture<T>.
class FutureBase
{
public:
/// Check if a future instance is associated with an asynchronous result.
///
/// Returns \c true if the *this has an associated asynchronous result, false otherwise.
bool valid() const ONIXS_FIXENGINE_NOTHROW
{
return state_ != ONIXS_FIXENGINE_NULLPTR;
}
/// Returns \c true if the asynchronous result associated with this Future is ready
/// (has a value or an exception stored in the shared state), \c false otherwise.
///
/// There are often situations where a \c get() call on a Future may not be a blocking call,
/// or is only a blocking call under certain circumstances.
/// This method gives the ability to test for early completion and allows us to avoid
/// associating a continuation, which needs to be scheduled with some non-trivial overhead
/// and near-certain loss of the cache efficiency.
///
/// @throw The std::logic_error if this instance does not refer to a shared state.
ONIXS_FIXENGINE_API bool isReady() const;
/// Returns \c true if the asynchronous result associated with this Future has a stored value,
/// \c false otherwise.
///
/// @throw The std::logic_error if this instance does not refer to a shared state.
ONIXS_FIXENGINE_API bool hasValue() const;
/// Returns \c true if the asynchronous result associated with this Future has a stored exception,
/// \c false otherwise.
///
/// @throw The std::logic_error if this instance does not refer to a shared state.
ONIXS_FIXENGINE_API bool hasException() const;
#ifdef ONIXS_FIXENGINE_CXX11
/// Returns the stored exception.
///
/// @throw The std::logic_error if this instance does not refer to a shared state.
/// @throw The std::logic_error if the operation has *not* finished with an error.
ONIXS_FIXENGINE_API std::exception_ptr getExceptionPtr() const;
#endif
enum { InfiniteTimeout = -1 };
/// Waits for the result to become available during the timeout.
///
/// \note Calling \c wait on the same Future from multiple threads is \e not safe;
/// the intended use is for each thread that waits on the same shared state to have a \e copy of a Future.
///
/// \throw The std::logic_error if this instance does not refer to a shared state.
ONIXS_FIXENGINE_API FutureStatus::Enum wait(int timeoutInMs = InfiniteTimeout) const;
protected:
FutureBase()
: state_() {}
ONIXS_FIXENGINE_API FutureBase(const FutureBase & other) ONIXS_FIXENGINE_NOTHROW;
ONIXS_FIXENGINE_API FutureBase & operator=(const FutureBase & other) ONIXS_FIXENGINE_NOTHROW;
#ifdef ONIXS_FIXENGINE_CXX11
ONIXS_FIXENGINE_API FutureBase(FutureBase && other) ONIXS_FIXENGINE_NOTHROW;
ONIXS_FIXENGINE_API FutureBase & operator=(FutureBase && other) ONIXS_FIXENGINE_NOTHROW;
#endif
struct moving_init_t {};
/// Initializes the instance with shared state.
ONIXS_FIXENGINE_API FutureBase(const System::FutureSharedState * state) ONIXS_FIXENGINE_NOTHROW;
/// Initializes the instance with shared state.
ONIXS_FIXENGINE_API FutureBase(const System::FutureSharedState * state, moving_init_t) ONIXS_FIXENGINE_NOTHROW;
/// Destroys a future object.
///
/// If this is the last reference to the asynchronous result associated with *this (if any), then destroy that asynchronous result.
ONIXS_FIXENGINE_API ~FutureBase() ONIXS_FIXENGINE_NOTHROW;
ONIXS_FIXENGINE_API void swap(FutureBase & other) ONIXS_FIXENGINE_NOTHROW;
ONIXS_FIXENGINE_API const FutureValue & getValue() const;
ONIXS_FIXENGINE_API void getVoid() const;
private:
const System::FutureSharedState * state_;
friend class FutureHelper;
friend class PromiseBase;
};
template<typename T>
struct FutureGetReturn
{
typedef const T & Type;
};
template<>
struct FutureGetReturn<void>
{
typedef void Type;
};
}
/// Represents a future result of an asynchronous operation - a result that will eventually appear in the Future after
/// the processing is complete.
///
/// The class template Future provides a mechanism to access the result of \e asynchronous operations :
/// \li An asynchronous operation (e.g. created via Promise) can provide a Future object to the creator of that asynchronous
/// operation (e.g. via the Promise::getFuture).
/// \li The creator of the asynchronous operation can then use a variety of methods to query, wait for, or extract a value from Future.
/// These methods may block if the asynchronous operation has not yet provided a value.
/// \li When the asynchronous operation is ready to send a result to the creator, it can do so by modifying the <em> shared state </em>
/// (e.g. via the Promise::setValue) that is linked to the creator's Future.
///
/// The Future is the synchronization object constructed around the \e receiving end of the Promise channel. It allows for the separation
/// of the initiation of an operation and the act of waiting for its result.
///
/// The Future is \e copiable and multiple SharedFuture objects may refer to the same shared state.
///
/// Unlike the std::future, this implementation has an extended API, allowing you to query the state of SharedFuture.
/// The internal implementation is lock-free; therefore, setting and polling states do not lead to blocking of threads and/or switching
/// of an execution context.
///
/// \note An access to the same shared state from multiple threads is safe if each thread does it through its own copy of
/// a SharedFuture object.
///
/// \see http://en.cppreference.com/w/cpp/thread/shared_future .
template <typename T>
class SharedFuture : public Implementation::FutureBase
{
public:
SharedFuture() ONIXS_FIXENGINE_NOTHROW
: FutureBase() {}
/// The copy constructor.
SharedFuture(const SharedFuture<T> & other) ONIXS_FIXENGINE_NOTHROW
: FutureBase(other) {}
/// The copy assignment.
SharedFuture<T> & operator=(const SharedFuture<T> & other) ONIXS_FIXENGINE_NOTHROW
{
FutureBase::operator=(other);
return *this;
}
#ifdef ONIXS_FIXENGINE_CXX11
SharedFuture(SharedFuture<T> && other) ONIXS_FIXENGINE_NOTHROW
: FutureBase(std::move(other)) {}
FutureBase & operator=(SharedFuture<T> && other) ONIXS_FIXENGINE_NOTHROW
{
FutureBase::operator=(std::move(other));
return *this;
}
#endif
/// Returns the result. If the result is not ready, the method will block. When completes, it either returns a value or throws an exception.
///
/// This method waits until the Future has a valid result and retrieves it. It effectively calls the wait() in order to wait for the result.
///
/// \exception If an exception was stored in the shared state referenced by this Future (e.g. via a call to the Promise::setException()) then that exception will be thrown.
typename Implementation::FutureGetReturn<T>::Type get() const
{
return Implementation::Value<T>::value(getValue().value());
}
/// swaps two SharedFuture objects
void swap(SharedFuture<T> & other) ONIXS_FIXENGINE_NOTHROW
{
FutureBase::swap(other);
}
private:
/// Initializes the instance with shared state.
SharedFuture(const System::FutureSharedState * state)
: FutureBase(state) {}
/// Initializes the instance with shared state.
SharedFuture(const System::FutureSharedState * state, moving_init_t t) ONIXS_FIXENGINE_NOTHROW
: FutureBase(state, t) {}
friend class Implementation::FutureHelper;
friend class Implementation::PromiseBase;
};
template<>
inline void SharedFuture<void>::get() const
{
getVoid();
}
namespace Implementation {
/// The base implementation of the PromiseFuture<T>.
class PromiseBase
{
public:
/// Check if a future instance is associated with an asynchronous result.
///
/// Returns \c true if the *this has an associated asynchronous result, false otherwise.
bool valid();
ONIXS_FIXENGINE_API void setExceptionImpl();
protected:
ONIXS_FIXENGINE_API PromiseBase() ONIXS_FIXENGINE_NOTHROW;
ONIXS_FIXENGINE_API PromiseBase(const PromiseBase & other) ONIXS_FIXENGINE_NOTHROW;
ONIXS_FIXENGINE_API PromiseBase & operator=(const PromiseBase & other) ONIXS_FIXENGINE_NOTHROW;
#ifdef ONIXS_FIXENGINE_CXX11
ONIXS_FIXENGINE_API PromiseBase(PromiseBase && other) ONIXS_FIXENGINE_NOTHROW;
ONIXS_FIXENGINE_API PromiseBase & operator=(PromiseBase && other) ONIXS_FIXENGINE_NOTHROW;
#endif
/// Destroys a future object.
///
/// If this is the last reference to the asynchronous result associated with *this (if any), then destroy that asynchronous result.
ONIXS_FIXENGINE_API ~PromiseBase() ONIXS_FIXENGINE_NOTHROW;
ONIXS_FIXENGINE_API void swap(PromiseBase & other) ONIXS_FIXENGINE_NOTHROW;
ONIXS_FIXENGINE_API void setValue(ValueBase * value);
ONIXS_FIXENGINE_API void setVoid();
ONIXS_FIXENGINE_API SharedFuture<FutureValue> getFutureImpl() const;
template<typename T>
SharedFuture<T> getTypedFuture() const
{
return SharedFuture<T>(getFutureImpl().state_);
}
private:
/// Implementation details.
struct Impl;
Impl * impl_;
};
}
/// Provides a facility to store a value or an exception that can be acquired asynchronously via a `SharedFuture` object created by the `Promise` object.
/// Each `Promise` object is associated with a shared state, which contains a some state information and a result which may be not yet evaluated, evaluated to a value or evaluated to an exception.
/// The promise stores the result or the exception in the shared state. Marks the state ready and unblocks any thread waiting on a future associated with the shared state.
template <typename T>
class Promise : public Implementation::PromiseBase
{
public:
Promise() ONIXS_FIXENGINE_NOTHROW
: PromiseBase() {}
/// The copy constructor.
Promise(const Promise<T> & other) ONIXS_FIXENGINE_NOTHROW
: PromiseBase(other) {}
/// The copy assignment.
Promise<T> & operator=(const Promise<T> & other) ONIXS_FIXENGINE_NOTHROW
{
PromiseBase::operator=(other);
return *this;
}
#ifdef ONIXS_FIXENGINE_CXX11
Promise(Promise<T> && other) ONIXS_FIXENGINE_NOTHROW
: PromiseBase(std::move(other)) {}
Promise & operator=(Promise<T> && other) ONIXS_FIXENGINE_NOTHROW
{
PromiseBase::operator=(std::move(other));
return *this;
}
#endif
/// Swaps two Promise objects
void swap(Promise<T> & other) ONIXS_FIXENGINE_NOTHROW
{
PromiseBase::swap(other);
}
SharedFuture<T> getFuture() const
{
return getTypedFuture<T>();
}
/// Sets the successful result value to the given shared state.
void set(const T & value)
{
setValue(Implementation::Value<T>::create(value));
}
/// Sets the result to indicate an exception.
///
/// @note Does nothing if the shared state already stores a value or exception.
template<typename ExceptionType>
void setException(const ExceptionType & exception)
{
try
{
throw exception;
}
catch(...)
{
setExceptionImpl();
}
}
};
template<>
class Promise<void> : public Implementation::PromiseBase
{
public:
Promise() ONIXS_FIXENGINE_NOTHROW
: PromiseBase() {}
/// The copy constructor.
Promise(const Promise<void> & other) ONIXS_FIXENGINE_NOTHROW
: PromiseBase(other) {}
/// The copy assignment.
Promise<void> & operator=(const Promise<void> & other) ONIXS_FIXENGINE_NOTHROW
{
PromiseBase::operator=(other);
return *this;
}
#ifdef ONIXS_FIXENGINE_CXX11
Promise(Promise<void> && other) ONIXS_FIXENGINE_NOTHROW
: PromiseBase(std::move(other)) {}
Promise & operator=(Promise<void> && other) ONIXS_FIXENGINE_NOTHROW
{
PromiseBase::operator=(std::move(other));
return *this;
}
#endif
/// Swaps two Promise objects
void swap(Promise<void> & other) ONIXS_FIXENGINE_NOTHROW
{
PromiseBase::swap(other);
}
SharedFuture<void> getFuture() const
{
return getTypedFuture<void>();
}
/// Sets the successful result to the given shared state.
void set()
{
setVoid();
}
/// Sets the result to indicate an exception.
///
/// @note Does nothing if the shared state already stores a value or exception.
template<typename ExceptionType>
void setException(const ExceptionType & exception)
{
try
{
throw exception;
}
catch(...)
{
setExceptionImpl();
}
}
};
}
}
@@ -0,0 +1,54 @@
/*
* 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/FIXEngine/Threading/Mutex.h>
#include <OnixS/FIXEngine/Threading/Semaphore.h>
namespace OnixS {
namespace Threading {
/// Performs the automatic acquisition and release of the synchronization object.
template<class Acquirable> class Guard
{
public:
/// Acquires the synchronization object upon the initialization.
Guard(Acquirable & acquirable)
: acquirable_(acquirable) {
acquirable_.acquire();
}
/// Releases the synchronization object upon the destruction.
~Guard() {
acquirable_.release();
}
private:
Acquirable & acquirable_;
Guard(const Guard &);
Guard & operator = (const Guard &);
};
// Aliases for guards for known synchronization objects.
typedef Guard<Mutex> MutexGuard;
typedef Guard<Semaphore> SemaphoreGuard;
}
}
@@ -0,0 +1,72 @@
/*
* 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/FIXEngine/ABI.h>
namespace OnixS {
namespace Threading {
/// Protects a resources from the simultaneous access by multiple threads.
///
/// Only one thread at a time can own the instance of this class.
///
/// This implementation is optimized for locking threads that are in the same process.
///
/// @note It is NOT suitable for use for the interprocess synchronization.
/// @note The recursive locking is NOT supported.
class ONIXS_FIXENGINE_API Mutex
{
public:
friend ONIXS_FIXENGINE_API_DECL(class, Condition);
/// Initializes the instance.
Mutex();
/// Destructs the instance.
~Mutex();
/// Acquires the lock ownership. If the Mutex already
/// occupied by the other thread, blocks the current
/// thread and waits until it will be released
/// by the owner.
void acquire();
/// Acquires the lock ownership if the Mutex is not
/// owned by any thread. If the Mutex is already
/// owned by the other thread, returns @c false.
/// In either cases it doesn't block thread and
/// quites immediately.
bool tryAcquire();
/// Releases the ownership (lock) and
/// unblocks one of waiting threads.
void release();
private:
// Implementation details.
void * impl_;
// Copying and assignment are prohibited.
Mutex(const Mutex &);
Mutex & operator = (const Mutex &);
};
}
}
@@ -0,0 +1,67 @@
/*
* 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/FIXEngine/ABI.h>
namespace OnixS {
namespace Threading {
/// The limits number of threads that can access the shared resource simultaneously.
class ONIXS_FIXENGINE_API Semaphore
{
public:
/// Initializes the instance with the given value of
/// the "count". The @param count indicates the initial "count"
/// for the semaphore. The state of the semaphore is signaled
/// when its count is greater than zero and
/// non-signaled when it is zero.
Semaphore(unsigned int count = 1);
/// Destructs the object.
~Semaphore();
/// Decrements the semaphore "counter" by one.
/// If the semaphore "counter" is already zero,
/// blocks the thread until the semaphore "count"
/// becomes greater than zero.
void acquire();
/// Tries to acquire the semaphore object. If
/// its "counter" is already zero, returns
/// @c false. In all cases, it doesn't block
/// the thread and quites immediately.
bool tryAcquire();
/// Increments the semaphore "counter" by one.
/// If there are other threads waiting for
/// the object, it blocks one the them.
void release();
private:
// Implementation details.
void * impl_;
// Copying & assignment is prohibited.
Semaphore(const Semaphore &);
Semaphore & operator = (const Semaphore &);
};
}
}
@@ -0,0 +1,147 @@
/*
* 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/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Threading/Definitions.h>
#include <set>
#include <string>
namespace OnixS {
namespace Threading {
/// Logical processors that a thread is allowed to run on (first logical CPU has index 0).
typedef size_t CpuIndex;
typedef std::set < CpuIndex > CpuIndexes;
/// Represents set of CPU indices.
class ONIXS_FIXENGINE_API ThreadAffinity
{
public:
/// Constructs the thread affinity from the string presentation.
/// The symbol ',' is used as the CPU index delimiter.
explicit ThreadAffinity(const std::string & str);
/// Destructs the instance.
~ThreadAffinity();
/// The read-only access to the index collection.
const CpuIndexes & cpuIndexes() const;
/// The collection of CPU indices.
CpuIndexes & cpuIndexes();
/// Serializes the thread affinity to the string presentation.
std::string toString();
private:
// The copying and assignment are prohibited.
ThreadAffinity(const ThreadAffinity &);
ThreadAffinity & operator = (const ThreadAffinity &);
CpuIndexes * indexes_;
};
/// Exposes manipulations over the current thread.
class ONIXS_FIXENGINE_API ThisThread
{
public:
/// Suspends the execution of the current thread for
/// a given amount of time in milliseconds.
static void sleep(unsigned int milliseconds);
/// Executes a singular instruction during the given number of microseconds.
static void spinWait(int microseconds);
/// Sets the processor affinity mask for the current thread.
static void affinity(const CpuIndexes & cpuIndexes);
/// Sets the processor affinity mask for the current thread.
static void affinity(CpuIndex cpuIndex);
/// Sets the priority for the current thread.
static void priority(int priority);
/// Sets the scheduling policy for the current thread.
///
/// @note This method also sets the priority to the minimal value for the new policy,
/// therefore, the priority should be set to a necessary value afterwards.
static void policy(int policy);
/// Gets the platform identifier for the current thread.
static ThreadId id();
private:
// No instances of the current thread are available.
ThisThread(const ThisThread &);
ThisThread & operator = (const ThisThread &);
};
/// Manipulates a thread.
/// Custom thread classes should derive from this class and implement the 'run' method.
class ONIXS_FIXENGINE_API Thread
{
public:
/// Creates the `Thread` object without running a real thread.
explicit Thread(const std::string & name);
/// Cleans up internal resources.
///
/// @note Calls the `std::terminate` if the thread is not stopped at the moment.
virtual ~Thread();
/// Creates and runs an actual thread.
/// Can be called only once for the current 'Thread' instance.
///
/// @throw The std::exception if the thread is started or joined already.
void start();
/// Sends a stop signal to the thread.
void stopAsync();
/// Returns 'true' if a stop signal is sent to the thread
/// by the `stopAsync` method or in a different way, otherwise 'false'.
bool stopRequested() const;
/// Joins the thread completion.
void join() const;
/// Returns the platform identifier.
ThreadId id() const;
private:
/// The thread procedure.
virtual void run() = 0;
/// Implementation details.
struct Impl;
Impl * impl_;
/// The copying and assignment are prohibited.
Thread(const Thread &);
Thread & operator = (const Thread &);
};
}
}
@@ -0,0 +1,78 @@
/*
* 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/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Threading/Definitions.h>
namespace OnixS {
namespace Threading {
/// The thread-safe pool of objects by pointers.
/// The pool is safe for many writers and one reader.
/// The common scenario : a producer of data creates the objects using the pool
/// and sends them to a consumer threads to process, then these threads returns
/// objects back to producer's pool and so on.
class ONIXS_FIXENGINE_API ThreadSafePool
{
public:
/// Initializes the instance.
///
/// @param preferredSize The preferred size of the pool.
/// @param allocator The allocator to provide a strategy to create/destroy pool items.
ThreadSafePool(size_t preferredSize, PoolAllocatorBase & allocator);
/// Removes pooled elements and cleans up internal resources.
~ThreadSafePool();
/// Gets an item from the pool.
/// Gives the ownership of the item to the smart pointer.
/// If the pool is empty then creates an item by the allocator strategy.
/// If the number of allocated elements becomes greater than the preferred pool size,
/// after a high load, then destroys a one element, when possible, by the allocator strategy.
///
/// @param poolItem The smart pointer to store the pool item.
void get(ItemBaseUniquePtr & poolItem);
/// Returns an item to the pool.
/// Takes the ownership of the item from the smart pointer.
///
/// @throw The DomainException if the smart pointer is null.
///
/// @param poolItem The smart pointer to the pool item for returning to the pool.
void put(ItemBaseUniquePtr & poolItem);
/// Returns the preferred size of the pool.
size_t preferredSize();
private:
/// Implementation details.
struct Impl;
Impl * impl_;
/// The copying and assignment are prohibited.
ThreadSafePool(const ThreadSafePool &);
ThreadSafePool & operator = (const ThreadSafePool &);
};
}
}
@@ -0,0 +1,93 @@
/*
* 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/FIXEngine/ABI.h>
#include <OnixS/FIXEngine/Threading/Definitions.h>
namespace OnixS {
namespace Threading {
struct ThreadSafeQueueResult
{
enum Enum
{
/// No data during the timeout.
Timeout,
/// We get data immediately or after waiting during the timeout.
Data,
// We don't get data but was signaled to stop wait.
Signaled
};
};
/// The thread-safe queue to send data from some thread(s) to another single thread.
/// The thread-safe queue owns enqueued elements and deallocates element's memory on the destruction.
class ONIXS_FIXENGINE_API ThreadSafeQueue
{
public:
/// Initializes the instance.
ThreadSafeQueue();
/// Cleans up enqueued elements and internal resources.
~ThreadSafeQueue();
/// Adds an item to the queue.
/// Takes the ownership of the item from the smart pointer.
///
/// @throw The DomainException if the smart pointer is null.
///
/// @param enqueueItem The smart pointer to the allocated item to enqueue.
void enqueue(ItemBaseUniquePtr & enqueueItem);
/// Tries to get an item from the queue during the timeout.
/// Gives the ownership of the item to the smart pointer.
/// Returns the `ThreadSafeQueueResult` value which reflects the result status ('Timeout', 'Data', 'Signaled').
///
/// @param dequeueItem The smart pointer to store the dequeued item.
/// @param waitInMs The waiting timeout.
ThreadSafeQueueResult::Enum dequeue(ItemBaseUniquePtr & dequeueItem, const int waitInMs = InfiniteTimeout);
/// Removes all elements from the queue.
void clear();
/// Returns 'true' if the queue is empty, otherwise 'false'.
bool empty() const;
/// Wakes up the queue if it was in the waiting mode.
/// The `dequeue` method will return the 'Signaled' status if it was in the waiting mode.
void signal();
private:
/// Implementation details.
struct Impl;
Impl * impl_;
/// The copying and assignment are prohibited.
ThreadSafeQueue(const ThreadSafeQueue &);
ThreadSafeQueue & operator = (const ThreadSafeQueue &);
};
}
}
+1
View File
@@ -0,0 +1 @@
libonixs-fix-engine.so.4.10.1
+1
View File
@@ -0,0 +1 @@
libonixs-fix-engine.so.4.10.1
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
libonixs-fix-engine.so.4.10.1
+1
View File
@@ -0,0 +1 @@
libonixs-fix-engine.so.4.10.1
Binary file not shown.