CIO Class Reference
List of all members.
|
Public Member Functions |
| CIO () |
| CIO (const CIO &orig) |
void | set_loglevel (EMessageType level) |
EMessageType | get_loglevel () const |
bool | get_show_progress () const |
void | message (EMessageType prio, const char *fmt,...) const |
void | progress (float64_t current_val, float64_t min_val=0.0, float64_t max_val=1.0, int32_t decimals=1, const char *prefix="PROGRESS:\t") |
void | absolute_progress (float64_t current_val, float64_t val, float64_t min_val=0.0, float64_t max_val=1.0, int32_t decimals=1, const char *prefix="PROGRESS:\t") |
void | done () |
void | not_implemented () const |
void | buffered_message (EMessageType prio, const char *fmt,...) const |
FILE * | get_target () const |
void | set_target (FILE *target) |
void | set_target_to_stderr () |
void | set_target_to_stdout () |
void | enable_progress () |
void | disable_progress () |
void | set_dirname (const char *dirname) |
Static Public Member Functions |
static char * | skip_spaces (char *str) |
static char * | skip_blanks (char *str) |
static char * | concat_filename (const char *filename) |
static int | filter (CONST_DIRENT_T *d) |
Protected Member Functions |
const char * | get_msg_intro (EMessageType prio) const |
Protected Attributes |
FILE * | target |
int64_t | last_progress_time |
int64_t | progress_start_time |
float64_t | last_progress |
bool | show_progress |
EMessageType | loglevel |
Static Protected Attributes |
static const EMessageType | levels [NUM_LOG_LEVELS] = {M_DEBUG, M_INFO, M_NOTICE, M_WARN, M_ERROR, M_CRITICAL, M_ALERT, M_EMERGENCY, M_MESSAGEONLY} |
static const char * | message_strings [NUM_LOG_LEVELS] = {"[DEBUG] ", "[INFO] ", "[NOTICE] ", "\033[1;34m[WARN]\033[0m ", "\033[1;31m[ERROR]\033[0m ", "[CRITICAL] ", "[ALERT] ", "[EMERGENCY] ", ""} |
Detailed Description
Class IO, used to do input output operations throughout shogun, i.e. any debug or error or progress message is passed through the functions of this class to be in the end written to the screen. Note that messages don't have to be written to stdout or stderr, but can be redirected to a file.
Definition at line 101 of file io.h.
Constructor & Destructor Documentation
default constructor
Definition at line 44 of file io.cpp.
CIO::CIO |
( |
const CIO & |
orig |
) |
|
copy constructor
Definition at line 50 of file io.cpp.
Member Function Documentation
print absolute progress bar
- Parameters:
-
| current_val | current value |
| val | value |
| min_val | minimum value |
| max_val | maximum value |
| decimals | decimals |
| prefix | message prefix |
Definition at line 215 of file io.cpp.
void CIO::buffered_message |
( |
EMessageType |
prio, |
|
|
const char * |
fmt, |
|
|
|
... | |
|
) |
| | const |
print a buffered message
- Parameters:
-
| prio | message priority |
| fmt | format string |
Definition at line 150 of file io.cpp.
char * CIO::concat_filename |
( |
const char * |
filename |
) |
[static] |
concatenate directory and filename ( non thread safe )
- Parameters:
-
- Returns:
- concatenated directory and filename
Definition at line 339 of file io.cpp.
void CIO::disable_progress |
( |
|
) |
|
disable progress bar
Definition at line 231 of file io.h.
print 'done' with priority INFO, but only if progress bar is enabled
Definition at line 267 of file io.cpp.
void CIO::enable_progress |
( |
|
) |
|
enable progress bar
Definition at line 216 of file io.h.
int CIO::filter |
( |
CONST_DIRENT_T * |
d |
) |
[static] |
filter
- Parameters:
-
- Returns:
- if filtering was successful
Definition at line 346 of file io.cpp.
get loglevel
- Returns:
- level of log messages
Definition at line 303 of file io.cpp.
const char * CIO::get_msg_intro |
( |
EMessageType |
prio |
) |
const [protected] |
get message intro
- Parameters:
-
- Returns:
- message intro or NULL if message is not to be printed
Definition at line 323 of file io.cpp.
bool CIO::get_show_progress |
( |
|
) |
const |
get show_progress
- Returns:
- if progress bar is shown
Definition at line 313 of file io.cpp.
FILE* CIO::get_target |
( |
|
) |
const |
get target
- Returns:
- file descriptor for target
Definition at line 198 of file io.h.
void CIO::message |
( |
EMessageType |
prio, |
|
|
const char * |
fmt, |
|
|
|
... | |
|
) |
| | const |
print a message
- Parameters:
-
| prio | message priority |
| fmt | format string |
Definition at line 57 of file io.cpp.
void CIO::not_implemented |
( |
|
) |
const |
print error message 'not implemented'
Definition at line 168 of file io.h.
void CIO::progress |
( |
float64_t |
current_val, |
|
|
float64_t |
min_val = 0.0 , |
|
|
float64_t |
max_val = 1.0 , |
|
|
int32_t |
decimals = 1 , |
|
|
const char * |
prefix = "PROGRESS:\t" | |
|
) |
| | |
print progress bar
- Parameters:
-
| current_val | current value |
| min_val | minimum value |
| max_val | maximum value |
| decimals | decimals |
| prefix | message prefix |
Definition at line 163 of file io.cpp.
void CIO::set_dirname |
( |
const char * |
dirname |
) |
|
set directory name
- Parameters:
-
| dirname | new directory name |
Definition at line 249 of file io.h.
set loglevel
- Parameters:
-
| level | level of log messages |
Definition at line 308 of file io.cpp.
void CIO::set_target |
( |
FILE * |
target |
) |
|
set target
- Parameters:
-
| target | file descriptor for target |
Definition at line 318 of file io.cpp.
void CIO::set_target_to_stderr |
( |
|
) |
|
set target to stderr
Definition at line 210 of file io.h.
void CIO::set_target_to_stdout |
( |
|
) |
|
set target to stdout
Definition at line 213 of file io.h.
char * CIO::skip_blanks |
( |
char * |
str |
) |
[static] |
skip leading spaces + tabs
- Parameters:
-
| str | string in which to look for blanks |
- Returns:
- string after after skipping leading blanks
Definition at line 289 of file io.cpp.
char * CIO::skip_spaces |
( |
char * |
str |
) |
[static] |
skip leading spaces
- Parameters:
-
| str | string in which to look for spaces |
- Returns:
- string after after skipping leading spaces
Definition at line 275 of file io.cpp.
Member Data Documentation
last progress
Definition at line 286 of file io.h.
last progress time
Definition at line 282 of file io.h.
const EMessageType CIO::levels = {M_DEBUG, M_INFO, M_NOTICE, M_WARN, M_ERROR, M_CRITICAL, M_ALERT, M_EMERGENCY, M_MESSAGEONLY} [static, protected] |
available log levels
Definition at line 293 of file io.h.
log level
Definition at line 291 of file io.h.
const char * CIO::message_strings = {"[DEBUG] ", "[INFO] ", "[NOTICE] ", "\033[1;34m[WARN]\033[0m ", "\033[1;31m[ERROR]\033[0m ", "[CRITICAL] ", "[ALERT] ", "[EMERGENCY] ", ""} [static, protected] |
message strings
Definition at line 295 of file io.h.
progress start time
Definition at line 284 of file io.h.
if progress bar shall be shown
Definition at line 288 of file io.h.
target file
Definition at line 280 of file io.h.
The documentation for this class was generated from the following files: