1 // Copyright 2019 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef QUICHE_QUIC_TEST_TOOLS_QUIC_INTERVAL_DEQUE_PEER_H_ 6 #define QUICHE_QUIC_TEST_TOOLS_QUIC_INTERVAL_DEQUE_PEER_H_ 7 8 #include "quiche/quic/core/quic_interval_deque.h" 9 10 namespace quic { 11 12 namespace test { 13 14 class QuicIntervalDequePeer { 15 public: 16 template <class T, class C> GetCachedIndex(QuicIntervalDeque<T,C> * interval_deque)17 static int32_t GetCachedIndex(QuicIntervalDeque<T, C>* interval_deque) { 18 if (!interval_deque->cached_index_.has_value()) { 19 return -1; 20 } 21 return interval_deque->cached_index_.value(); 22 } 23 24 template <class T, class C> GetItem(QuicIntervalDeque<T,C> * interval_deque,const std::size_t index)25 static T* GetItem(QuicIntervalDeque<T, C>* interval_deque, 26 const std::size_t index) { 27 return &interval_deque->container_[index]; 28 } 29 }; 30 31 } // namespace test 32 33 } // namespace quic 34 35 #endif // QUICHE_QUIC_TEST_TOOLS_QUIC_INTERVAL_DEQUE_PEER_H_ 36