diff options
author | cinlin <cinlin@google.com> | 2023-05-24 11:39:31 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-05-24 11:40:58 -0700 |
commit | 39aeaa7d5594980082aef55b3a8a46c0fab2e10e (patch) | |
tree | c4786e6cc1e9545e35198dcf2eace02880ceb471 /cc/primitive_wrapper.h | |
parent | 16ce1595a16f47dd813b6b712766cf1b652b1e5d (diff) | |
download | tink-39aeaa7d5594980082aef55b3a8a46c0fab2e10e.tar.gz |
Add using declarations for PrimitiveWrapper template parameters.
Prevents calls to internal::ConfigurationImpl::RegisterPrimitiveWrapper from requiring the specification of these parameters.
See similar practice [1] with example usage [2].
[1] https://github.com/tink-crypto/tink-cc/blob/d0fc7fe57b030330a4c2f20a23f414f8a031e57b/tink/core/key_type_manager.h#L106
[2] https://github.com/tink-crypto/tink-cc/blob/d0fc7fe57b030330a4c2f20a23f414f8a031e57b/tink/internal/configuration_impl.h#L43
PiperOrigin-RevId: 534923026
Diffstat (limited to 'cc/primitive_wrapper.h')
-rw-r--r-- | cc/primitive_wrapper.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cc/primitive_wrapper.h b/cc/primitive_wrapper.h index 73d2d2841..1ba6f223b 100644 --- a/cc/primitive_wrapper.h +++ b/cc/primitive_wrapper.h @@ -31,10 +31,15 @@ namespace tink { // // PrimitiveWrappers need to be written for every new primitive. They can be // registered in the registry to be fully integrated in Tink. -template <typename InputPrimitive, typename Primitive> +template <typename InputPrimitiveParam, typename PrimitiveParam> class PrimitiveWrapper { public: virtual ~PrimitiveWrapper() = default; + + // Useful when writing templated code. + using InputPrimitive = InputPrimitiveParam; + using Primitive = PrimitiveParam; + virtual crypto::tink::util::StatusOr<std::unique_ptr<Primitive>> Wrap( std::unique_ptr<PrimitiveSet<InputPrimitive>> primitive_set) const = 0; }; |