summaryrefslogtreecommitdiff
path: root/benchmarks/parsetostruct.proto2_compiled.cc
blob: 4091ed0a3a7d25eed6080ad9a9c9f20bb175e13b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

#include "main.c"
#include MESSAGE_HFILE
#include <string>
#include <iostream>
#include <sstream>
#include <fstream>

static std::string str;
MESSAGE_CIDENT msg[NUM_MESSAGES];

static bool initialize()
{
  /* Read the message data itself. */
  std::ifstream stream(MESSAGE_FILE);
  if(!stream.is_open()) {
    fprintf(stderr, "Error opening " MESSAGE_FILE ".\n");
    return false;
  }
  std::stringstream stringstream;
  stringstream << stream.rdbuf();
  str = stringstream.str();
  return true;
}

static void cleanup()
{
}

static size_t run(int i)
{
  if(!msg[i%NUM_MESSAGES].ParseFromString(str)) {
    fprintf(stderr, "Error parsing with proto2.\n");
    return 0;
  }
  return str.size();
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback