GitHub PullRequestReviewCommentEvent at 2014-04-30 08:39:49
Repository: cpp_craft_0314
Actor: PavelNik
Payload: {"comment":{"url":"https://api.github.com/repos/marozau/cpp_craft_0314/pulls/comments/12133428","id":12133428,"diff_hunk":"@@ -0,0 +1,60 @@\n+#include \"market_message.h\"\n+#include <fstream>\n+#include <map>\n+#include <iostream>\n+\n+int main()\n+{\n+\tstd::ifstream in( BINARY_DIR \"/input.txt\", std::ios::binary );\n+\tif ( !in.is_open() )\n+\t\treturn 1;\n+\t\n+\ttypedef std::map < boost::uint32_t, size_t > type_map;\n+\n+\tconst size_t memory = 2048;\n+\tsize_t current = 0;\n+\ttype_map type_size, type_count, type_last, type_different;\n+\n+\twhile( !in.eof() )\n+\t{\n+\t\tbinary_reader::market_message temp( in );\n+\n+\t\tif( in.eof() )\n+\t\t\tbreak;\n+\n+\t\tif( temp.time() != current )\n+\t\t{\n+\t\t\ttype_size.clear();\n+\t\t\tcurrent = temp.time();\n+\t\t}\n+\n+\t\tif( ( type_size[temp.type()] + temp.size() ) <= memory )\n+\t\t{\n+\t\t\ttype_size[temp.type()] += temp.size();\n+\t\t\t++type_count[temp.type()];\n+\t\t}\n+\n+\t\tif( ( type_last.count( temp.type() ) == 0 ) || ( type_last[temp.type()] != current ) )\n+\t\t{\n+\t\t\ttype_last[temp.type()] = current;\n+\t\t\t++type_different[temp.type()];\n+\t\t}\n+\t}\t\n+\tin.close();\n+\t\n+\tstd::ofstream out( BINARY_DIR \"/output.txt\", std::ios::binary );\n+\tif ( !out.is_open() )\n+\t\treturn 1;\n+\n+\tfor( type_map::const_iterator it = type_count.begin(); it != type_count.end(); it++ )\n+\t{\n+\t\tconst double count = static_cast< double > ( ( it->second ) / type_different[it->first] );\n+\t\tboost::uint32_t type = it->first;","path":"solutions/denis_sychou/2/sources/2_5/small_buffer.cpp","position":52,"original_position":52,"commit_id":"ec142ba92e0efd1f642bc3d741bdf661bb0e5388","original_commit_id":"ec142ba92e0efd1f642bc3d741bdf661bb0e5388","user":{"login":"PavelNik","id":2005360,"avatar_url":"https://avatars.githubusercontent.com/u/2005360?","gravatar_id":"1946c046640c9d42812a86ff71e8773c","url":"https://api.github.com/users/PavelNik","html_url":"https://github.com/PavelNik","followers_url":"https://api.github.com/users/PavelNik/followers","following_url":"https://api.github.com/users/PavelNik/following{/other_user}","gists_url":"https://api.github.com/users/PavelNik/gists{/gist_id}","starred_url":"https://api.github.com/users/PavelNik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PavelNik/subscriptions","organizations_url":"https://api.github.com/users/PavelNik/orgs","repos_url":"https://api.github.com/users/PavelNik/repos","events_url":"https://api.github.com/users/PavelNik/events{/privacy}","received_events_url":"https://api.github.com/users/PavelNik/received_events","type":"User","site_admin":false},"body":"const boost::uint32_t type","created_at":"2014-04-30T08:39:49Z","updated_at":"2014-04-30T08:39:49Z","html_url":"https://github.com/marozau/cpp_craft_0314/pull/235#discussion_r12133428","pull_request_url":"https://api.github.com/repos/marozau/cpp_craft_0314/pulls/235","_links":{"self":{"href":"https://api.github.com/repos/marozau/cpp_craft_0314/pulls/comments/12133428"},"html":{"href":"https://github.com/marozau/cpp_craft_0314/pull/235#discussion_r12133428"},"pull_request":{"href":"https://api.github.com/repos/marozau/cpp_craft_0314/pulls/235"}}}}