1 | // |
2 | // CertificateHandlerFactoryMgr.h |
3 | // |
4 | // Library: NetSSL_OpenSSL |
5 | // Package: SSLCore |
6 | // Module: CertificateHandlerFactoryMgr |
7 | // |
8 | // Definition of the CertificateHandlerFactoryMgr class. |
9 | // |
10 | // Copyright (c) 2006-2009, Applied Informatics Software Engineering GmbH. |
11 | // and Contributors. |
12 | // |
13 | // SPDX-License-Identifier: BSL-1.0 |
14 | // |
15 | |
16 | |
17 | #ifndef NetSSL_CertificateHandlerFactoryMgr_INCLUDED |
18 | #define NetSSL_CertificateHandlerFactoryMgr_INCLUDED |
19 | |
20 | |
21 | #include "Poco/Net/NetSSL.h" |
22 | #include "Poco/Net/CertificateHandlerFactory.h" |
23 | #include "Poco/SharedPtr.h" |
24 | #include <map> |
25 | |
26 | |
27 | namespace Poco { |
28 | namespace Net { |
29 | |
30 | |
31 | class NetSSL_API CertificateHandlerFactoryMgr |
32 | /// A CertificateHandlerFactoryMgr manages all existing CertificateHandlerFactories. |
33 | { |
34 | public: |
35 | typedef std::map<std::string, Poco::SharedPtr<CertificateHandlerFactory> > FactoriesMap; |
36 | |
37 | CertificateHandlerFactoryMgr(); |
38 | /// Creates the CertificateHandlerFactoryMgr. |
39 | |
40 | ~CertificateHandlerFactoryMgr(); |
41 | /// Destroys the CertificateHandlerFactoryMgr. |
42 | |
43 | void setFactory(const std::string& name, CertificateHandlerFactory* pFactory); |
44 | /// Registers the factory. Class takes ownership of the pointer. |
45 | /// If a factory with the same name already exists, an exception is thrown. |
46 | |
47 | bool hasFactory(const std::string& name) const; |
48 | /// Returns true if for the given name a factory is already registered |
49 | |
50 | const CertificateHandlerFactory* getFactory(const std::string& name) const; |
51 | /// Returns NULL if for the given name a factory does not exist, otherwise the factory is returned |
52 | |
53 | void removeFactory(const std::string& name); |
54 | /// Removes the factory from the manager. |
55 | |
56 | private: |
57 | FactoriesMap _factories; |
58 | }; |
59 | |
60 | |
61 | } } // namespace Poco::Net |
62 | |
63 | |
64 | #endif // NetSSL_CertificateHandlerFactoryMgr_INCLUDED |
65 | |