GDCM  2.4.5
gdcmCryptoFactory.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: GDCM (Grassroots DICOM). A DICOM library
4 
5  Copyright (c) 2006-2011 Mathieu Malaterre
6  All rights reserved.
7  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 #ifndef GDCMCRYPTOFACTORY_H
15 #define GDCMCRYPTOFACTORY_H
16 
18 #include <map>
19 
20 namespace gdcm
21 {
22 
36 {
37 public:
38  enum CryptoLib {DEFAULT = 0, OPENSSL = 1, CAPI = 2, OPENSSLP7 = 3};
39 
40  virtual CryptographicMessageSyntax* CreateCMSProvider() = 0;
41  static CryptoFactory* GetFactoryInstance(CryptoLib id = DEFAULT);
42 
43 protected:
45  {
46  AddLib(id, this);
47  }
48 
49 private:
50  static std::map<CryptoLib, CryptoFactory*>& getInstanceMap()
51  {
52  static std::map<CryptoLib, CryptoFactory*> libs;
53  return libs;
54  }
55 
56  static void AddLib(CryptoLib id, CryptoFactory* f)
57  {
58  if (getInstanceMap().insert(std::pair<CryptoLib, CryptoFactory*>(id, f)).second == false)
59  {
60  gdcmErrorMacro( "Library already registered under id " << (int)id );
61  }
62  }
63 
64 protected:
67 };
68 
69 } // end namespace gdcm
70 
71 #endif // GDCMCRYPTOFACTORY_H
CryptoFactory(CryptoLib id)
Definition: gdcmCryptoFactory.h:44
CryptoFactory()
Definition: gdcmCryptoFactory.h:65
~CryptoFactory()
Definition: gdcmCryptoFactory.h:66
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
CryptoLib
Definition: gdcmCryptoFactory.h:38
Class to do handle the crypto factory.
Definition: gdcmCryptoFactory.h:35
#define gdcmErrorMacro(msg)
Error this is pretty bad, more than just warning It could mean lost of data, something not handle...
Definition: gdcmTrace.h:163
Definition: gdcmCryptographicMessageSyntax.h:22
Definition: gdcmASN1.h:20

Generated on Fri Sep 25 2015 17:58:22 for GDCM by doxygen 1.8.9.1
SourceForge.net Logo