CppBenchmark  1.0.4.0
C++ Benchmark Library
benchmark.h
Go to the documentation of this file.
1 
9 #ifndef CPPBENCHMARK_BENCHMARK_H
10 #define CPPBENCHMARK_BENCHMARK_H
11 
13 #include "benchmark/fixture.h"
14 
15 namespace CppBenchmark {
16 
18 
21 class Benchmark : public BenchmarkBase, public virtual Fixture
22 {
23 public:
26 
28 
32  template<typename... Types>
33  explicit Benchmark(const std::string& name, Types... settings) : Benchmark(name, TSettings(settings...)) {}
35 
39  explicit Benchmark(const std::string& name, const TSettings& settings) : BenchmarkBase(name, settings) {}
40  Benchmark(const Benchmark&) = delete;
41  Benchmark(Benchmark&&) = delete;
42  virtual ~Benchmark() = default;
43 
44  Benchmark& operator=(const Benchmark&) = delete;
46 
47 protected:
49 
54  virtual void Run(Context& context) = 0;
55 
56 private:
57  int CountLaunches() const override;
58  void Launch(int& current, int total, LauncherHandler& handler) override;
59 };
60 
69 } // namespace CppBenchmark
70 
71 #endif // CPPBENCHMARK_BENCHMARK_H
Benchmark base definition.
Benchmark base class.
const Settings & settings() const
Get benchmark settings.
const std::string & name() const
Get benchmark name.
Benchmark class.
Definition: benchmark.h:22
Benchmark & operator=(Benchmark &&)=delete
Benchmark & operator=(const Benchmark &)=delete
Settings TSettings
Benchmark settings type.
Definition: benchmark.h:25
Benchmark(const std::string &name, Types... settings)
Default class constructor.
Definition: benchmark.h:33
Benchmark(const std::string &name, const TSettings &settings)
Alternative class constructor.
Definition: benchmark.h:39
virtual ~Benchmark()=default
virtual void Run(Context &context)=0
Benchmark run method.
Benchmark(const Benchmark &)=delete
Benchmark(Benchmark &&)=delete
Benchmark running context.
Definition: context.h:27
Benchmark fixture.
Definition: fixture.h:21
Benchmark settings.
Definition: settings.h:32
Benchmark fixture definition.
C++ Benchmark project definitions.
Definition: barrier.h:15