aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate/init.h
blob: 794fbd39e9ddaaa8e6fee6a1f1bb888798bc85c1 (plain)
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
/**
* Library Initialization Header File
* (C) 1999-2008 Jack Lloyd
*/

#ifndef BOTAN_LIBRARY_INITIALIZER_H__
#define BOTAN_LIBRARY_INITIALIZER_H__

#include <botan/libstate.h>

namespace Botan {

/**
* This class represents the Library Initialization/Shutdown Object. It
* has to exceed the lifetime of any Botan object used in an
* application.  You can call initialize/deinitialize or use
* LibraryInitializer in the RAII style.
*/
class BOTAN_DLL LibraryInitializer
   {
   public:
      static void initialize(bool thread_safe);

      static void deinitialize();

      /**
      * Initialize the library
      * @param thread_safe if the library should use a thread-safe mutex
      */
      LibraryInitializer(bool thread_safe = false)
         { LibraryInitializer::initialize(thread_safe); }

      ~LibraryInitializer() { LibraryInitializer::deinitialize(); }
   };

}

#endif