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 2021/04/09
11  * - added sgl namespace
12  * @version 2018/08/28
13  * - refactor to use namespace and init.cpp
14  * @version 2018/07/03
15  * - add code to handle Qt GUI library initialization
16  * @version 2017/04/25
17  * - wrap library initializer in an #ifndef to avoid multiple declaration
18  *
19  */
20 
21 #ifndef _ginit_h
22 #define _ginit_h
23 
24 #include <string>
25 
26 namespace sgl {
27 
32 bool exitEnabled();
33 
39 void initializeLibrary(int argc, char** argv);
40 
48 
53 void setExitEnabled(bool enabled);
54 
59 void shutdownLibrary();
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 SGL_HEADLESS_MODE
72 #include "headless.h"
73 #endif // SGL_HEADLESS_MODE
74 
75 #endif // _ginit_h
STL namespace.
Definition: console.h:45
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