xref: /aosp_15_r20/external/flatbuffers/benchmarks/cpp/bench.h (revision 890232f25432b36107d06881e0a25aaa6b473652)
1 #ifndef BENCHMARKS_CPP_BENCH_H_
2 #define BENCHMARKS_CPP_BENCH_H_
3 
4 #include <cstdint>
5 
6 struct Bench {
~BenchBench7   virtual ~Bench() {}
8 
AddBench9   inline void Add(int64_t value) { sum += value; }
10 
11   virtual uint8_t *Encode(void *buf, int64_t &len) = 0;
12   virtual void *Decode(void *buf, int64_t len) = 0;
13   virtual int64_t Use(void *decoded) = 0;
14   virtual void Dealloc(void *decoded) = 0;
15 
16   int64_t sum = 0;
17 };
18 
19 #endif // BENCHMARKS_CPP_BENCH_H_