gdcmCryptoFactory.h
Go to the documentation of this file.
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef GDCMCRYPTOFACTORY_H
#define GDCMCRYPTOFACTORY_H
#include "gdcmCryptographicMessageSyntax.h"
#include <map>
namespace gdcm
{
class GDCM_EXPORT CryptoFactory
{
public:
enum CryptoLib {DEFAULT = 0, OPENSSL = 1, CAPI = 2, OPENSSLP7 = 3};
virtual CryptographicMessageSyntax* CreateCMSProvider() = 0;
static CryptoFactory* GetFactoryInstance(CryptoLib id = DEFAULT);
protected:
CryptoFactory(CryptoLib id)
{
AddLib(id, this);
}
private:
static std::map<CryptoLib, CryptoFactory*>& getInstanceMap()
{
static std::map<CryptoLib, CryptoFactory*> libs;
return libs;
}
static void AddLib(CryptoLib id, CryptoFactory* f)
{
if (getInstanceMap().insert(std::pair<CryptoLib, CryptoFactory*>(id, f)).second == false)
{
gdcmErrorMacro( "Library already registered under id " << (int)id );
}
}
protected:
CryptoFactory()= default;
~CryptoFactory()= default;
};
} // end namespace gdcm
#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