GDCM 3.0.24
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
20namespace gdcm
21{
22
36{
37public:
38 enum CryptoLib {DEFAULT = 0, OPENSSL = 1, CAPI = 2, OPENSSLP7 = 3};
39
42
43protected:
45 {
46 AddLib(id, this);
47 }
48
49private:
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
64protected:
65 CryptoFactory()= default;
66 ~CryptoFactory()= default;
67};
68
69} // end namespace gdcm
70
71#endif // GDCMCRYPTOFACTORY_H
Class to do handle the crypto factory.
Definition gdcmCryptoFactory.h:36
CryptoFactory()=default
CryptoFactory(CryptoLib id)
Definition gdcmCryptoFactory.h:44
virtual CryptographicMessageSyntax * CreateCMSProvider()=0
CryptoLib
Definition gdcmCryptoFactory.h:38
static CryptoFactory * GetFactoryInstance(CryptoLib id=DEFAULT)
~CryptoFactory()=default
Definition gdcmCryptographicMessageSyntax.h:23
#define gdcmErrorMacro(msg)
Error this is pretty bad, more than just warning It could mean lost of data, something not handle....
Definition gdcmTrace.h:165
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21