AFF3CT
A Fast Forward Error Correction Tool!
 All Classes Files Functions Variables Pages
Simulation.hpp
Go to the documentation of this file.
1 
8 #ifndef SIMULATION_HPP_
9 #define SIMULATION_HPP_
10 
11 #include "Tools/Display/bash_tools.h"
12 
19 {
20 public:
25  {
26  }
27 
31  virtual ~Simulation()
32  {
33  }
34 
38  virtual void launch() = 0;
39 
40 protected:
48  static void check_errors(void *ptr, std::string str, const int tid = 0)
49  {
50  if (ptr == nullptr)
51  {
52  std::cerr << bold_red("(EE) Something went wrong during the \"")
53  << bold_red(str)
54  << bold_red("\" instantiation (tid = ")
55  << bold_red(std::to_string(tid))
56  << bold_red("), exiting.")
57  << std::endl;
58 
59  exit(EXIT_FAILURE);
60  }
61  }
62 };
63 
64 #endif /* SIMULATION_HPP_ */
virtual void launch()=0
This method has to be overloaded, this is the start point of the Simulation.
Definition: Simulation.hpp:18
static void check_errors(void *ptr, std::string str, const int tid=0)
Checks if a pointer has been allocated or not, if not the program stop with an error message...
Definition: Simulation.hpp:48
virtual ~Simulation()
Destructor.
Definition: Simulation.hpp:31
Simulation()
Constructor.
Definition: Simulation.hpp:24