6#ifndef CRYPTOPP_OBJFACT_H
7#define CRYPTOPP_OBJFACT_H
17template <
class AbstractClass>
22 virtual AbstractClass * CreateObject()
const =0;
28template <
class AbstractClass,
class ConcreteClass>
32 AbstractClass * CreateObject()
const
34 return new ConcreteClass;
41template <
class AbstractClass,
int instance=0>
53 for (
typename Map::iterator i = m_map.begin(); i != m_map.end(); ++i)
62 m_map[name] = factory;
67 typename Map::const_iterator i = m_map.find(name);
71 AbstractClass *CreateObject(
const char *name)
const
75 throw FactoryNotFound(name);
76 return factory->CreateObject();
81 std::vector<std::string> GetFactoryNames()
const
83 std::vector<std::string> names;
84 typename Map::const_iterator iter;
85 for (iter = m_map.begin(); iter != m_map.end(); ++iter)
86 names.push_back(iter->first);
94 typedef std::map<std::string, void *> Map;
98template <
class AbstractClass,
int instance>
109template <
class AbstractClass,
class ConcreteClass,
int instance = 0>
115 std::string n = name ? std::string(name) : std::string(ConcreteClass::StaticAlgorithmName());
128template <
class SchemeClass>
129void RegisterAsymmetricCipherDefaultFactories(
const char *name=NULLPTR)
142template <
class SchemeClass>
143void RegisterSignatureSchemeDefaultFactories(
const char *name=NULLPTR)
156template <
class SchemeClass>
157void RegisterSymmetricCipherDefaultFactories(
const char *name=NULLPTR)
170template <
class SchemeClass>
171void RegisterAuthenticatedSymmetricCipherDefaultFactories(
const char *name=NULLPTR)
Object factory for registering objects.
Base class for all exceptions thrown by the library.
Exception(ErrorType errorType, const std::string &s)
Construct a new Exception.
@ OTHER_ERROR
Some other error occurred not belonging to other categories.
Object factory interface for registering objects.
Abstract base classes that provide a uniform interface to this library.
Utility functions for the Crypto++ library.
Crypto++ library namespace.
Object factory registry helper.