SGL
ginit.h
1 /*
2  * File: ginit.h
3  * -------------
4  * These functions setup/teardown the SGL C++ library.
5  *
6  * Originally, necessary setup was initiated via a static initializer. This required
7  * careful arrangement include+guard, this is no longer used as pre/post work is
8  * is inserted into the wrapper "main" function which surrounds student main.
9  *
10  * @version 2018/08/28
11  * - refactor to use namespace and init.cpp
12  * @version 2018/07/03
13  * - add code to handle Qt GUI library initialization
14  * @version 2017/04/25
15  * - wrap library initializer in an #ifndef to avoid multiple declaration
16  *
17  */
18 
19 #ifndef _ginit_h
20 #define _ginit_h
21 
22 #include <string>
23 
24 namespace sgl {
25 
30 bool exitEnabled();
31 
37 void initializeLibrary(int argc, char** argv);
38 
46 
51 void setExitEnabled(bool enabled);
52 
57 void shutdownLibrary();
58 
59 
60 
61 } // namespace sgl
62 
63 // bypass std::exit function
64 namespace std {
65 void __sgl__exitLibrary(int status);
66 } // namespace std
67 
68 #define STD_EXIT __std_exit_function_
69 #define exit __sgl__exitLibrary
70 
71 #ifdef SPL_HEADLESS_MODE
72 #include "headless.h"
73 #endif // SPL_HEADLESS_MODE
74 
75 #endif // _ginit_h
STL namespace.
Definition: console.h:293
void initializeLibrary(int argc, char **argv)
Initializes the SGL C++ library.
Definition: ginit.cpp:52
bool exitEnabled()
Returns true if the std::exit function is enabled.
Definition: ginit.cpp:46
void shutdownLibrary()
Shuts down the SGL C++ library.
Definition: ginit.cpp:120
void initializeStudentThread()
This is for any initialization that needs to be done in the student&#39;s thread rather than on the Qt GU...
Definition: ginit.cpp:77
void setExitEnabled(bool enabled)
Sets whether the std::exit function will be enabled or not.
Definition: ginit.cpp:113