/src/poco/Foundation/include/Poco/Instantiator.h
Line | Count | Source |
1 | | // |
2 | | // Instantiator.h |
3 | | // |
4 | | // Library: Foundation |
5 | | // Package: Core |
6 | | // Module: Instantiator |
7 | | // |
8 | | // Definition of the Instantiator class. |
9 | | // |
10 | | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
11 | | // and Contributors. |
12 | | // |
13 | | // SPDX-License-Identifier: BSL-1.0 |
14 | | // |
15 | | |
16 | | |
17 | | #ifndef Foundation_Instantiator_INCLUDED |
18 | | #define Foundation_Instantiator_INCLUDED |
19 | | |
20 | | |
21 | | #include "Poco/Foundation.h" |
22 | | |
23 | | |
24 | | namespace Poco { |
25 | | |
26 | | |
27 | | template <class Base> |
28 | | class AbstractInstantiator |
29 | | /// The common base class for all Instantiator instantiations. |
30 | | /// Used by DynamicFactory. |
31 | | { |
32 | | public: |
33 | | AbstractInstantiator() |
34 | | /// Creates the AbstractInstantiator. |
35 | 295k | = default; |
36 | | |
37 | | virtual ~AbstractInstantiator() |
38 | | /// Destroys the AbstractInstantiator. |
39 | 295k | = default; |
40 | | |
41 | | virtual Base* createInstance() const = 0; |
42 | | /// Creates an instance of a concrete subclass of Base. |
43 | | |
44 | | AbstractInstantiator(const AbstractInstantiator&) = delete; |
45 | | AbstractInstantiator& operator=(const AbstractInstantiator&) = delete; |
46 | | }; |
47 | | |
48 | | |
49 | | template <class C, class Base> |
50 | | class Instantiator: public AbstractInstantiator<Base> |
51 | | /// A template class for the easy instantiation of |
52 | | /// instantiators. |
53 | | /// |
54 | | /// For the Instantiator to work, the class of which |
55 | | /// instances are to be instantiated must have a no-argument |
56 | | /// constructor. |
57 | | { |
58 | | public: |
59 | 295k | Instantiator() = default; Poco::Instantiator<Poco::JWT::HMACAlgorithm<Poco::JWT::SHA256Engine>, Poco::JWT::Algorithm>::Instantiator() Line | Count | Source | 59 | 32.7k | Instantiator() = default; |
Poco::Instantiator<Poco::JWT::HMACAlgorithm<Poco::JWT::SHA384Engine>, Poco::JWT::Algorithm>::Instantiator() Line | Count | Source | 59 | 32.7k | Instantiator() = default; |
Poco::Instantiator<Poco::JWT::HMACAlgorithm<Poco::JWT::SHA512Engine>, Poco::JWT::Algorithm>::Instantiator() Line | Count | Source | 59 | 32.7k | Instantiator() = default; |
Poco::Instantiator<Poco::JWT::RS256, Poco::JWT::Algorithm>::Instantiator() Line | Count | Source | 59 | 32.7k | Instantiator() = default; |
Poco::Instantiator<Poco::JWT::RS384, Poco::JWT::Algorithm>::Instantiator() Line | Count | Source | 59 | 32.7k | Instantiator() = default; |
Poco::Instantiator<Poco::JWT::RS512, Poco::JWT::Algorithm>::Instantiator() Line | Count | Source | 59 | 32.7k | Instantiator() = default; |
Poco::Instantiator<Poco::JWT::ES256, Poco::JWT::Algorithm>::Instantiator() Line | Count | Source | 59 | 32.7k | Instantiator() = default; |
Poco::Instantiator<Poco::JWT::ES384, Poco::JWT::Algorithm>::Instantiator() Line | Count | Source | 59 | 32.7k | Instantiator() = default; |
Poco::Instantiator<Poco::JWT::ES512, Poco::JWT::Algorithm>::Instantiator() Line | Count | Source | 59 | 32.7k | Instantiator() = default; |
|
60 | | /// Creates the Instantiator. |
61 | | |
62 | | virtual ~Instantiator() = default; |
63 | | /// Destroys the Instantiator. |
64 | | |
65 | | Base* createInstance() const |
66 | 32.7k | { |
67 | 32.7k | return new C; |
68 | 32.7k | } Poco::Instantiator<Poco::JWT::HMACAlgorithm<Poco::JWT::SHA256Engine>, Poco::JWT::Algorithm>::createInstance() const Line | Count | Source | 66 | 5.46k | { | 67 | 5.46k | return new C; | 68 | 5.46k | } |
Poco::Instantiator<Poco::JWT::HMACAlgorithm<Poco::JWT::SHA384Engine>, Poco::JWT::Algorithm>::createInstance() const Line | Count | Source | 66 | 5.46k | { | 67 | 5.46k | return new C; | 68 | 5.46k | } |
Poco::Instantiator<Poco::JWT::HMACAlgorithm<Poco::JWT::SHA512Engine>, Poco::JWT::Algorithm>::createInstance() const Line | Count | Source | 66 | 5.46k | { | 67 | 5.46k | return new C; | 68 | 5.46k | } |
Poco::Instantiator<Poco::JWT::RS256, Poco::JWT::Algorithm>::createInstance() const Line | Count | Source | 66 | 2.73k | { | 67 | 2.73k | return new C; | 68 | 2.73k | } |
Poco::Instantiator<Poco::JWT::RS384, Poco::JWT::Algorithm>::createInstance() const Line | Count | Source | 66 | 2.73k | { | 67 | 2.73k | return new C; | 68 | 2.73k | } |
Poco::Instantiator<Poco::JWT::RS512, Poco::JWT::Algorithm>::createInstance() const Line | Count | Source | 66 | 2.73k | { | 67 | 2.73k | return new C; | 68 | 2.73k | } |
Poco::Instantiator<Poco::JWT::ES256, Poco::JWT::Algorithm>::createInstance() const Line | Count | Source | 66 | 2.73k | { | 67 | 2.73k | return new C; | 68 | 2.73k | } |
Poco::Instantiator<Poco::JWT::ES384, Poco::JWT::Algorithm>::createInstance() const Line | Count | Source | 66 | 2.73k | { | 67 | 2.73k | return new C; | 68 | 2.73k | } |
Poco::Instantiator<Poco::JWT::ES512, Poco::JWT::Algorithm>::createInstance() const Line | Count | Source | 66 | 2.73k | { | 67 | 2.73k | return new C; | 68 | 2.73k | } |
|
69 | | }; |
70 | | |
71 | | |
72 | | } // namespace Poco |
73 | | |
74 | | |
75 | | #endif // Foundation_Instantiator_INCLUDED |