--- nono/lib/fixedqueue.h 2026/04/29 17:04:28 1.1.1.1 +++ nono/lib/fixedqueue.h 2026/04/29 17:04:30 1.1.1.3 @@ -3,6 +3,8 @@ // Copyright (C) 2018 isaki@NetBSD.org // +#pragma once + #include "header.h" #include @@ -76,9 +78,14 @@ class FixedQueue return length; } + // 要素が一杯なら true を返す + bool IsFull() const { + return (length >= capacity); + } + // 要素を覗き見る。 // idx は 0 .. length-1 までで、0 がキューの先頭。 - T Peek(int idx) { + T Peek(int idx) const { // XXX 範囲チェックすべきだがとりあえず return buf[(start + idx) % capacity]; }