pktfifo.hh (11263:8dcc6b40f164) | pktfifo.hh (11294:a368064a2ab5) |
---|---|
1/* 2 * Copyright (c) 2004-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 92 unchanged lines hidden (view full) --- 101 unsigned reserved() const { return _reserved; } 102 unsigned avail() const { return _maxsize - _size - _reserved; } 103 bool empty() const { return size() <= 0; } 104 bool full() const { return avail() <= 0; } 105 106 unsigned 107 reserve(unsigned len = 0) 108 { | 1/* 2 * Copyright (c) 2004-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 92 unchanged lines hidden (view full) --- 101 unsigned reserved() const { return _reserved; } 102 unsigned avail() const { return _maxsize - _size - _reserved; } 103 bool empty() const { return size() <= 0; } 104 bool full() const { return avail() <= 0; } 105 106 unsigned 107 reserve(unsigned len = 0) 108 { |
109 assert(avail() >= len); |
|
109 _reserved += len; | 110 _reserved += len; |
110 assert(avail() >= 0); | |
111 return _reserved; 112 } 113 114 iterator begin() { return fifo.begin(); } 115 iterator end() { return fifo.end(); } 116 117 const_iterator begin() const { return fifo.begin(); } 118 const_iterator end() const { return fifo.end(); } --- 94 unchanged lines hidden --- | 111 return _reserved; 112 } 113 114 iterator begin() { return fifo.begin(); } 115 iterator end() { return fifo.end(); } 116 117 const_iterator begin() const { return fifo.begin(); } 118 const_iterator end() const { return fifo.end(); } --- 94 unchanged lines hidden --- |