Giter Club home page Giter Club logo

mfast's Introduction

mFAST Actions Status

Introduction

mFAST is a high performance C++ encoding/decoding library for FAST (FIX Adapted for STreaming) protocol.

For more information, please read the article.

Download and Build Intructions

For Unix or macOS with boost library installed on the system paths.

git clone --recursive https://github.com/objectcomputing/mFAST.git
mkdir mFAST/build
cd mFAST/build
cmake ..
make

For detailed build instructions for systems without existing boost library installation or on Windows, please read the wiki page.

Important Notice

[03/13/2016] mFAST has changed the licence from the LGPL v3 to the BSD 3-clause “New” or “Revised” license.

From now on, mFAST require C++ 11 to compile. You can check out the version with tag name "v1.2.1" if you need a C++ 03 only solution.

mFAST has limited support for FAST protocol version 1.2 now. That includes the new define and type tags in the FAST XML specification and the new enum/boolean types. In addition, the generated sequence types support iterators now. However, there is no support for SET, BIT GROUP and TIMESTAMP yet.

If you have used mFAST 1.1 version, please notice there are some backward-incompatible changes. First, to make a existing field absent, please use msg_mref.omit_fieldName() instead of msg_mref.set_fieldName().as_absent(). Second, if you have developed your own visitor for mFAST cref/mref types, the visitor has to be able to visit the new enum cref/mref types.

Using mFAST across the web

  • OCI has successfully translated the mFAST source code into asm.js (an efficient subset of JavaScript).
  • The asm.js version of mFAST when used with Socket.io enables high volume data exchanges between browsers and servers.
  • This is an ideal data format for streaming graphs and feeds to web and mobile clients.
    • It can also go the other direction to stream from web and mobile clients.

mfast's People

Contributors

a-dmitrovsky-db avatar alexeydmitriev avatar chipot avatar cuavas avatar dmitriikuchevskii avatar huangminghuang avatar ksergey avatar mathbunnyru avatar rewritablej avatar spaceim avatar vinamraabajpai avatar vovaprog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mfast's Issues

Dynamically reading templates in multiple threads does not work. Please add lock around tinyxml

Dynamically reading templates in multiple threads does not work.

Would it be possible to add a lock in the dynamic_templates_description::dynamic_templates_description function?

Or at least write it as a limitation that you need to have a look around the dynamic_templates_description::dynamic_templates_description( const char *xml_content, const char *cpp_ns, template_registry *registry)
function for it not to crash.

encoder/decoder problem

Hello
When i try to decode encoded with mfast::fast_encoder message, decoded message has wrong data
Example:

#include <mfast.h>
#include <mfast/coder/fast_decoder.h>
#include <mfast/coder/fast_encoder.h>

#include "test_template.h"

#include <iostream>

using namespace test_template;

int main(int argc, char *argv[])
{
    mfast::fast_encoder encoder;
    mfast::fast_decoder decoder;

    encoder.include({test_template::description()});
    decoder.include({test_template::description()});

    Test data;
    Test_mref data_mref = data.mref();

    data_mref.set_MsgSeqNum().as(100500);
    data_mref.set_SendingTime().as(101215231516000000);

    std::vector< char > msg;
    msg.reserve(1500);

    encoder.encode(data.cref(), msg, true);

    const char *begin = msg.data();
    const char *end = msg.data() + msg.size();

    mfast::message_cref encoded = decoder.decode(begin, end, true);

    test_template::Test_cref cref = static_cast< test_template::Test_cref >(encoded);

    std::cout << cref.get_MsgSeqNum().value() << std::endl;
    std::cout << cref.get_SendingTime().value() << std::endl;

    return 0;
}

Scheme:

<?xml version="1.0" encoding="UTF-8" ?>
<templates xmlns="http://www.fixprotocol.org/ns/fast/td/1.1">
    <!-- Test -->
    <template name="Test" id="1" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1">
        <uInt32 name="MsgSeqNum" id="34"></uInt32>
        <uInt64 name="SendingTime" id="52"></uInt64>
    </template>
</templates>

Output:
2196
101215231516000000

If i set MsgSeqNum as 10 and SendingTime as 20 this example throws exception while decoding message.

Release build test suite has failurres

The Debug build passes all tests but the Release does not. I am compiling with msvc 11.

Running 72 test cases...
../../tests/field_comparator_test.cpp(293): error in "dynamic_templateref_compar
e_test": check m1ref == m2ref failed
../../tests/field_comparator_test.cpp(298): error in "dynamic_templateref_compar
e_test": check m3.cref() == m1ref failed
../../tests/coder_test.cpp(261): error in "dynamic_templateref_coder_test": chec
k test_case.decoding("\xE0\x82\x81\xF0\x81\x82\x83", msg_ref) failed

*** 3 failures detected in test suite "mFast Test Suite"

mFAST overwrites language version and thus breaks build

Consider small project

CMakeLists.txt

cmake_minimum_required(VERSION 2.8)

find_package(mFAST)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
add_executable(a a.cpp)
//...some targets that use mFAST

a.cpp

auto f(int a, int b) { // requires c++14
    return a + b;
}

int main() {
    return 0;
}

So when I make it, I got compilation error because compilation string is
/usr/bin/c++ -std=c++14 -std=c++11 -o CMakeFiles/a.dir/a.cpp.o -c PATH/a.cpp
--std=c++11 is from lib/cmake/mFAST/mFASTConfig.cmake

I propose not to use add_definitions here and require user to choose appropriate version

#31 reopen

Hi it's still the #31

It might be on the windows version (I'm using Visual studio 2013 Update 1) because if I use -hfix 25 the very first message crash.
I've commented "first += skip_header_bytes;" to avoid the skip on each message. (but anyway it crashes before)

Unhandled exception at 0x505B4025 (msvcr120d.dll) in mf_fixed_decode.exe: 0xC0000005: Access violation writing location 0x005F2000.

ntdll.dll!_NtRaiseException@12�()   Unknown
ntdll.dll!_KiUserExceptionDispatcher@8�()   Unknown
msvcr120d.dll!memset(unsigned char * dst, unsigned char value, unsigned long count) Line 136    Unknown
mf_fixed_decode.exe!mfast::vector_mref_base<char>::resize(unsigned int n, char c) Line 364  C++
mf_fixed_decode.exe!mfast::vector_mref_base<char>::assign<char const *>(const char * first, const char * last) Line 408 C++
mf_fixed_decode.exe!mfast::vector_mref_base<char>::copy_from(const mfast::value_storage & v) Line 455   C++
mf_fixed_decode.exe!mfast::vector_mref_base<char>::to_initial_value() Line 302  C++
mf_fixed_decode.exe!mfast::decoder_detail::constant_operator::decode_impl<mfast::string_mref<char> >(const mfast::string_mref<char> & mref, mfast::fast_istream & __formal, mfast::decoder_presence_map & pmap) Line 219    C++
mf_fixed_decode.exe!mfast::decoder_detail::constant_operator::decode(const mfast::string_mref<char> & mref, mfast::fast_istream & stream, mfast::decoder_presence_map & pmap) Line 263  C++
mf_fixed_decode.exe!mfast::fast_decoder_impl::visit<mfast::string_mref<char> >(mfast::string_mref<char> & mref) Line 150    C++
mf_fixed_decode.exe!mfast::detail::field_mutator_adaptor<mfast::fast_decoder_impl>::visit(const mfast::ascii_field_instruction * inst, void * storage) Line 238 C++
mf_fixed_decode.exe!mfast::ascii_field_instruction::accept(mfast::field_instruction_visitor & visitor, void * context) Line 38  C++
mf_fixed_decode.exe!mfast::detail::field_mutator_adaptor<mfast::fast_decoder_impl>::visit(const mfast::make_aggregate_mref<mfast::aggregate_cref> & ref) Line 191   C++
mf_fixed_decode.exe!mfast::make_aggregate_mref<mfast::aggregate_cref>::accept_mutator<mfast::fast_decoder_impl>(mfast::fast_decoder_impl & mutator) Line 352    C++
mf_fixed_decode.exe!mfast::fast_decoder_impl::decode_segment(mfast::fast_istreambuf & sb) Line 336  C++
mf_fixed_decode.exe!mfast::fast_decoder::decode(const char * & first, const char * last, bool force_reset) Line 380 C++
mf_fixed_decode.exe!main(int argc, const char * * argv) Line 152    C++
[External Code] 

boost::exception D2 when decoding Instrument Definition feed

While decoding I receive such error:

c:\oleg\mfast\src\mfast\coder\decoder\fast_istream.h(321): Throw in function bool __cdecl mfast::fast_istream::decode(int &,bool)
Dynamic exception type: class boost::exception_detail::clone_impl
std::exception::what: Unknown exception
[struct mfast::tag_error_code * __ptr64] = D2

Template I used and generated files::

https://dl.dropboxusercontent.com/u/49126809/FAST/FIX50SP2ALL.xml
https://dl.dropboxusercontent.com/u/49126809/FAST/FIX50SP2ALL.cpp
https://dl.dropboxusercontent.com/u/49126809/FAST/FIX50SP2ALL.h
https://dl.dropboxusercontent.com/u/49126809/FAST/FIX50SP2ALL.inl

In the original template I've changed all byteVector to string because otherwise I can not generate the files above.
This is the original file ftp://ftp.micex.com/pub/FAST/ASTS/template/FIX50SP2-ALL.xml

I'm decoding "Security Definition" so I guess probably something is wrong with " " from template?

This is the code where exception happen:

const int max_bytes = 8*sizeof(T)/7+1;

while ( (c & 0x80) == 0 && consumed_bytes < max_bytes) {
tmp <<= 7;
c = buf_->sbumpc();
tmp |= ( c & 0x7F );
++consumed_bytes;
};

if ((c & 0x80) ==0)
BOOST_THROW_EXCEPTION(fast_dynamic_error("D2"));

Any hints how to fix or workaround this problem are welcome. Thanks!

Memory overwritten when creating templates definitions

hello,

Using the olso cash FASTMessageConfig.xml
the templates_builder::VisitExit writes outside the allocated memory

the code here: the this->num_instuctions() returns 16 while the templates is 27 entries.
In the best case it´s only overwrites the arena_allocator already allocated memory, making it not possible to load a second template (using the same template_registry). But since it´s the last thing allocated normally not an big issue.
In worse case it writes outside the allocated memory (not the case with the olso cash template)

`
bool templates_builder::VisitExit(const XMLElement &element) {
if (std::strcmp(element.Name(), "templates") == 0) {
typedef const template_instruction *const_template_instruction_ptr_t;

definition_->instructions_ = new (alloc())
    const_template_instruction_ptr_t[this->num_instructions()];
std::copy(templates_.begin(), templates_.end(), definition_->instructions_);
definition_->instructions_count_ = static_cast<uint32_t>(templates_.size());

}
return true;
}`

Should the definition_->instructions_ not be the size of the templates?

added a modified version of dictionary_builder_test.cpp where it tries to print all the templates names. it crashes. (The test requites the dummy.xml (in the tests.zip file) plus the FASTMessageConfig.xml to work)

tests.zip

fast_type_gen.exe problem

I'm trying to generate c++ classes for template:
ftp://ftp.micex.com/pub/FAST/ASTS/template/FIX50SP2-ALL.xml
(real market-data template for Moscow Exchange)
and i get following message:
image

more fast_type_gen issues

At first,
fast_type_gen is unable to properly generate c++ classes if template name:

  1. contains '+', '-', etc
  2. starts with digit

examples:
< template name="W-OBS-FOND" id="2302" / >
< template name="5" id="2002" / >

Actually, I don't think it's a trouble to modify xml-file, but I consider it necessary to describe this situation in mFAST documentation.

At second,
fast_type_gen creates those declarations for all decimal fileds:

decimal_value_storage(0LL, ));

when I try to generate classes from this template:
ftp://ftp.micex.com/pub/FAST/ASTS/template/FIX50SP2-ALL.xml

Compiling with visual studio 2010

With 2 small changes I can now compile the libs with vs2010 (x64)

Added _MSC_VER check In exceptions.h:


#ifndef _MSC_VER
namespace  boost {
  // For Clang, we must use extern template and explicit template instantiation;
  //     otherwise, we will have duplicated definition link error when building shared library.
  // For GCC, we must nest the explicit instantiation statement inside their original namespace;
  //     otherwise, the code won't compile.
    extern template class error_info<mfast::tag_referenced_by,std::string>;
    extern template class error_info<mfast::tag_template_id,unsigned>;
    extern template class error_info<mfast::tag_template_name,std::string>;
}
#endif

Added cast in malloc_allocator.cpp:


  // make the new_size at least 64 bytes
  new_size = std::max(2UL*static_cast<unsigned long>(new_size), 64UL) & (~63);

But still having problems compiling mfast_test:

Error 277 error C2027: use of undefined type 'mfast::detail::int_trait' d:\mfastbuild\build\mfast\src\mfast\coder\decoder\fast_istream.h 289
Error 278 error C2065: 'temp_type' : undeclared identifier d:\mfastbuild\build\mfast\src\mfast\coder\decoder\fast_istream.h 289
Error 279 error C2146: syntax error : missing ';' before identifier 'tmp' d:\mfastbuild\build\mfast\src\mfast\coder\decoder\fast_istream.h 289
Error 280 error C2065: 'tmp' : undeclared identifier d:\mfastbuild\build\mfast\src\mfast\coder\decoder\fast_istream.h 289
Error 281 error C2065: 'tmp' : undeclared identifier d:\mfastbuild\build\mfast\src\mfast\coder\decoder\fast_istream.h 295
Error 282 error C2065: 'tmp' : undeclared identifier d:\mfastbuild\build\mfast\src\mfast\coder\decoder\fast_istream.h 301
Error 283 error C2065: 'tmp' : undeclared identifier d:\mfastbuild\build\mfast\src\mfast\coder\decoder\fast_istream.h 305
Error 284 error C2065: 'tmp' : undeclared identifier d:\mfastbuild\build\mfast\src\mfast\coder\decoder\fast_istream.h 314
Error 285 error C2065: 'tmp' : undeclared identifier d:\mfastbuild\build\mfast\src\mfast\coder\decoder\fast_istream.h 316
Error 286 error C2065: 'tmp' : undeclared identifier d:\mfastbuild\build\mfast\src\mfast\coder\decoder\fast_istream.h 324
Error 287 error C2065: 'tmp' : undeclared identifier d:\mfastbuild\build\mfast\src\mfast\coder\decoder\fast_istream.h 327
Error 297 error C2665: 'mfast::detail::encode_max_value' : none of the 5 overloads could convert all the argument types d:\mfastbuild\build\mfast\src\mfast\coder\encoder\fast_ostream.h 168

duplicate_template_id_error

Fast_type_gen assigns id 0 to all templates with no id in the definition, so decoder.include(descriptions) throws a duplicate_template_id_error exception

avoid "std::pow(10,x)"?

Please consider this as a very low priority feature request, but let me post it, as performance is important part of mfast :)

I've found such code:

 operator double()
  {
    double x = mantissa();
    return x * std::pow(10, exponent());
  }

Of course it should be tested, but likely something like this must be significantly faster:

int pow10[] = {
            0.0000000001,
            0.000000001,
            0.00000001,
            0.0000001,
            0.000001,
            0.00001,
            0.0001,
            0.001,
            0.01,
            0.1,
    1,
    10,
    100,
    1000,
    10000,
    100000,
    1000000,
    10000000,
    100000000,
    1000000000,
};


 operator double()
  {
    double x = mantissa();
    return x * pow10[exponent() + 10];
  }

"Copy" for enums turns to be "no operator"

For enum fields defined as in example below presence map is not shifted during decode.

<define name="ENUM_A">
<enum>
      <element name="A_FIRST" />
      ...
      <element name="A_LAST" />
</enum>
</define>
...
<template name="T_XXX" dictionary="template">
    ...
    <field name="FieldA"><type name="ENUM_A"/><copy/></field>
    <field name="NextField">...</field>
    ...
</template>

Debug output of decode:

decoding FieldA: pmap -> J1110010
stream -> 82 81 ....
decoded FieldA = 1
decoding NextField: pmap -> J1110010

(pmap value was not updated). At the moment I'm using patch as follows, curious what would be real resolution.

diff --git a/src/mfast/coder/decoder/decoder_field_operator.cpp b/src/mfast/coder/decoder/decoder_field_operator.cpp
index f185f6f..31898d1 100644
--- a/src/mfast/coder/decoder/decoder_field_operator.cpp
+++ b/src/mfast/coder/decoder/decoder_field_operator.cpp
@@ -72,7 +72,8 @@ public:

   template <typename T>
   void decode_impl(const T &mref, fast_istream &stream,
-                   decoder_presence_map & /* pmap */) const {
+                   decoder_presence_map & pmap) const {
+   if (not mref.optional() or pmap.is_next_bit_set())
     stream >> mref;

     // Fast Specification 1.1, page 22

Null fields with No Operator and optional not encoded correctly.

When having no operator and optional field the specification says this for null fields:
"If a field is optional and has no field operator, it is encoded with a nullable representation and the NULL is used to represent absence of a value. It will not occupy any bits in the presence map. "

When trying this out I found that the "No operator" + Optional is not encoded correctly. They are not written to the stream at all.

After some digging I found that the fast_encoder.cpp is skipping these since marked as absent and the encoder_field_operator is encoding them incorrect.

This is a first suggestion what needs to be done:

in
encoder_field_operator.cpp these lines where added\changed to the encode_impl for the no_operator.
if (cref.absent())
{
stream.encode_null();
}
else
{
stream << cref;
}

in the fast_encoder.cpp for the fast_encoder_impl::visit(message_cref cref, bool force_reset) {
the vistior also now visit fields with operator none even if not present.

for (auto &&field : message)
if (field.present() || field.instruction()->field_operator() == operator_none)
apply_accessor(*this, field);

sign conversion erros in headers and other warnings

0.(minor) Have one little warning inside your project

mFAST/src/mfast/json/json_encode.cpp|42 col 59| warning: format ‘%lld’ expects argument   of type ‘long long int’, but argument 4 has type ‘int64_t {aka long int}’ [-Wformat=]
  1. (major) There are lots of sign-conversion warnings in your header files, for example:
mFAST/src/mfast/instructions/decimal_instruction.h|135 col 23| error: conversion to ‘uint16_t {aka short    unsigned int}’ from ‘std::size_t {aka long unsigned int}’ may alter its value [-Werror=conversion]

so I have to patch your code and add everywhere:

#pragma GCC diagnostic ignored "-Wconversion"

I think it would be nice if you add some extra options to the compiler:

-Wall -Wextra -Werror -pedantic -Wold-style-cast -Wconversion -Wsign-conversion -Wunreachable-code

Possible error due to non FAST 1.1 standard conform behavior

We are currently implementing the Xetra T7 Reference Data solution RDI which uses FAST 1.1 + SCP 1.1.
Xetra is using the optional template identifier specified in FAST standard Paragraph 10.

Each message is represented as a segment, a message segment.
A segment has a header consisting of a Presence Map followed by an optional Template Identifier. The
segment has a template identifier either if it is a message segment, or if the segment appears as the result
of a dynamic template reference instruction. A template identifier is encoded as if a copy operator was
specified
. The operator uses the global dictionary and has an internal key common to all template
identifier fields. This means that a segment with a template identifier does not always contain the template identifier physically. However, the first bit in the presence map is allocated by its copy operator.

Now when we're seeing two messages of the same template type following each other. mFast tries to decode the template id from the second message, but fails and throws an exception with a unknown template id.

../include/mfast/coder/decoder_v2/fast_decoder_core.h(665): Throw in function const mfast::message_mref& mfast::coder::fast_decoder_core::decode_segment(mfast::fast_istreambuf&) [with unsigned int NumTokens = 0u]
Dynamic exception type: boost::exception_detail::clone_implmfast::fast_dynamic_error
std::exception::what: std::exception
[mfast::tag_error_code*] = D9
[mfast::coder::tag_template_id*] = 137

We think mFast is missing that part of the specification, to see the template id as a normal field with copy operator.

What we see is :
ID 73 -> Packet Header
ID 120 -> Fast Reset
ID 123 -> Instrument Snapshot
... following should also be 123 but gets detected as 137 (which is not existing)

Full packet (received through boost asio, decoded/parsed as in mfast example):
total length 1347 bytes.

  • packet header 17 bytes,
  • reset msg 2 bytes,
  • 123 (as parsed by mfast) 152 bytes
  • exception due to template id

00000 | C0 C9 9E 84 00 00 0B CE 88 14 AC A5 FE C6 DA 68 | ...............h
00010 | CE C0 F8 7A E8 FB BD 1A 80 84 C0 80 36 32 38 B6 | ...z........628.
00020 | C2 C0 84 44 45 30 30 30 45 54 46 4C 30 34 B5 B4 | ...DE000ETFL04..
00030 | C0 8C 45 4C 34 C4 B8 88 80 81 44 4B 20 53 54 4F | ..EL4.....DK STO
00040 | 58 58 20 45 55 52 2E 53 54 52 2E 56 41 4C 55 45 | XX EUR.STR.VALUE
00050 | 20 32 B0 80 C0 A3 82 F0 42 45 43 43 D0 80 80 87 | 2......BECC....
00060 | E0 80 31 30 30 30 B0 E0 81 31 30 30 B0 E0 82 46 | ..1000...100...F
00070 | 45 48 4C 45 4E 44 45 20 45 4D 4D 49 54 45 4E 54 | EHLENDE EMMITENT
00080 | 45 4E 44 41 54 45 CE E0 86 58 45 54 D2 E0 8A D9 | ENDATE...XET....
00090 | E0 88 58 45 54 52 41 4C CC E0 89 58 45 54 52 C1 | ..XETRAL...XETR.
000A0 | 82 E0 81 09 49 4D CB FE 81 FE 81 4F E0 01 89 83 | ....IM.....O....
000B0 | 83 83 E0 4E 90 4E 90 C0 B8 C0 80 00 C0 81 84 C0 | ...N.N..........
000C0 | 84 36 32 38 B7 C2 C0 84 44 45 30 30 30 45 54 46 | .628....DE000ETF
000D0 | 4C 30 35 B2 B4 C0 8C 45 4C 34 C5 B8 89 53 54 59 | L05....EL4...STY
000E0 | 2E 43 2E 34 B0 80 82 80 87 E0 80 31 30 30 30 B0 | .C.4.......1000.
000F0 | E0 81 31 30 30 B0 E0 82 46 45 48 4C 45 4E 44 45 | ..100...FEHLENDE
00100 | 20 45 4D 4D 49 54 45 4E 54 45 4E 44 41 54 45 CE | EMMITENTENDATE.
00110 | E0 86 58 45 54 D2 E0 8A D9 E0 88 58 45 54 52 41 | ..XET......XETRA
00120 | 4C CC E0 89 58 45 54 52 C1 82 C0 81 03 E0 83 80 | L...XETR........
00130 | 80 80 00 C0 81 84 C0 84 36 32 38 B8 C2 C0 84 44 | ........628....D
00140 | 45 30 30 30 45 54 46 4C 30 36 B0 B4 C0 8C 45 4C | E000ETFL06....EL
00150 | 34 C6 B8 97 44 41 58 20 28 41 55 53 53 43 48 55 | 4...DAX (AUSSCHU
00160 | 45 54 54 45 4E 44 A9 80 82 80 87 E0 80 31 30 30 | ETTEND.......100
00170 | 30 B0 E0 81 31 30 30 B0 E0 82 46 45 48 4C 45 4E | 0...100...FEHLEN
00180 | 44 45 20 45 4D 4D 49 54 45 4E 54 45 4E 44 41 54 | DE EMMITENTENDAT
00190 | 45 CE E0 86 58 45 54 D2 E0 8A D9 E0 88 58 45 54 | E...XET......XET
001A0 | 52 41 4C CC E0 89 58 45 54 52 C1 82 C0 81 03 E0 | RAL...XETR......
001B0 | 83 80 80 80 00 C0 81 84 C0 84 36 32 38 B9 C2 C0 | ..........628...
001C0 | 84 44 45 30 30 30 45 54 46 4C 30 37 B8 B4 C0 8C | .DE000ETFL07....
001D0 | 45 4C 34 C7 B8 94 45 4F 20 53 54 4F 58 58 20 53 | EL4...EO STOXX S
001E0 | 45 4C 2E 44 49 56 49 44 2E 33 B0 80 82 80 87 E0 | EL.DIVID.3......
001F0 | 80 31 30 30 30 B0 E0 81 31 30 30 B0 E0 82 46 45 | .1000...100...FE
00200 | 48 4C 45 4E 44 45 20 45 4D 4D 49 54 45 4E 54 45 | HLENDE EMMITENTE
00210 | 4E 44 41 54 45 CE E0 86 58 45 54 D2 E0 8A D9 E0 | NDATE...XET.....
00220 | 88 58 45 54 52 41 4C CC E0 89 58 45 54 52 C1 82 | .XETRAL...XETR..
00230 | C0 81 03 E0 83 80 80 80 00 C0 81 84 C0 84 36 32 | ..............62
00240 | 39 B0 C2 C0 84 44 45 30 30 30 45 54 46 4C 30 38 | 9....DE000ETFL08
00250 | B6 B4 C0 8C 45 4C 34 C8 B8 96 4D 53 43 49 20 45 | ....EL4...MSCI E
00260 | 55 52 4F 50 45 20 4C C3 80 82 80 87 E0 80 31 30 | UROPE L.......10
00270 | 30 30 B0 E0 81 31 30 30 B0 E0 82 46 45 48 4C 45 | 00...100...FEHLE
00280 | 4E 44 45 20 45 4D 4D 49 54 45 4E 54 45 4E 44 41 | NDE EMMITENTENDA
00290 | 54 45 CE E0 86 58 45 54 D2 E0 8A D9 E0 88 58 45 | TE...XET......XE
002A0 | 54 52 41 4C CC E0 89 58 45 54 52 C1 82 C0 81 03 | TRAL...XETR.....
002B0 | E0 83 80 80 80 00 C0 81 84 C0 84 36 32 39 B1 C2 | ...........629..
002C0 | C0 84 44 45 30 30 30 45 54 46 4C 30 39 B4 B4 C0 | ..DE000ETFL09...
002D0 | 8C 45 4C 34 C9 B8 8A 55 53 41 20 4C C3 80 82 80 | .EL4...USA L....
002E0 | 87 E0 80 31 30 30 30 B0 E0 81 31 30 30 B0 E0 82 | ...1000...100...
002F0 | 46 45 48 4C 45 4E 44 45 20 45 4D 4D 49 54 45 4E | FEHLENDE EMMITEN
00300 | 54 45 4E 44 41 54 45 CE E0 86 58 45 54 D2 E0 8A | TENDATE...XET...
00310 | D9 E0 88 58 45 54 52 41 4C CC E0 89 58 45 54 52 | ...XETRAL...XETR
00320 | C1 82 C0 81 03 E0 83 80 80 80 5F 87 FA 58 45 54 | .........._..XET
00330 | D2 ED 09 4C 5B 93 09 4C 5B 94 80 4A 50 30 30 30 | ...L[..L[..JP000
00340 | 4A 50 59 31 31 31 B1 80 81 80 F0 83 DC A4 80 80 | JPY111..........
00350 | 81 88 FE 81 98 81 88 81 8C 98 81 8C FC 03 5C 6B | ..............\k
00360 | 13 FF 82 AC 80 80 81 FC 81 9E 80 81 FC 03 5C 6B | ..............\k
00370 | 13 FF 80 81 81 80 81 80 E0 81 81 81 80 85 DC 82 | ................
00380 | 86 1B AD 75 99 80 32 33 39 2E 30 2E 30 2E 35 B0 | ...u..239.0.0.5.
00390 | 01 19 8A 81 32 33 39 2E 30 2E 30 2E 36 B0 01 19 | ....239.0.0.6...
003A0 | 8C FC 81 82 80 80 80 82 31 31 B0 F4 83 31 32 B0 | ........11...12.
003B0 | F4 A8 82 81 83 39 B0 FE 83 30 B0 FE DC 81 86 80 | .....9...0......
003C0 | 07 29 C1 82 33 B0 8A 84 34 B0 8B 8C 81 80 82 31 | .)..3...4......1
003D0 | B0 FE 83 32 B0 FE 50 C0 FB E5 84 C0 84 4A 50 59 | ...2..P......JPY
003E0 | 31 31 B1 C2 C0 FC 4A 50 30 30 30 4A 50 59 B1 B4 | 11....JP000JPY..
003F0 | C0 8A D9 B8 85 8F 4A 50 D9 80 83 D8 53 63 72 75 | ......JP....Scru
00400 | 62 62 65 E4 81 81 D8 42 55 42 4F CE 80 80 88 E0 | bbe....BUBO.....
00410 | 80 31 30 30 B0 E0 81 31 30 B0 E0 86 58 45 54 D2 | .100...10...XET.
00420 | E0 8A CE E0 88 53 44 58 B1 E0 89 4D 61 72 6B 65 | .....SDX...Marke
00430 | 74 20 47 72 6F 75 70 20 53 44 58 B1 E0 88 58 45 | t Group SDX...XE
00440 | 54 52 41 4C CC E0 89 58 45 54 52 C1 82 E0 81 09 | TRAL...XETR.....
00450 | 45 30 87 0B E0 81 83 E0 E4 E4 80 80 40 84 FA 91 | E0..........@...
00460 | 8A 38 38 37 4A 50 59 39 39 32 B2 80 E0 82 D8 A5 | .887JPY992......
00470 | 80 80 82 82 9C 82 82 FC 03 5C 6B 13 FF FE 85 82 | .........\k.....
00480 | 8E 80 81 FC 81 80 9E 80 81 FC 03 5C 6B 13 FF 80 | ...........\k...
00490 | 81 81 80 80 80 F8 81 82 80 80 81 31 B0 FA 83 31 | ...........1...1
004A0 | 32 B0 FA A8 82 81 83 39 B0 FE 83 30 B0 FE DC 81 | 2......9...0....
004B0 | 86 80 07 29 C1 82 33 B0 8A 84 34 B0 8B 8C 81 80 | ...)..3...4.....
004C0 | 82 31 B0 FE 83 32 B0 FE CC 82 1B AD 75 99 82 35 | .1...2......u..5
004D0 | B0 86 83 36 B0 87 40 C0 FB 91 84 C0 80 32 32 B3 | [email protected].
004E0 | C2 C0 84 38 38 37 4A 50 59 39 39 32 B2 B4 C0 8B | ...887JPY992....
004F0 | 59 CE B8 83 59 CE C0 A4 82 80 88 E0 80 31 30 30 | Y...Y........100
00500 | B0 E0 81 31 30 B0 E0 86 58 45 54 D2 E0 8A CE E0 | ...10...XET.....
00510 | 88 4D 44 58 B1 E0 89 4D 61 72 6B 65 74 20 47 72 | .MDX...Market Gr
00520 | 6F 75 70 20 4D 44 58 B1 E0 88 58 45 54 52 41 4C | oup MDX...XETRAL
00530 | CC E0 89 58 45 54 52 C1 82 C0 81 0B E0 83 83 80 | ...XETR.........
00540 | 80 C0 81 | ...

first templates in message:

<template id="73" name="RDPacketHeader"> <uInt32 name="SenderCompID" id="49"/> <byteVector name="PacketSeqNum"/> <byteVector name="SendingTime"/> </template>

<template id="123" name="InstrumentSnapshot"> <string name="MsgType" id="35"> <constant value="d"/> </string> <uInt32 name="MsgSeqNum" id="34"> <increment/> </uInt32> .......

full template files can be obtained here ( T7 Market + Reference Data Interfaces - XML FAST Templates - FIXML schema files (simulation version) (Download, ZIP, 65.94 kB) -> rdd/RDDFastTemplates-1.1.xml):
http://www.xetra.com/xetra-en/technology/t7/system-documentation-e/T7-System-documentation/2845474?frag=2835924

used template files are dated 10.02.2017

direct link :
http://www.xetra.com/blob/2856128/249822e5d36bc56b9a33f451fe496b9c/data/T7-Market--Reference-Data-Interfaces-XML-FAST-Templates-FIXML-schema-files.zip

bug in the decoding of decimal fields where the exponent has a default operator with a NULL value

I'm convinced that there's a bug involving the decoding of decimal fields where the exponent had a default operator with a NULL value, and where the pmap bit for that field is set to 0. What the decoder does is that it first realizes that the pmap bit is set to 0. Next, since the decimal's exponent has a default operator, the decoder checks its value. When it reads that the default operator's value is NULL, it is supposed to exclude the decimal field entirely from the decoded message result.

Instead, what mfast did was it read the operator's default value, and did not distinguish between NULL and non-NULL values. It was hard-coded to think that there was an actual default operator value, even though that default operator value was NULL and did not exist. My fix involved removing this (hard-coded?) feature.

Looking at the second line of void as(int*_t) const method, line 250 of decimal_ref.h, we see the hardcoded presence member.

void as(int8_t v) const
{
  this->storage()->of_decimal.exponent_ = v;
  this->storage()->present(true);
}

My fix involved modifying as_initial_value() to call a different overloaded helper function as(), that passes in the present_ member.

void as_initial_value() const
{
  as(this->instruction()->initial_value().of_decimal.exponent_, 
      this->instruction()->initial_value().of_decimal.present_);
}
void as(int8_t v, unsigned int pres) const
{
  this->storage()->of_decimal.exponent_ = v;
  this->storage()->present(pres); // pres cannot be assumed to be true.
}
// Left here for the succeeding as function call
void as(int8_t v) const
{
  this->storage()->of_decimal.exponent_ = v;
  this->storage()->present(true);
}

Could you please verify?

How to copy message by _cref?

#include <mfast.h>
#include <iostream>

#include "scheme.h"

int main(int argc, char *argv[])
{
    // Create message
    scheme::_0 msg;
    scheme::_0_mref msg_mref = msg.mref();
    scheme::_0_cref msg_cref = msg.cref();

    // Fill message fields
    msg_mref.set_SendingTime().as(20150701121211999);
    msg_mref.set_MsgSeqNum().as(399);


    // Copy message
    mfast::message_type copied_msg(msg_cref, mfast::malloc_allocator::instance());
    scheme::_0_cref copied_msg_cref = static_cast< scheme::_0_cref >(copied_msg.cref());

    // Print SendingTime
    std::cout << "MSG SendingTime = " << msg_cref.get_SendingTime().value() << std::endl;
    std::cout << "Copied MSG SendingTime = " << copied_msg_cref.get_SendingTime().value() << std::endl;

    return 0;
}

Output:
MSG SendingTime = 20150701121211999
Copied MSG SendingTime = 3472328298477784671

How to copy mfast messages from his _cref class? How i can store mfast messages in containers?

Error while processing presence map inside optional group

mFast fails to decode EUREX Reference Data stream.

Running sample data with the appropriate XML template gives the following error:

./performance_test/mf_generic_decode -t ../example.xml -f ./example.dat
/opt/mfast/src/mfast/coder/decoder/fast_istream.h(324): Throw in function typename boost::enable_ifboost::is_integral<T, bool>::type mfast::fast_istream::decode(T&, bool) [with T = int]
Dynamic exception type: boost::exception_detail::clone_implmfast::fast_dynamic_error
std::exception::what: std::exception
[mfast::tag_error_code*] = D2

We have a suspicion that the optional groups which are present in the XML template are processed incorrectly. The debug output shows that mFast tries to decode 0xC0 byte as a value of the field called "TransactTime", whereas 0xC0 in this case is a presence map inside the group called "ComplexInstrumentDescriptorGroup".

Below is the link to the message example and the XML templates.

https://www.dropbox.com/s/zoxs4p5aykx7qp0/mfastBug.zip?dl=0

fast_type_gen naming issue

As you can see on screenshot, name of highlighted opContext does not match to previously defined:
1
From the context it seems like it should match (at least it does not compile as it is).
template taken from here: ftp://ftp.moex.com/pub/FAST/Spectra/templates/templates.xml

C2061, C2244 in message_ref.h

compile errors in lines 116, 173 in file message_ref.h when compiling by MS VS 2012

solution - add 'typename' before 'make_message_mref<AggregateMRef,TemplateType>::instruction_cptr instruction'

Building error

Missing "catch.hpp" file:

$ mkdir build
$ cd build
$ cmake ..
$ make
...
Scanning dependencies of target mfast_test
[ 53%] Building CXX object tests/CMakeFiles/mfast_test.dir/test_main.cpp.o
/home/serge/projects/mFAST/tests/test_main.cpp:24:21: fatal error: catch.hpp: No such file or directory

Order of decoded fields

When I decode W_OLS_CURR message and access MessageType field, I get "FIXT.1.1" instead of "W". If I print this message with message_printer taken from examples I get:
BeginString: FIXT.1.1
MessageType: W
SenderCompID: MOEX
ApplVerID: 9
MsgSeqNum: 123
SendingTime: 20140402145218210
LastMsgSeqNumProcessed: 448
RptSeq: 1
LastFragment: 1
TradSesStatus: 100
Symbol: USDEURBASKET
MDSecurityTradingStatus: 18
GroupMDEntries:
[0]:
MDEntryType: J
TradingSessionID: CNGD
Template can be taken from here: ftp://ftp.moex.ru/pub/FAST/ASTS/template/FIX50SP2-ALL.xml
UPDATE: I have made some research and found that in generated template.cpp BeginString_instruction and MessageType_instruction are in wrong order(not as they are in templates.xml):
const static field_instruction* W_OLS_CURR__subinstructions[] = {
&W_OLS_CURR__BeginString_instruction,
&W_OLS_CURR__MessageType_instruction,
...

Access NoXXX fields

I’m trying to make a message printer that converts the messages to fix format. Is there a way to access the NoXXX fields to print the id and the value? For example I would like to print the NoMDEntries like this: …<SOH>268=10<SOH>…

vs2010 x64 debug version fails to pass all tests

Debug version fails to pass all tests

Running 72 test cases...
unknown location(0): fatal error in "test_fast_encoding": C:\Program Files (x86)
\Microsoft Visual Studio 10.0\VC\include\vector(932) : Assertion failed: vector
subscript out of range

d:\mfastbuild\build\mfast\tests\debug_allocator.h(37): last checkpoint

*** 1 failure detected in test suite "mFast Test Suite"

Trouble when decoding MOEX messages

Hi,
I'm having trouble decoding some MOEX messages (FIX50SP2_ALL::X_OBR_FOND_cref) using the following template : ftp://ftp.micex.com/pub/FAST/ASTS/template/FIX50SP2-ALL.xml

When using the same instance of the decoder, i've got garbage value in the decoded field (c.f. price and qty below).
This doesn't happens when using a new instance of the decoder every times i have a new message.

When looking at the template, the misdecoded field are all using the delta operator.
How can i see if this is a bug in the mFast libraries with the delta operator or an error with data not corresponding to the template ?

Thanks a lot in advance,
Best regards,
Greg.

Same decoder instance for all messages :

X-OBR-FOND:
0 BeginString: FIXT.1.1
0 MessageType: X
0 SenderCompID: MOEX
0 ApplVerID: 9
0 MsgSeqNum: 19211
0 SendingTime: 20131223055959676
0 GroupMDEntries:
000 [0]:
00000 MDUpdateAction: 4294967173
00000 MDEntryType: 1
00000 MDEntryID: S00008529005960097593490004000066802029009850099000...
00000 Symbol: MRKHP
00000 RptSeq: 24
00000 MDEntryPx: 873636_10^18
00000 MDEntrySize: 173015_10^52
00000 TradingSessionID: TQBS

Compared to new instances for each messages :

X-OBR-FOND:
0 BeginString: FIXT.1.1
0 MessageType: X
0 SenderCompID: MOEX
0 ApplVerID: 9
0 MsgSeqNum: 19211
0 SendingTime: 20131223055959676
0 GroupMDEntries:
000 [0]:
00000 MDUpdateAction: 0
00000 MDEntryType: 1
00000 MDEntryID: S000007188
00000 Symbol: MRKHP
00000 RptSeq: 24
00000 MDEntryPx: 7188_10^-4
00000 MDEntrySize: 168_10^0
00000 TradingSessionID: TQBS

Build mFAST with project?

Hi,

It's possible to build mFAST library during build a cmake-project?

for example, something like this:

...
set( mFast_build_examples OFF )
set( mFast_build_test OFF )
include( external/mFAST/mFAST.cmake )
...

Thanks

vector_ref.h uses std::min what conflicts with windows.h somehow

Using mFAST on Windows I've received such errors:

error C2059: syntax error : '::' c:\oleg\mfast\src\mfast\vector_ref.h 442
error C2589: '(' : illegal token on right side of '::' c:\oleg\mfast\src\mfast\vector_ref.h 442

This problem is not always reproducable, somehow it depends on what is included and in which order.

Solution from here http://stackoverflow.com/a/2561377/93647 works fine, I just added NOMINMAX macro to project settings and now it compiles.

Adding this bug to let other people now the solution. Also probably build scripts can/should be updated to define NOMINMAX?

AccessViolationException after updating to commit #130

Hi!

I've recently updated to latest commit (#130).
Now mFAST causes application crash with AccessViolationException:

Exception Info: System.AccessViolationException
Stack:
   at <Module>.mfast.fast_decoder.decode(mfast.fast_decoder*, mfast.make_message_cref<mfast::aggregate_cref,mfast::template_instruction>*, SByte**, SByte*, Boolean)

When I build project which depends on mFAST I get warning C4996 what refers to xutility.h:

xutility(2227): warning C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'

There was no such warning in previous versions of mFAST and I suppose that described problems have the same root.

Today I was forced to downgrade to commit 71f7fa0 and it works fine.

Underflow causes illegal array access

Hi,

I may have discovered a possible bug in your implementation.

Issue: decode_string( "\x00\x80", true, "", 0)
The above is a nullable message and we are expecting a size of zero.
Code in fast_istream_extractor.h line 50-52:
if (strm.decode(buf, len, mref.instruction()->is_nullable(), mref.instruction())) {
mref.assign(buf, buf+len);
mref[len-1] &= '\x7F';
}
In the above case("\x00\x80") the len variable will be zero and then by mref[len-1] you underflow.
In fast_istream.h , line 79-83:
len = 1;
if (c == '\x80') {
//len -= nullable; // GREG code hack
return false; //true // GREG code hack
}
I made the above change so it does not make the bad array access.
Could you help me on this issue?

Thanks

Greg

LNK4221 in decoder_precence_map.obj

Hi!

I've updated to latest commit (#119) and trying now to build project 'fast_type_gen'. (configuration = release, both x86 and x64).
Buid succedes, but I get LNK4221:

Warning 1 warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
\mFAST\trunk\src\mfast\coder\decoder_presence_map.obj mfast_coder_static

Configuration 'debug' builds fine.

What's wrong?

BOOST_HAS_RVALUE_REFS issue

Hi!

Here is piece of code from "string_ref.h":

#ifdef BOOST_HAS_RVALUE_REFS
  std::string&& value() const
  {
    return std::move(std::string(this->data(), this->size()));
  }
#else
  std::string value() const
  {
    return std::string(this->data(), this->size());
  }
#endif

By default BOOST_HAS_RVALUE_REFS is defined and attempt to execute method "string_cref_base::value()" throws AccessViolationException.

But when I change code in following way:

//#ifdef BOOST_HAS_RVALUE_REFS
//  std::string&& value() const
//  {
//    return std::move(std::string(this->data(), this->size()));
//  }
//#else
  std::string value() const
  {
    return std::string(this->data(), this->size());
  }
//#endif

method works fine.

I actually don't know what is the meaning of "BOOST_HAS_RVALUE_REFS", but I guess this does not work properly.

I also guess this issue directly relates to issue #19.

Build error - missing tinyxml

$ !2046
git clone https://github.com/objectcomputing/mFAST.git
Initialized empty Git repository in /work/src/mFAST/.git/
remote: Counting objects: 6197, done.
remote: Total 6197 (delta 0), reused 0 (delta 0), pack-reused 6197
Receiving objects: 100% (6197/6197), 2.43 MiB | 2.41 MiB/s, done.
Resolving deltas: 100% (4714/4714), done.
$ cd mFAST
$ mkdir build
$ cd build/
$ ../../e cmake -DCMAKE_INSTALL_PREFIX=/work -DCMAKE_BUILD_TYPE=Release -DBOOST_ROOT=/work -DCMAKE_C_FLAGS="-Wall -O3 -m64 -fPIC" -DCMAKE_CXX_FLAGS="-Wall -O3 -m64 -fPIC -std=gnu++11 -static-libgcc -static-libstdc++" ..
-- The CXX compiler identification is GNU 4.9.3
-- Check for working CXX compiler: /work/bin/g++
-- Check for working CXX compiler: /work/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.58.0
-- Configuring done
CMake Error at src/mfast/xml_parser/CMakeLists.txt:13 (add_library):
Cannot find source file:

/work/src/mFAST/src/mfast/xml_parser/../../../tinyxml2/tinyxml2.cpp

Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx

CMake Warning:
Manually-specified variables were not used by the project:

CMAKE_C_FLAGS

-- Build files have been written to: /work/src/mFAST/build

Unable to build x64

  • too much compile warnings C4267 (conversion, possible loss of data)
  • LNK1112 in fast_type_gen.obj

Missing public decoder reset method

The exchange is sending multicast packets containing a block of 1 or more messages. After decoding all messages in the block, a decoder reset has to be done.
QuickFast has a public reset method for this. Is it planned to add a public reset method to the decoder in mFAST?

value of mandatory string field isn't saved

Data feed starts with "Hello" message, then multiple "Data" messages follow.
All messages have the same header. Template looks as follows:

...
  <template name="T_HEAD" dictionary="template">
    <string name="Field"><copy/></string>
    ...
  </template>

  <template name="Hello" dictionary="template" id="54321">
    <string name="MsgType"><constant value="Ehlo"/></string>
    <group name="Head" presence="optional">
      <templateRef name="T_HEAD"/>
    </group>
    ...
  </template>

  <template name="Data" dictionary="template" id="54322">
    <string name="MsgType"><constant value="Data"/></string>
    <group name="Head" presence="optional">
      <templateRef name="T_HEAD"/>
    </group>
    ...
  </template>
...

On decode side initial "Hello" is processed with no problems, but decode of first "Data" fails:

/home/v/src/mfast-HEAD/src/mfast/coder/decoder/decoder_field_operator.cpp(232): Throw in function void mfast::decoder_detail::copy_or_increment_operator_impl::decode_impl(const T&, mfast::fast_istream&, mfast::decoder_presence_map&) const [with T = mfast::string_mref; Operation = mfast::decoder_detail::null_operation]
Dynamic exception type: boost::exception_detail::clone_implmfast::fast_dynamic_error
std::exception::what: std::exception
[mfast::tag_error_code*] = D5

Encoding absent fields

Hello.
I've found that absent optional fields beeing last in a sequence are not written into buffer during encoding, what makes it impossible to decode them or cause data corruption.
Consider test case below

SCENARIO("EncoderTest")
{
    const mfast::templates_description *desc[1] =
     { fast_templates::description() };
    mfast::fast_encoder enc;
    mfast::fast_decoder dec;
    enc.include(desc);
    dec.include(desc);
    std::vector< char > rawMessage = {
        '\xe0', '\x1b', '\xb8', '\x3', '\x65', '\x35', '\xa6', '\x23', '\x68',
        '\x10', '\x34', '\x6a', '\x9', '\x54', '\x83', '\x82', '\x82', '\xb1',
        '\x53', '\x30', '\x30', '\x30', '\x36', '\x32', '\x39', '\x33', '\x35',
        '\xb0', '\x55', '\x53', '\x44', '\x30', '\x30', '\x30', '\x55', '\x54',
        '\x53', '\x54', '\x4f', '\xcd', '\x3', '\x78', '\xa', '\xfe', '\xfd',
        '\x3', '\x6b', '\xd7', '\x81', '\x7', '\xe1', '\x44', '\x49', '\x5a',
         '\xf1', '\x28', '\x1e', '\xee', '\x43', '\x45', '\x54', '\xd3',
        '\x80', // This byte gets lost
        '\x82', '\xb1', '\x53', '\x30', '\x30', '\x30', '\x36', '\x32', '\x39',
        '\x33', '\x37', '\xb5', '\x55', '\x53', '\x44','\x30', '\x30', '\x30',
        '\x55', '\x54', '\x53', '\x54', '\x4f', '\xcd', '\x3', '\x78', '\xa', '\xff',
        '\xfc', '\x26', '\x34', '\xff', '\x81', '\x1', '\x98', '\x44', '\x49', '\x5a',
        '\xf1', '\x28', '\x1e', '\xee', '\x43', '\x45', '\x54', '\xd3',
        '\x80' // As well as this byte
    };
    const char *rawB = rawMessage.data();
    const char *rawE = rawB + rawMessage.size();
    mfast::message_cref msg = dec.decode(rawB, rawE); // Everything is ok

    std::vector< char > encodeBuf;
    encodeBuf.reserve(1500);
    enc.encode(msg, encodeBuf);

    REQUIRE(encodeBuf.size() == rawMessage.size()); // Fails 108 != 110

    const char *eb = encodeBuf.data();
    const char *ee = eb + encodeBuf.size();
    mfast::message_cref decoded = dec.decode(eb, ee); // Throws std::exception
}

Template for the message

<templates xmlns="http://www.fixprotocol.org/ns/fast/td/1.1">
	<template xmlns="http://www.fixprotocol.org/ns/fast/td/1.1" name="X-OBR-CURR" id="3512">
		<string name="MessageType" id="35">
			<constant value="X"/>
		</string>
		<string name="ApplVerID" id="1128">
			<constant value="9"/>
		</string>
		<string name="BeginString" id="8">
			<constant value="FIXT.1.1"/>
		</string>
		<string name="SenderCompID" id="49">
		<constant value="MOEX"/>
		</string>
		<uInt32 name="MsgSeqNum" id="34"/>
		<uInt64 name="SendingTime" id="52"/>
		<sequence name="GroupMDEntries">
			<length name="NoMDEntries" id="268"/>
			<uInt32 name="MDUpdateAction" id="279" presence="optional"/>
			<string name="MDEntryType" id="269" presence="optional"/>
			<string name="MDEntryID" id="278" presence="optional"/>
			<string name="Symbol" id="55" presence="optional"/>
			<int32 name="RptSeq" id="83" presence="optional"/>
			<decimal name="MDEntryPx" id="270" presence="optional"/>
			<decimal name="MDEntrySize" id="271" presence="optional"/>
			<uInt32 name="MDEntryTime" id="273" presence="optional"/>
			<uInt32 name="OrigTime" id="9412" presence="optional"/>
			<string name="TradingSessionID" id="336" presence="optional"/>
			<string name="TradingSessionSubID" id="625" presence="optional"/>
		</sequence>
	</template>
</templates>

crash while decoding Eurex

Hi,
I've tried to decode some Eurex Messages but it crash at the very first.
I'm using the mf_fixed_decoder on which I've added the generated files.

the message is composed of a header then a reset message (which is not present in the template file) then the messages.
I think Quickfast had added a default template 120, but the problem is not there
I've sjkipped the header (23 bytes) and 2 bytes for the template 120, but after having found a template 93 it crashes

Here are the template.xml the generated files and the test data :
https://drive.google.com/folderview?id=0B-8Io1lLd5gHNllqY1h2SEh5b3M&usp=sharing

failed to compile

Hello,

failed to compile mfast with gcc 6.1.1:
/home/ksergey/dev/astsff/external/mFAST/src/mfast/coder/decoder_v2/fast_decoder_core.h:110:35: error: return-statement with a value, in function returning 'void' [-fpermissive] void get_token() const { return current_token_; } ^~~~~~~~~~~~~~

gcc -v
└─[10:18]$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release Thread model: posix gcc version 6.1.1 20160602 (GCC)

Why ::the_id is not generated for _cref classes?

When I generate header and source files with fast_type_gen I have no nested enum constants "the_id" inside "_cref" classes, but do have them in "value" classes. But according to readme "_cref" classes should contain this field.
Template can be taken from here: ftp://ftp.moex.ru/pub/FAST/ASTS/template/FIX50SP2-ALL.xml

X_OLR_FOND contains the_id, X_OLR_FOND_cref does not. Is it by design and readme is misleading or it is a bug of fast_type_gen?

Deprecated warnings with boost 1.60 and 1.61

The build process generates a ton of warnings with boost 1.60 and 1.61, e.g.:

[ 99%] Building CXX object examples/message_printer/CMakeFiles/message_printer.dir/message_printer.cpp.o
In file included from /opt/pkg/boost/current/include/boost/iostreams/detail/is_dereferenceable.hpp:12:0,
                 from /opt/pkg/boost/current/include/boost/iostreams/detail/resolve.hpp:26,
                 from /opt/pkg/boost/current/include/boost/iostreams/detail/push.hpp:24,
                 from /opt/pkg/boost/current/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from /opt/pkg/boost/current/include/boost/iostreams/stream_buffer.hpp:22,
                 from /opt/pkg/boost/current/include/boost/iostreams/stream.hpp:21,
                 from /tmp/mFAST/src/mfast/decimal_ref.h:21,
                 from /tmp/mFAST/src/mfast.h:8,
                 from /tmp/mFAST/build/examples/message_printer/MDRefreshSample.h:3,
                 from /tmp/mFAST/examples/message_printer/message_printer.cpp:2:
/opt/pkg/boost/current/include/boost/type_traits/detail/bool_trait_def.hpp:18:79: note: #pragma message: NOTE: Use of this header (bool_trait_def.hpp) is deprecated
 # pragma message("NOTE: Use of this header (bool_trait_def.hpp) is deprecated")

error: wrong number of template arguments (11, should be 10)

Hi,

The boost::tuple implementation currently supports tuples with up to 10 elements. The generated code does not compile:

struct templates_description
: mfast::templates_description
{
typedef boost::tuple<EMDPacketHeader,
Beacon,
ProductStateChange,
MassInstrumentStateChange,
InstrumentStateChange,
DepthIncremental,
ComplexInstrumentUpdate,
QuoteRequest,
CrossRequest,
DepthSnapshot,
TopOfBookImplied> types;
templates_description();
static const templates_description* instance();
};

Is there any work around for this limitation in mFAST?

Thanks

message_cref cast problem

Hi!
I've tried to build mf_fixed_decode. Build succeded and code woks fine.
But then I modify file 'fixed_template_test.cpp' from:

mfast::message_cref msg = decoder.decode(first, last, force_reset || first_message ); 

to:

mfast::message_cref msg = decoder.decode(first, last, force_reset || first_message ); 
if (msg.id() == example::MarketData::the_id)
{
   example::MarketData_cref xmsg = static_cast<example::MarketData_cref>(msg);
}

I get a compile error:

error C2440: 'static_cast' : cannot convert from 'mfast::message_cref' to 'example::MarketData_cref'    
error C2512: 'example::MarketData_cref' : no appropriate default constructor available  

Obviously, this is due to the fact that class 'example::MarketData_cref' inherits class 'mfast::aggregate_cref' instead of class 'mfast::message_cref' (as it's shown in documentation).

fast_type_gen's generated code:

class MarketData_cref
  : public mfast::aggregate_cref
{ ... }

and here is documentation:

class MDRefreshSample_cref
: public mfast::message_cref {
// ...
};

What did I do wrong? How to make a correct cast in this case?

building mFAST in scope of other CMake project

Is it possible to add to mFAST include directories in case of building in scope of parent project?

I mean if I write in CMakeLists.txt something like below path to mfast.h automaticaly added to parent project include directories?

add_subdirectoy(deps/mFAST)
...
fasttypegen_target(protocol protocol.xml)
add_executable(parser main.cpp ${FASTTYPEGEN_protocol_OUTPUTS})
target_link_libraries(parser mfast_coder_static mfast_static)

I known it's possible via target_include_directories (https://cmake.org/cmake/help/v3.0/command/target_include_directories.html)

fast_type_gen problem with negative exponent and empty templates

Fast_type_gen fails to process the template with “bad lexical cast” error if exponent copy value < 0:

      <decimal name="MDEntryPx" id="270" presence="optional"> 
             <exponent><copy value="-2"/></exponent> 
             <mantissa><delta/></mantissa>          
      </decimal>  

Fast_tpye_gen fails to process the template with “string too long” error if template has no fields:

 <template name="StandardTrailer">      
      <typeRef name="StandardTrailer"/>
</template>

Possible error in fast_type_gen

There is template from file FIX50SP2_ALL.xml (MOEX):

<template name="0" id="2008" xmlns="http://www.fixprotocol.org/ns/fast/td/1.1">
    <string name="MessageType" id="35"><constant value="0" /></string>
    <string name="BeginString" id="8"><constant value="FIXT.1.1"/></string>
    <string name="SenderCompID" id="49"><constant value="MOEX"/></string>
    <uInt32 name="MsgSeqNum" id="34"><increment/></uInt32>
    <uInt64 name="SendingTime" id="52"><copy/></uInt64>
</template>

fast_type_gen has created FIX50SP2_ALL.cpp with content:
const static field_instruction* _0__subinstructions[] = {
&_0__BeginString_instruction,
&_0__MessageType_instruction,
&_0__SenderCompID_instruction,
&_0__MsgSeqNum_instruction,
&_0__SendingTime_instruction,
};

It leads to the bug: when we invoke get_MessageType(), we've got BeginString instead of MessageType

Is this a bug, or am I doing something wrong?
Thank you (and sorry for my bad english).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.