Botan 1.10.17

global_state.h
Go to the documentation of this file.
1 /*
2 * Global State Management
3 * (C) 2010 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_GLOBAL_STATE_H__
9 #define BOTAN_GLOBAL_STATE_H__
10
11 #include <botan/build.h>
12
13 namespace Botan {
14
15 /*
16 * Forward declare to avoid recursive dependency between this header
17 * and libstate.h
18 */
19 class Library_State;
20
21 /**
22 * Namespace for management of the global state
23 */
24 namespace Global_State_Management {
25
26 /**
27 * Access the global library state
28 * @return reference to the global library state
29 */
30 BOTAN_DLL Library_State& global_state();
31
32 /**
33 * Set the global state object
34 * @param state the new global state to use
35 */
36 BOTAN_DLL void set_global_state(Library_State* state);
37
38 /**
39 * Set the global state object unless it is already set
40 * @param state the new global state to use
41 * @return true if the state parameter is now being used as the global
42 * state, or false if one was already set, in which case the
43 * parameter was deleted immediately
44 */
45 BOTAN_DLL bool set_global_state_unless_set(Library_State* state);
46
47 /**
48 * Swap the current state for another
49 * @param new_state the new state object to use
50 * @return previous state (or NULL if none)
51 */
52 BOTAN_DLL Library_State* swap_global_state(Library_State* new_state);
53
54 /**
55 * Query if the library is currently initialized
56 * @return true iff the library is initialized
57 */
58 BOTAN_DLL bool global_state_exists();
59
60 }
61
62 /*
63 * Insert into Botan ns for convenience/backwards compatability
64 */
65 using Global_State_Management::global_state;
66
67 }
68
69 #endif
Botan::Global_State_Management::set_global_state
void set_global_state(Library_State *new_state)
Definition: global_state.cpp:49
Botan::Global_State_Management::global_state
Library_State & global_state()
Definition: global_state.cpp:32
Botan
Definition: algo_base.h:14
Botan::Global_State_Management::swap_global_state
Library_State * swap_global_state(Library_State *new_state)
Definition: global_state.cpp:74
Botan::Global_State_Management::global_state_exists
bool global_state_exists()
Definition: global_state.cpp:84
Botan::Global_State_Management::set_global_state_unless_set
bool set_global_state_unless_set(Library_State *new_state)
Definition: global_state.cpp:57