-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
init.h
124 lines (103 loc) · 3.18 KB
/
init.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 2009 Soeren Sonnenburg
* Copyright (C) 2009 Fraunhofer Institute FIRST and Max-Planck-Society
*/
#ifndef __SG_INIT_H__
#define __SG_INIT_H__
#include <shogun/lib/config.h>
#include <stdio.h>
namespace shogun
{
class SGIO;
class CMath;
class Version;
class Parallel;
class CRandom;
class SGLinalg;
/** This function must be called before libshogun is used. Usually shogun does
* not provide any output messages (neither debugging nor error; apart from
* exceptions). This function allows one to specify customized output
* callback functions and a callback function to check for exceptions:
*
* @param print_message function pointer to print a message
* @param print_warning function pointer to print a warning message
* @param print_error function pointer to print an error message (this will be
* printed before shogun throws an exception)
*
* @param cancel_computations function pointer to check for exception
*
*/
void init_shogun(void (*print_message)(FILE* target, const char* str) = NULL,
void (*print_warning)(FILE* target, const char* str) = NULL,
void (*print_error)(FILE* target, const char* str) = NULL,
void (*cancel_computations)(bool &delayed, bool &immediately)=NULL);
/** init shogun with defaults */
void init_shogun_with_defaults();
/** This function must be called when one stops using libshogun. It will
* perform a number of cleanups */
void exit_shogun();
/** set the global io object
*
* @param io io object to use
*/
void set_global_io(SGIO* io);
/** get the global io object
*
* @return io object
*/
SGIO* get_global_io();
/** set the global parallel object
*
* @param parallel parallel object to use
*/
void set_global_parallel(Parallel* parallel);
/** get the global parallel object
*
* @return parallel object
*/
Parallel* get_global_parallel();
/** set the global version object
*
* @param version version object to use
*/
void set_global_version(Version* version);
/** get the global version object
*
* @return version object
*/
Version* get_global_version();
/** set the global math object
*
* @param math math object to use
*/
void set_global_math(CMath* math);
/** get the global math object
*
* @return math object
*/
CMath* get_global_math();
#ifndef SWIG // SWIG should skip this part
/** get the global linalg library object
*
* @return linalg object
*/
SGLinalg* get_global_linalg();
#endif
/** Checks environment variables and modifies global objects
*/
void init_from_env();
/// function called to print normal messages
extern void (*sg_print_message)(FILE* target, const char* str);
/// function called to print warning messages
extern void (*sg_print_warning)(FILE* target, const char* str);
/// function called to print error messages
extern void (*sg_print_error)(FILE* target, const char* str);
/// function called to cancel things
extern void (*sg_cancel_computations)(bool &delayed, bool &immediately);
}
#endif //__SG_INIT__