This commit is contained in:
Adam Ierymenko 2019-08-20 15:36:18 -07:00
parent 3a21fdc304
commit fe8815f80f
No known key found for this signature in database
GPG Key ID: 1657198823E52A61

View File

@ -40,13 +40,12 @@ namespace ZeroTier {
* A circular buffer
*
* For fast handling of continuously-evolving variables (such as path quality metrics).
* Using this, we can maintain longer sliding historical windows for important path
* Using this, we can maintain longer sliding historical windows for important path
* metrics without the need for potentially expensive calls to memcpy/memmove.
*
* Some basic statistical functionality is implemented here in an attempt
* to reduce the complexity of code needed to interact with this type of buffer.
*/
template <class T,size_t S>
class RingBuffer
{
@ -73,7 +72,7 @@ public:
return buf + begin;
}
/**
/**
* Adjust buffer index pointer as if we copied data in
* @param n Number of elements to copy in
* @return Number of elements we copied in
@ -96,13 +95,13 @@ public:
return n;
}
/**
* Fast erase, O(1).
/**
* Fast erase, O(1).
* Merely reset the buffer pointer, doesn't erase contents
*/
inline void reset() { consume(count()); }
/**
/**
* adjust buffer index pointer as if we copied data out
* @param n Number of elements we copied from the buffer
* @return Number of elements actually available from the buffer