mFAST icon indicating copy to clipboard operation
mFAST copied to clipboard

Hexcode Generation

Open kishans12 opened this issue 6 years ago • 3 comments

Is it necessary to Convert feed to Hex code?? if Yes then how can i achieve in C++ or Managed C++ because decoder fails when I convert feed to Hex code. where as if i hard code it in a char array it works. My converted and hard coded hex code are same yet it fails??? Any Help Would be appreciated. Thanking in Advance

kishans12 avatar Oct 19 '18 11:10 kishans12

Not sure why you think Hexcode is necessary. You can follow the code in "examples/performance_test" to read your feed data from file.

huangminghuang avatar Oct 19 '18 14:10 huangminghuang

How can I directly read by connecting to Exchange? It would be Great if you can share a Code. Thanking in advance.

kishans12 avatar Oct 23 '18 06:10 kishans12

#include using namespace std;

#include #include <mfast.h> #include <mfast/coder/fast_decoder_v2.h> #include <mfast/coder/fast_decoder.h> #include <mfast/json/json.h> #include <mfast/xml_parser/dynamic_templates_description.h>

#include"FastGWMsgConfig.h"

using std::string; using std::ostringstream; using std::cout; using std::endl;

using mfast::templates_description; using mfast::dynamic_templates_description; using mfast::fast_decoder; using mfast::message_cref; using mfast::ascii_string_cref; using mfast::json::encode;

int main() {

std::size_t head_n = (std::numeric_limits<std::size_t>::max)();
std::size_t repeat_count = 1;
bool force_reset = true;
std::size_t skip_header_bytes = 4;;
//const char* filename = DATA_FILE;

std::string str = "Ýÿ”20181009-06:49:09.66±±_jÏ€€€‚_À€ôCOCUDAKL20DEC201¸2972³ø__2?IÁ€€€€€€€s•€€€€€€€€€€“ö€‚_ ";

std::vector<char> message_contents(str.begin(), str.end());
mfast::malloc_allocator malloc_allc;
mfast::allocator* alloc = &malloc_allc;
const mfast::templates_description* descriptions = { FastGWMsgConfig::description() };
mfast::fast_decoder_v2<0> decoder(FastGWMsgConfig::description());

mfast::message_type msg_value;

for (std::size_t j = 0; j < repeat_count; ++j) 
{

	const char*first = &message_contents[0] + skip_header_bytes;
	const char*last = &message_contents[0] + message_contents.size();
	bool first_message = true;

	while (first < last) 
	{
		cout << "decoder" << endl;
		mfast::message_cref msg =decoder.decode(first, last, force_reset || first_message);
		first_message = false;
		first += skip_header_bytes;
	}
}
return 0;

} After your suggestion i have written this code but still my decoder.decode is failing any reason why it is failing????

kishans12 avatar Oct 25 '18 11:10 kishans12