CIO Class Reference
Detailed Description
Class IO, used to do input output operations throughout shogun.
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 94 of file io.h.
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 () |
int32_t | ref () |
int32_t | ref_count () const |
int32_t | unref () |
const char * | get_name () |
Static Public Member Functions |
static char * | skip_spaces (char *str) |
static char * | skip_blanks (char *str) |
static void | set_dirname (const char *dirname) |
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] |
static const char * | message_strings [NUM_LOG_LEVELS] |
static char | file_buffer [FBUFSIZE] |
| file name buffer
|
static char | directory_name [FBUFSIZE] |
| directory name buffer
|
Constructor & Destructor Documentation
default constructor
Definition at line 40 of file io.cpp.
CIO::CIO |
( |
const CIO & |
orig |
) |
|
copy constructor
Definition at line 46 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 166 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 100 of file io.cpp.
static char* CIO::concat_filename |
( |
const char * |
filename |
) |
[static] |
concatenate directory and filename ( non thread safe )
- Parameters:
-
- Returns:
- concatenated directory and filename
Definition at line 243 of file io.h.
void CIO::disable_progress |
( |
|
) |
|
disable progress bar
Definition at line 219 of file io.h.
print 'done' with priority INFO, but only if progress bar is enabled
Definition at line 218 of file io.cpp.
void CIO::enable_progress |
( |
|
) |
|
enable progress bar
Definition at line 209 of file io.h.
static int CIO::filter |
( |
CONST_DIRENT_T * |
d |
) |
[static] |
filter
- Parameters:
-
- Returns:
- 1 if d is a readable file
Definition at line 256 of file io.h.
get loglevel
- Returns:
- level of log messages
Definition at line 254 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 274 of file io.cpp.
const char* CIO::get_name |
( |
|
) |
|
- Returns:
- object name
Definition at line 309 of file io.h.
bool CIO::get_show_progress |
( |
|
) |
const |
get show_progress
- Returns:
- if progress bar is shown
Definition at line 264 of file io.cpp.
FILE* CIO::get_target |
( |
|
) |
const |
get target
- Returns:
- file descriptor for target
Definition at line 191 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 53 of file io.cpp.
void CIO::not_implemented |
( |
|
) |
const |
print error message 'not implemented'
Definition at line 161 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 114 of file io.cpp.
increase reference counter
- Returns:
- reference count
Definition at line 277 of file io.h.
int32_t CIO::ref_count |
( |
|
) |
const |
display reference counter
- Returns:
- reference count
Definition at line 287 of file io.h.
static void CIO::set_dirname |
( |
const char * |
dirname |
) |
[static] |
set directory name
- Parameters:
-
| dirname | new directory name |
Definition at line 232 of file io.h.
set loglevel
- Parameters:
-
| level | level of log messages |
Definition at line 259 of file io.cpp.
void CIO::set_target |
( |
FILE * |
target |
) |
|
set target
- Parameters:
-
| target | file descriptor for target |
Definition at line 269 of file io.cpp.
void CIO::set_target_to_stderr |
( |
|
) |
|
set target to stderr
Definition at line 203 of file io.h.
void CIO::set_target_to_stdout |
( |
|
) |
|
set target to stdout
Definition at line 206 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 240 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 226 of file io.cpp.
decrement reference counter and deallocate object if refcount is zero before or after decrementing it
- Returns:
- reference count
Definition at line 297 of file io.h.
Member Data Documentation
directory name buffer
directory name (for filter function)
Definition at line 342 of file io.h.
file name buffer
file buffer
Definition at line 340 of file io.h.
last progress
Definition at line 328 of file io.h.
last progress time
Definition at line 324 of file io.h.
Initial value:available log levels
Definition at line 335 of file io.h.
log level
Definition at line 333 of file io.h.
Initial value:{"[DEBUG] \0", "[INFO] \0",
"[NOTICE] \0", "\033[1;34m[WARN]\033[0m \0", "\033[1;31m[ERROR]\033[0m \0",
"[CRITICAL] \0", "[ALERT] \0", "[EMERGENCY] \0", "\0"}
message strings
Definition at line 337 of file io.h.
progress start time
Definition at line 326 of file io.h.
if progress bar shall be shown
Definition at line 330 of file io.h.
target file
Definition at line 322 of file io.h.
The documentation for this class was generated from the following files: