Detailed Description
Class SGIO, 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 111 of file SGIO.h.
List of all members.
Public Member Functions |
| SGIO () |
| SGIO (const SGIO &orig) |
void | set_loglevel (EMessageType level) |
EMessageType | get_loglevel () const |
bool | get_show_progress () const |
bool | get_show_file_and_line () const |
bool | get_syntax_highlight () const |
void | message (EMessageType prio, const char *file, int32_t line, 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 char *file, int32_t line) const |
void | deprecated (const char *file, int32_t line) 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 | enable_file_and_line () |
void | disable_file_and_line () |
void | enable_syntax_highlighting () |
void | disable_syntax_highlighting () |
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 |
float64_t | last_progress_time |
float64_t | progress_start_time |
float64_t | last_progress |
bool | show_progress |
bool | show_file_and_line |
bool | syntax_highlight |
EMessageType | loglevel |
Static Protected Attributes |
static const EMessageType | levels [NUM_LOG_LEVELS] |
static const char * | message_strings_highlighted [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 46 of file SGIO.cpp.
copy constructor
Definition at line 53 of file SGIO.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 184 of file SGIO.cpp.
void buffered_message |
( |
EMessageType |
prio, |
|
|
const char * |
fmt, |
|
|
|
... | |
|
) |
| | const |
print a buffered message
- Parameters:
-
| prio | message priority |
| fmt | format string |
Definition at line 119 of file SGIO.cpp.
static char* concat_filename |
( |
const char * |
filename |
) |
[static] |
concatenate directory and filename ( non thread safe )
- Parameters:
-
- Returns:
- concatenated directory and filename
Definition at line 330 of file SGIO.h.
void deprecated |
( |
const char * |
file, |
|
|
int32_t |
line | |
|
) |
| | const |
print warning message 'function deprecated'
Definition at line 211 of file SGIO.h.
void disable_file_and_line |
( |
|
) |
|
disable displaying of file and line when printing messages
Definition at line 289 of file SGIO.h.
void disable_progress |
( |
|
) |
|
disable progress bar
Definition at line 270 of file SGIO.h.
void disable_syntax_highlighting |
( |
|
) |
|
disable syntax highlighting
Definition at line 307 of file SGIO.h.
print 'done' with priority INFO, but only if progress bar is enabled
Definition at line 235 of file SGIO.cpp.
void enable_file_and_line |
( |
|
) |
|
enable displaying of file and line when printing messages
Definition at line 280 of file SGIO.h.
enable progress bar
Definition at line 260 of file SGIO.h.
void enable_syntax_highlighting |
( |
|
) |
|
enable syntax highlighting
Definition at line 298 of file SGIO.h.
static int filter |
( |
CONST_DIRENT_T * |
d |
) |
[static] |
filter
- Parameters:
-
- Returns:
- 1 if d is a readable file
Definition at line 343 of file SGIO.h.
get loglevel
- Returns:
- level of log messages
Definition at line 271 of file SGIO.cpp.
const char * 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 286 of file SGIO.cpp.
const char* get_name |
( |
void |
|
) |
|
- Returns:
- object name
Definition at line 396 of file SGIO.h.
bool get_show_file_and_line |
( |
|
) |
const |
get show file and line
- Returns:
- if file and line should prefix messages
Definition at line 144 of file SGIO.h.
bool get_show_progress |
( |
|
) |
const |
get show_progress
- Returns:
- if progress bar is shown
Definition at line 135 of file SGIO.h.
bool get_syntax_highlight |
( |
|
) |
const |
get syntax highlight
- Returns:
- if syntax highlighting is enabled
Definition at line 153 of file SGIO.h.
FILE* get_target |
( |
|
) |
const |
get target
- Returns:
- file descriptor for target
Definition at line 242 of file SGIO.h.
void message |
( |
EMessageType |
prio, |
|
|
const char * |
file, |
|
|
int32_t |
line, |
|
|
const char * |
fmt, |
|
|
|
... | |
|
) |
| | const |
print a message
optionally prefixed with file name and line number from (use -1 in line to disable this)
- Parameters:
-
| prio | message priority |
| file | file name from where the message is called |
| line | line number from where the message is called |
| fmt | format string |
Definition at line 63 of file SGIO.cpp.
void not_implemented |
( |
const char * |
file, |
|
|
int32_t |
line | |
|
) |
| | const |
print error message 'not implemented'
Definition at line 205 of file SGIO.h.
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" | |
|
) |
| | |
print progress bar
- Parameters:
-
| current_val | current value |
| min_val | minimum value |
| max_val | maximum value |
| decimals | decimals |
| prefix | message prefix |
Definition at line 133 of file SGIO.cpp.
increase reference counter
- Returns:
- reference count
Definition at line 364 of file SGIO.h.
int32_t ref_count |
( |
|
) |
const |
display reference counter
- Returns:
- reference count
Definition at line 374 of file SGIO.h.
static void set_dirname |
( |
const char * |
dirname |
) |
[static] |
set directory name
- Parameters:
-
| dirname | new directory name |
Definition at line 319 of file SGIO.h.
set loglevel
- Parameters:
-
| level | level of log messages |
Definition at line 276 of file SGIO.cpp.
void set_target |
( |
FILE * |
target |
) |
|
set target
- Parameters:
-
| target | file descriptor for target |
Definition at line 281 of file SGIO.cpp.
void set_target_to_stderr |
( |
|
) |
|
set target to stderr
Definition at line 254 of file SGIO.h.
void set_target_to_stdout |
( |
|
) |
|
set target to stdout
Definition at line 257 of file SGIO.h.
char * 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 257 of file SGIO.cpp.
char * 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 243 of file SGIO.cpp.
decrement reference counter and deallocate object if refcount is zero before or after decrementing it
- Returns:
- reference count
Definition at line 384 of file SGIO.h.
Member Data Documentation
directory name buffer
directory name (for filter function)
Definition at line 436 of file SGIO.h.
file name buffer
file buffer
Definition at line 434 of file SGIO.h.
last progress
Definition at line 415 of file SGIO.h.
last progress time
Definition at line 411 of file SGIO.h.
Initial value:{MSG_GCDEBUG, MSG_DEBUG, MSG_INFO, MSG_NOTICE,
MSG_WARN, MSG_ERROR, MSG_CRITICAL, MSG_ALERT, MSG_EMERGENCY, MSG_MESSAGEONLY}
available log levels
Definition at line 427 of file SGIO.h.
log level
Definition at line 425 of file SGIO.h.
Initial value:{"[GCDEBUG] \0", "[DEBUG] \0", "[INFO] \0",
"[NOTICE] \0", "[WARN] \0", "[ERROR] \0",
"[CRITICAL] \0", "[ALERT] \0", "[EMERGENCY] \0", "\0"}
message strings
Definition at line 431 of file SGIO.h.
Initial value:{"[GCDEBUG] \0", "[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 syntax highlighted
Definition at line 429 of file SGIO.h.
progress start time
Definition at line 413 of file SGIO.h.
if each print function should append filename and linenumber of where the print occurs
Definition at line 420 of file SGIO.h.
if progress bar shall be shown
Definition at line 417 of file SGIO.h.
whether syntax highlighting is enabled
Definition at line 422 of file SGIO.h.
target file
Definition at line 409 of file SGIO.h.
The documentation for this class was generated from the following files: