GDCM 3.2.1

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
17#include "gdcmCryptographicMessageSyntax.h"
18#include <map>
19
20 namespace gdcm
21{
22
35 class GDCM_EXPORT CryptoFactory
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:
44 CryptoFactory(CryptoLib id)
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:
65 CryptoFactory()= default;
66 ~CryptoFactory()= default;
67};
68
69} // end namespace gdcm
70
71#endif // GDCMCRYPTOFACTORY_H
gdcm::CryptoFactory::CryptoFactory
CryptoFactory()=default
gdcm::CryptoFactory::CryptoFactory
CryptoFactory(CryptoLib id)
Definition gdcmCryptoFactory.h:44
gdcm::CryptoFactory::CreateCMSProvider
virtual CryptographicMessageSyntax * CreateCMSProvider()=0
gdcm::CryptoFactory::CryptoLib
CryptoLib
Definition gdcmCryptoFactory.h:38
gdcm::CryptoFactory::OPENSSL
@ OPENSSL
Definition gdcmCryptoFactory.h:38
gdcm::CryptoFactory::DEFAULT
@ DEFAULT
Definition gdcmCryptoFactory.h:38
gdcm::CryptoFactory::OPENSSLP7
@ OPENSSLP7
Definition gdcmCryptoFactory.h:38
gdcm::CryptoFactory::CAPI
@ CAPI
Definition gdcmCryptoFactory.h:38
gdcm::CryptoFactory::GetFactoryInstance
static CryptoFactory * GetFactoryInstance(CryptoLib id=DEFAULT)
gdcm::CryptoFactory::~CryptoFactory
~CryptoFactory()=default
gdcm::CryptographicMessageSyntax
Definition gdcmCryptographicMessageSyntax.h:23
gdcmCryptographicMessageSyntax.h
gdcmErrorMacro
#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
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21