plebble
screen.h
Go to the documentation of this file.
1 /*
2 -------------------------------------------------------------------------------
3  PLEBBLE
4 -------------------------------------------------------------------------------
5  Copyright (C) 2019-2020 KATLAS Technology. (http://katlastechnology.com)
6  Copyright (C) 2017-2020 Marcos Mayorga. (mm@mm-studios.com)
7 
8  This file is part of our Plebble(R) Platform.
9 
10  The code below cannot be copied, used for any purpose other than the one
11  agreed and/or distributed without the express permission of
12  KATLAS Technology.
13 -------------------------------------------------------------------------------
14 
15 
16 */
17 #ifndef USGOV_0a448173a2a4373ab86447e22fa8ad11af4716ae1fcfed1696134b3e18a3bf7f
18 #define USGOV_0a448173a2a4373ab86447e22fa8ad11af4716ae1fcfed1696134b3e18a3bf7f
19 
20 #include <iostream>
21 #include <mutex>
22 #include <condition_variable>
24 #include <us/gov/bgtask.h>
25 
26 namespace us{ namespace gov {
27 namespace io {
28 using namespace std;
29 
30  struct screen {
33 
34  screen(ostream&os);
35  /*
36  template<typename t>
37  void println(const t& o);
38  lock_guard<mutex mx> lock(mx);
39  os << o << endl;
40  }
41  template<typename t>
42  void print(const t& o);
43  lock_guard<mutex mx> lock(mx);
44  os << o;
45  }
46 
47  void flush() {
48  lock_guard<mutex mx> lock(mx);
49  os.flush();
50  }
51  */
52  int getch();
53  int getche();
54  void print_prompt();
55 
56  struct supervisor {
57  virtual ~supervisor() {}
58  virtual bool is_active() const=0;
59  };
60 
61  string capture_input(const supervisor&, unique_lock<mutex>& lock);
62 
63  string line;
64  bool capturing{false};
65  hash_t prompt{0};
66  ostream&os;
67  mutex mx;
68  //condition_variable cv_print_prompt;
69  //bool prompted{false};
70  };
71 
72 }
73 }}
74 
75 #endif
bgtask.h
us::gov::io::screen::supervisor::~supervisor
virtual ~supervisor()
Definition: screen.h:57
us::gov::io::screen::screen
screen(ostream &os)
screen.h
us
Definition: daemon.h:22
us::gov::crypto::ripemd160::value_type
Definition: ripemd160.h:38
c
us::gov::io::screen c
Definition: screen.cpp:25
us::gov::io::screen::mx
mutex mx
Definition: screen.h:67
us::gov::io::screen::capture_input
string capture_input(const supervisor &, unique_lock< mutex > &lock)
us::gov::io::screen
Definition: screen.h:30
us::gov::io::screen::hasher_t
us::gov::crypto::ripemd160 hasher_t
Definition: screen.h:31
us::gov::io::screen::print_prompt
void print_prompt()
us::gov
Definition: daemon.h:22
us::gov::io::screen::supervisor::is_active
virtual bool is_active() const =0
us::gov::io::screen::os
ostream & os
Definition: screen.h:66
us::gov::crypto::ripemd160
Definition: ripemd160.h:34
ripemd160.h
c
Definition: client.cpp:417
std
Definition: app.h:380
us::gov::io::screen::getche
int getche()
us::gov::io::screen::hash_t
hasher_t::value_type hash_t
Definition: screen.h:32
gov.h
us::gov::io::screen::line
string line
Definition: screen.h:63
us::gov::io::screen::getch
int getch()
log
#define log
Definition: gov.h:83
us::gov::io::screen::supervisor
Definition: screen.h:56