1 /*
2 * Library Initialization
3 * (C) 1999-2008 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_LIBRARY_INITIALIZER_H__
9 #define BOTAN_LIBRARY_INITIALIZER_H__
10 
11 #include <botan/build.h>
12 #include <string>
13 
14 namespace Botan {
15 
16 /**
17 * This class represents the Library Initialization/Shutdown Object. It
18 * has to exceed the lifetime of any Botan object used in an
19 * application.  You can call initialize/deinitialize or use
20 * LibraryInitializer in the RAII style.
21 */
22 class BOTAN_DLL LibraryInitializer
23    {
24    public:
25       /**
26       * Initialize the library
27       * @param options a string listing initialization options
28       */
29       static void initialize(const std::string& options = "");
30 
31       /**
32       * Shutdown the library
33       */
34       static void deinitialize();
35 
36       /**
37       * Initialize the library
38       * @param options a string listing initialization options
39       */
40       LibraryInitializer(const std::string& options = "")
41          { LibraryInitializer::initialize(options); }
42 
~LibraryInitializer()43       ~LibraryInitializer() { LibraryInitializer::deinitialize(); }
44    };
45 
46 }
47 
48 #endif
49