proxygen
folly::io::test::DataHolder Class Reference
Inheritance diagram for folly::io::test::DataHolder:
folly::io::test::ConstantDataHolder folly::io::test::RandomDataHolder

Public Member Functions

uint64_t hash (size_t size) const
 
ByteRange data (size_t size) const
 

Protected Member Functions

 DataHolder (size_t sizeLog2)
 

Protected Attributes

const size_t size_
 
std::unique_ptr< uint8_t[]> data_
 
std::unordered_map< uint64_t, uint64_thashCache_
 

Detailed Description

Definition at line 51 of file CompressionTest.cpp.

Constructor & Destructor Documentation

folly::io::test::DataHolder::DataHolder ( size_t  sizeLog2)
explicitprotected

Definition at line 63 of file CompressionTest.cpp.

64  : size_(size_t(1) << sizeLog2), data_(new uint8_t[size_]) {}
std::unique_ptr< uint8_t[]> data_

Member Function Documentation

uint64_t folly::io::test::DataHolder::hash ( size_t  size) const

Definition at line 66 of file CompressionTest.cpp.

References data_, folly::hash::fnv64_buf(), h, hashCache_, folly::size(), size_, and uint64_t.

Referenced by folly::io::test::StreamingCompressionTest::runCompressStreamTest(), folly::io::test::StreamingCompressionTest::runResetStreamTest(), folly::io::test::CompressionTest::runSimpleIOBufTest(), folly::io::test::CompressionVarintTest::runSimpleTest(), folly::io::test::CompressionCorruptionTest::runSimpleTest(), folly::io::test::AutomaticCodecTest::runSimpleTest(), and folly::io::test::TEST_P().

66  {
67  CHECK_LE(size, size_);
68  auto p = hashCache_.find(size);
69  if (p != hashCache_.end()) {
70  return p->second;
71  }
72 
74  hashCache_[size] = h;
75  return h;
76 }
uint64_t fnv64_buf(const void *buf, size_t n, uint64_t hash=FNV_64_HASH_START) noexcept
Definition: Hash.h:199
*than *hazptr_holder h
Definition: Hazptr.h:116
std::unordered_map< uint64_t, uint64_t > hashCache_
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
std::unique_ptr< uint8_t[]> data_

Member Data Documentation

std::unique_ptr<uint8_t[]> folly::io::test::DataHolder::data_
protected
std::unordered_map<uint64_t, uint64_t> folly::io::test::DataHolder::hashCache_
mutableprotected

Definition at line 60 of file CompressionTest.cpp.

Referenced by hash().

const size_t folly::io::test::DataHolder::size_
protected

The documentation for this class was generated from the following file: