Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hexcode Generation #83

Open
kishans12 opened this issue Oct 19, 2018 · 3 comments
Open

Hexcode Generation #83

kishans12 opened this issue Oct 19, 2018 · 3 comments

Comments

@kishans12
Copy link

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

@huangminghuang
Copy link
Contributor

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

@kishans12
Copy link
Author

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

@kishans12
Copy link
Author

kishans12 commented Oct 25, 2018

#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????

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants