2020-05-01 18:31:02 +02:00
/**
2020-05-02 22:06:47 +02:00
* @ file reHDD . h
* @ brief represent
* @ author hendrik schutter
* @ date 01.05 .2020
2020-05-01 18:31:02 +02:00
*/
2020-05-02 22:06:47 +02:00
# ifndef REHDD_H_
# define REHDD_H_
2020-08-04 19:51:34 +02:00
# define DRYRUN
2020-05-02 22:06:47 +02:00
# include <iostream>
# include <string>
# include <fstream>
# include <tuple>
# include <vector>
2020-05-03 17:17:20 +02:00
# include <time.h>
# include <chrono>
2020-08-03 22:40:07 +02:00
# include <curses.h>
2020-08-04 17:18:32 +02:00
# include <thread>
2020-08-03 22:40:07 +02:00
# include <unistd.h>
2020-08-04 11:59:45 +02:00
# include <mutex>
# include <sys/select.h>
2020-08-04 17:18:32 +02:00
# include <algorithm>
2020-08-04 22:35:29 +02:00
# include <cstring>
2020-08-04 11:59:45 +02:00
2020-05-02 22:06:47 +02:00
using namespace std ;
2020-05-01 18:31:02 +02:00
# include "drive.h"
2020-05-02 00:49:11 +02:00
# include "smart.h"
2020-05-03 17:17:20 +02:00
# include "wipe.h"
2020-08-04 22:35:29 +02:00
# include "tui.h"
2020-05-01 18:31:02 +02:00
2020-05-02 22:06:47 +02:00
template < typename T , typename I > T * iterator_to_pointer ( I i )
2020-05-02 17:15:55 +02:00
{
return ( & ( * i ) ) ;
}
2020-08-04 11:59:45 +02:00
2020-05-02 22:06:47 +02:00
class reHDD
2020-05-02 17:15:55 +02:00
{
2020-05-01 18:31:02 +02:00
protected :
public :
2020-05-02 22:06:47 +02:00
reHDD ( void ) ;
2020-05-01 18:31:02 +02:00
void app_logic ( ) ;
private :
2020-08-04 17:18:32 +02:00
static void searchDrives ( vector < Drive > * pvecDrives ) ;
2020-08-04 11:59:45 +02:00
static void printDrives ( vector < Drive > * pvecDrives ) ;
2020-08-04 17:18:32 +02:00
static void filterIgnoredDrives ( vector < Drive > * pvecDrives ) ;
2020-08-04 11:59:45 +02:00
static void addSMARTData ( vector < Drive > * pvecDrives ) ;
static void ThreadScannDevices ( ) ;
2020-08-07 12:07:29 +02:00
static void ThreadUserInput ( ) ;
static void handleArrowKey ( TUI : : UserInput userInput ) ;
static void filterNewDrives ( vector < Drive > * pvecOldDrives , vector < Drive > * pvecNewDrives ) ;
2020-08-03 22:40:07 +02:00
2020-05-01 18:31:02 +02:00
} ;
2020-05-02 22:06:47 +02:00
# endif // REHDD_H_