Allolib  1.0
C++ Components For Interactive Multimedia
al_ConsoleDomain.hpp
1 #ifndef CONSOLEDOMAIN_H
2 #define CONSOLEDOMAIN_H
3 
4 #include <chrono>
5 #include <iostream>
6 #include <string>
7 
8 #include "al_ComputationDomain.hpp"
9 
10 namespace al {
11 
22 public:
23  bool init(ComputationDomain *parent = nullptr) override { return true; }
24 
25  bool start() override {
26  std::string line;
27  do {
28  std::getline(std::cin, line);
29  } while (onLine(line));
30  return true;
31  }
32 
33  bool stop() override { return true; }
34 
35  bool cleanup(ComputationDomain *parent = nullptr) override { return true; }
36 
37  std::function<bool(const std::string &)> onLine =
38  [](const std::string &line) {
39  if (line.size() == 0) {
40  return false;
41  }
42  return true;
43  };
44 
45 private:
46 };
47 
48 } // namespace al
49 
50 #endif // CONSOLEDOMAIN_H
ComputationDomain class.
ConsoleDomain class.
bool cleanup(ComputationDomain *parent=nullptr) override
cleanup
bool init(ComputationDomain *parent=nullptr) override
initialize
bool start() override
start the asyncrhonous execution of the domain
bool stop() override
stop the asyncrhonous execution of the domain
Definition: al_App.hpp:23