AWS IoT Device SDK C++ v2  1.42.1
AWS IoT Device SDK C++ v2
XXHash.h
Go to the documentation of this file.
1 #pragma once
2 
6 #include <aws/crt/Exports.h>
7 #include <aws/crt/Types.h>
8 
9 struct aws_xxhash;
10 namespace Aws
11 {
12  namespace Crt
13  {
14  namespace Checksum
15  {
21  bool AWS_CRT_CPP_API ComputeXXHash64(const ByteCursor &input, ByteBuf &output, uint64_t seed = 0) noexcept;
22 
28  bool AWS_CRT_CPP_API
29  ComputeXXHash3_64(const ByteCursor &input, ByteBuf &output, uint64_t seed = 0) noexcept;
30 
36  bool AWS_CRT_CPP_API
37  ComputeXXHash3_128(const ByteCursor &input, ByteBuf &output, uint64_t seed = 0) noexcept;
38 
44  class AWS_CRT_CPP_API XXHash final
45  {
46  public:
47  XXHash(const XXHash &) = delete;
48  XXHash &operator=(const XXHash &) = delete;
49  XXHash(XXHash &&toMove) noexcept = default;
50  XXHash &operator=(XXHash &&toMove) noexcept = default;
51 
55  inline int LastError() const noexcept { return m_lastError; }
56 
60  static XXHash CreateXXHash64(uint64_t seed = 0, Allocator *allocator = ApiAllocator()) noexcept;
61 
65  static XXHash CreateXXHash3_64(uint64_t seed = 0, Allocator *allocator = ApiAllocator()) noexcept;
66 
70  static XXHash CreateXXHash3_128(uint64_t seed = 0, Allocator *allocator = ApiAllocator()) noexcept;
71 
76  bool Update(const ByteCursor &toHash) noexcept;
77 
83  bool Digest(ByteBuf &output) noexcept;
84 
85  private:
86  XXHash(aws_xxhash *hash) noexcept;
87  XXHash() = delete;
88 
89  ScopedResource<struct aws_xxhash> m_hash;
90  int m_lastError;
91  };
92  } // namespace Checksum
93  } // namespace Crt
94 } // namespace Aws
Aws::Crt::Checksum::ComputeXXHash3_128
bool AWS_CRT_CPP_API ComputeXXHash3_128(const ByteCursor &input, ByteBuf &output, uint64_t seed=0) noexcept
Definition: XXHash.cpp:25
Aws::Crt::ApiAllocator
AWS_CRT_CPP_API Allocator * ApiAllocator() noexcept
Definition: Allocator.cpp:24
Aws::Crt::ScopedResource
std::unique_ptr< T, std::function< void(T *)> > ScopedResource
Definition: Types.h:163
Aws::Crt::Checksum::XXHash::operator=
XXHash & operator=(XXHash &&toMove) noexcept=default
Aws::Crt::Checksum::XXHash::operator=
XXHash & operator=(const XXHash &)=delete
Aws::Crt::Checksum::XXHash::LastError
int LastError() const noexcept
Definition: XXHash.h:55
Types.h
Aws::Crt::ByteBuf
aws_byte_buf ByteBuf
Definition: Types.h:30
AWS_CRT_CPP_API
#define AWS_CRT_CPP_API
Definition: Exports.h:36
Aws
Definition: Allocator.h:11
Aws::Crt::Checksum::ComputeXXHash3_64
bool AWS_CRT_CPP_API ComputeXXHash3_64(const ByteCursor &input, ByteBuf &output, uint64_t seed=0) noexcept
Definition: XXHash.cpp:20
Aws::Crt::ByteCursor
aws_byte_cursor ByteCursor
Definition: Types.h:31
Aws::Crt::Checksum::ComputeXXHash64
bool AWS_CRT_CPP_API ComputeXXHash64(const ByteCursor &input, ByteBuf &output, uint64_t seed=0) noexcept
Definition: XXHash.cpp:15
Aws::Crt::Allocator
aws_allocator Allocator
Definition: Allocator.h:14
Exports.h
Aws::Crt::Checksum::XXHash::XXHash
XXHash(const XXHash &)=delete
Aws::Crt::Checksum::XXHash::XXHash
XXHash(XXHash &&toMove) noexcept=default
Aws::Crt::Checksum::XXHash
Definition: XXHash.h:45