Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
gui.cpp File Reference
#include "gui.hpp"
#include "structs.hpp"
#include "version.hpp"
#include <boost/bind.hpp>
#include <sys/ioctl.h>
#include <boost/ref.hpp>
#include <sstream>
#include <fstream>

Go to the source code of this file.

Classes

class  gui::domid_comparator
 
class  gui::last_view_comparator
 
class  gui::hit_rate_comparator
 
class  gui::run_number_comparator
 
class  gui::name_comparator
 
class  gui::match_comparator
 

Namespaces

namespace  gui
 

Functions

bool ischar (int key)
 
void async_commit (boost::asio::deadline_timer &timer, gui::Screen &screen, boost::system::error_code const &error)
 
void async_cin (boost::asio::posix::stream_descriptor &keyb, char &key, gui::Screen &screen, const boost::system::error_code &error, std::size_t bytes_transferred)
 
void async_win_resize (boost::asio::signal_set &window_resize, gui::Screen &screen, boost::system::error_code const &error, int signum)
 
std::pair< int, int > window_size ()
 
bool gui::is_problematic (mon_channel const &channel)
 
bool gui::matches (mon_channel const &ch, std::string const &pattern)
 
bool gui::matches (mon_channel const &ch, boost::regex const &regex)
 
void gui::print_table_head (WINDOW *win, int offset)
 
void gui::print_chan (WINDOW *win, ChList::const_iterator const &it, std::vector< char > &buffer, int line_size, int offset, bool highlight)
 
void gui::print_timestamp (WINDOW *win, UTCTime const &tstamp, std::vector< char > &buffer, int line_size, int offset, bool validity)
 

Variables

static const int default_hit_counter_threshold = 850
 

Function Documentation

◆ ischar()

bool ischar ( int key)
inline

Definition at line 43 of file gui.cpp.

44{
45 return
46 key >= std::numeric_limits<char>::min()
47 && key <= std::numeric_limits<char>::max();
48}

◆ async_commit()

void async_commit ( boost::asio::deadline_timer & timer,
gui::Screen & screen,
boost::system::error_code const & error )

Definition at line 50 of file gui.cpp.

54{
55 if (!error) {
56 screen.commit();
57
58 timer.expires_from_now(boost::posix_time::seconds(1));
59 timer.async_wait(
60 boost::bind(
62 boost::ref(timer),
63 boost::ref(screen),
64 boost::asio::placeholders::error));
65 }
66}
void async_commit(boost::asio::deadline_timer &timer, gui::Screen &screen, boost::system::error_code const &error)
Definition gui.cpp:50

◆ async_cin()

void async_cin ( boost::asio::posix::stream_descriptor & keyb,
char & key,
gui::Screen & screen,
const boost::system::error_code & error,
std::size_t bytes_transferred )

Definition at line 68 of file gui.cpp.

74{
75 if (!error) {
76 int k = key;
77
78 if (key == 27) {
79 boost::asio::posix::stream_descriptor::bytes_readable command(true);
80 keyb.io_control(command);
81
82 std::size_t nbytes = command.get();
83
84 while (nbytes--) {
85 boost::system::error_code ec;
86 keyb.read_some(boost::asio::buffer(&key, sizeof(key)), ec);
87 k <<= 8;
88 k += key;
89 }
90 }
91
92 screen.elaborate(k);
93
94 keyb.async_read_some(
95 boost::asio::buffer(&key, sizeof(key)),
96 boost::bind(
98 boost::ref(keyb),
99 boost::ref(key),
100 boost::ref(screen),
101 boost::asio::placeholders::error,
102 boost::asio::placeholders::bytes_transferred));
103 }
104}
void async_cin(boost::asio::posix::stream_descriptor &keyb, char &key, gui::Screen &screen, const boost::system::error_code &error, std::size_t bytes_transferred)
Definition gui.cpp:68

◆ async_win_resize()

void async_win_resize ( boost::asio::signal_set & window_resize,
gui::Screen & screen,
boost::system::error_code const & error,
int signum )

Definition at line 106 of file gui.cpp.

111{
112 if (!error) {
113 std::pair<int, int> const win_size = window_size();
114
115 screen.resize(win_size.first, win_size.second);
116
117 window_resize.async_wait(
118 boost::bind(
120 boost::ref(window_resize),
121 boost::ref(screen),
122 boost::asio::placeholders::error,
123 boost::asio::placeholders::signal_number));
124 }
125}
void async_win_resize(boost::asio::signal_set &window_resize, gui::Screen &screen, boost::system::error_code const &error, int signum)
Definition gui.cpp:106
std::pair< int, int > window_size()
Definition gui.cpp:127

◆ window_size()

std::pair< int, int > window_size ( )

Definition at line 127 of file gui.cpp.

128{
129 winsize sz;
130
131 ioctl(0, TIOCGWINSZ, &sz);
132
133 return std::make_pair(sz.ws_row, sz.ws_col);
134}

Variable Documentation

◆ default_hit_counter_threshold

const int default_hit_counter_threshold = 850
static
Author
cpellegrino

Definition at line 15 of file gui.cpp.