rtop
columns.h
Go to the documentation of this file.
1 #include <string>
2 #include <vector>
3 
4 #ifndef _COLUMNS_H_
5 #define _COLUMNS_H_
6 #include "rtop_logger.h"
7 #include "proc_info.h"
8 #include "screen2.h"
9 
10 extern src::severity_logger<severity_level> lg;
11 extern logSpacer log_spacer;
12 
13 namespace rtop
14 {
16  class Columns
17  {
18  private:
19  int uuid;
27  std::vector<int> proc_views;
28  public:
30  Columns(int);
32  void markPid();
34  void read();
36  void set(std::vector<int>);
37  friend class XMLTree;
38  };
39 
40 
41  Columns::Columns(int id): uuid{id}
42  {
43  }
44 
46  {
48  BOOST_LOG_SEV(lg, debug)<<log_spacer<<"--> Columns-"<<uuid<<"_markPid::";
49  BOOST_LOG_SEV(lg, debug)<<log_spacer<<"<-- Columns-"<<uuid<<"_markPid::";
51  }
52 
53  void Columns::set(std::vector<int> proc_views_uuids)
54  {
56  BOOST_LOG_SEV(lg, debug)<<log_spacer<<"--> Columns-"<<uuid<<"_set::";
57  proc_views.clear();
58  proc_views.shrink_to_fit();
59  for(auto elm: proc_views_uuids)
60  proc_views.push_back(elm);
61  BOOST_LOG_SEV(lg, debug)<<log_spacer<<"<-- Columns-"<<uuid<<"_set::";
63  }
64 
66  {
68  BOOST_LOG_SEV(lg, debug)<<log_spacer<<"--> Columns-"<<uuid<<"_read::";
69  int curr_view = pscreen->CurrentView(); // get current view's uuids
70  for(auto view: proc_views)
71  {
72  if (view == curr_view) // if curr_view contains processviewpanel, update once
73  {
74  std::vector<std::string> properties = proc_view->displayedKeys(); // parse property keys on display in ProcViewPanel
75  std::string sort_key = proc_view->sortKey(); // parse sortkey currently set in ProcViewPanel
76  p_procinfo->update(properties, sort_key); // update ProcDb
77  break;
78  }
79  }
80  BOOST_LOG_SEV(lg, debug)<<log_spacer<<"<-- Columns-"<<uuid<<"_read::";
82  }
83 
84 } // namespace rtop
85 #endif // _COLUMNS_H_
void read()
invokes ProcDb update based on properties currently on display in ProcViewPanel
Definition: columns.h:65
std::string sortKey() const
called by Column::read. returns property name to be used as sort key
Definition: panel2.h:982
std::vector< int > proc_views
list of View class object uuids
Definition: columns.h:27
ProcInfo * p_procinfo
pointer to ProcInfo object
Definition: columns.h:23
std::vector< std::string > displayedKeys() const
called by Column::read. return vector of property names currently being displayed
Definition: panel2.h:996
panel data structure responsible for displaying of property values for all live processes.
Definition: panel2.h:915
void delSpace()
deletes one white-space from white-space string corresponding to invoking thread
Definition: rtop_logger.h:151
Columns(int)
Columns constructor. Initializes Columns object with provided unique identifier.
Definition: columns.h:41
void addSpace()
adds one white-space to white-space string corresponding to invoking thread
Definition: rtop_logger.h:135
Top Level UI object. Responsible to switching between views and capturing key input.
Definition: screen2.h:34
int CurrentView() const
Definition: screen2.h:42
src::severity_logger< severity_level > lg
Definition: rtop_logger.h:108
ScreenManager * pscreen
pointer to ScreenManager object
Definition: columns.h:21
enables indentation of logs for easy viewing
Definition: rtop_logger.h:118
ProcViewPanel * proc_view
pointer to ProcViewPanel object
Definition: columns.h:25
interfaces with linux API to read process information and update ProcDb with it
Definition: proc_info.h:24
logSpacer log_spacer
Definition: rtop_logger.h:186
void update(std::vector< std::string > &prop_vec, std::string sort_key)
invoked by Columns::read. reads process prop values, sorts them and then updates ProcDb
Definition: proc_info.h:51
parses config file
Definition: fileio.h:28
void set(std::vector< int >)
sets view uuids.
Definition: columns.h:53
Definition: action.h:7
void markPid()
Definition: columns.h:45
responsible for managing the flow of information between ProcViewPanel, ProcDb and ProcInfo
Definition: columns.h:16