Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
context.hh
Go to the documentation of this file.
1 #pragma once
2 #include "settings.hh"
3 #include "logger.hh"
4 #include "histogram.hh"
5 
6 #include <boost/asio.hpp>
7 #include <string>
8 #include <vector>
9 #include <thread>
10 
11 class Context {
12  public:
13  boost::asio::io_service io;
14  std::unique_ptr<Logger, decltype(&Logger::disconnect)>
17  std::unique_ptr<Histogram> histogram;
18  int id;
19 
20  void run ();
21  bool join ();
22 
23  static Context* singleton;
24  static Context* connect(std::string);
25  static Context* connect();
26 
27  protected:
28  Context(std::string);
29  Context();
30  ~Context();
31 
32  void init();
33  std::vector<std::unique_ptr<std::thread>> threads;
34  boost::asio::io_service::work work;
35 };
std::vector< std::unique_ptr< std::thread > > threads
Definition: context.hh:33
boost::asio::io_service io
Definition: context.hh:13
Definition: context.hh:11
static Context * singleton
Definition: context.hh:23
void init()
Definition: context.cc:71
~Context()
Definition: context.cc:42
std::unique_ptr< Histogram > histogram
Definition: context.hh:17
Settings settings
Definition: context.hh:16
static void disconnect(Logger *)
Definition: logger.cc:42
This is the implementation file of Settings.
Definition: settings.hh:44
Context()
Definition: context.cc:38
std::unique_ptr< Logger, decltype(&Logger::disconnect)> logger
Definition: context.hh:15
bool join()
Definition: context.cc:65
void run()
Definition: context.cc:46
static Context * connect()
Definition: context.cc:24
boost::asio::io_service::work work
Definition: context.hh:34
int id
Definition: context.hh:18