12 #include <glog/logging.h> 26 table_.reserve(initLength);
69 bool nameOnly)
const {
70 auto it =
names_.find(headerName);
74 for (
auto indexIt = it->second.rbegin(); indexIt != it->second.rend();
77 if (nameOnly ||
table_[
i].value == value) {
102 return (capacityVal >> 5);
109 DCHECK(names_it !=
names_.end());
110 auto &ilist = names_it->second;
111 DCHECK_EQ(ilist.front(),
t);
118 const auto& header =
table_[
t];
119 uint32_t headerBytes = header.bytes();
121 VLOG(10) <<
"Removing local idx=" <<
t <<
" name=" << header.name
122 <<
" value=" << header.value;
141 evict(0, newCapacity);
142 if (
bytes_ > newCapacity) {
151 if (newLength >
length()) {
160 DCHECK_GE(newLength,
length());
162 auto oldLength =
length();
171 for (
auto& names_it:
names_) {
172 for (
auto& idx: names_it.second) {
173 if (idx >= oldTail) {
175 idx += (
length() - oldLength);
192 std::move_backward(
table_.begin() + oldTail,
table_.begin() + oldLength,
193 table_.begin() + newLength);
198 while (
size_ > 0 && (
bytes_ + needed > desiredCapacity)) {
201 return previousSize -
size_;
206 result = 0 < index && index <=
size_;
208 LOG(
ERROR) <<
"Invalid index=" << index <<
" size_=" <<
size_;
214 return (i + 1) %
length();
220 DCHECK_GT(
size_, 0) <<
"tail() undefined";
230 return ((head + length - internalIndex) % length) + 1;
241 return (head + length - externalIndex) %
length;
256 for (
size_t i = 1;
i <= table.
size();
i++) {
258 os <<
'[' <<
i <<
"] (s=" << h.
bytes() <<
") " 259 << h.
name <<
": " << h.
value << std::endl;
261 os <<
"total size: " << table.
bytes() << std::endl;
constexpr To ceil(std::chrono::duration< Rep, Period > const &d)
std::ostream & operator<<(std::ostream &os, const HeaderTable &table)
constexpr detail::Map< Move > move
Encoder::MutableCompressedList list
static const char *const value