mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-08-07 18:23:57 +00:00
ref[protocol]: cpp protocol
This commit is contained in:
@@ -120,10 +120,10 @@ namespace zfoo {
|
||||
void setWriteOffset(int32_t writeIndex) {
|
||||
if (writeIndex > max_capacity) {
|
||||
string errorMessage =
|
||||
"writeIndex[" + std::to_string(writeIndex) + "] out of bounds exception: readIndex: " +
|
||||
"writeIndex[" + std::to_string(writeIndex) + "] out of bounds exception: readOffset: " +
|
||||
std::to_string(readOffset) +
|
||||
", writIndex: " + std::to_string(writeOffset) +
|
||||
"(expected: 0 <= readIndex <= writeIndex <= capacity:" + std::to_string(max_capacity);
|
||||
", writeOffset: " + std::to_string(writeOffset) +
|
||||
"(expected: 0 <= readOffset <= writeOffset <= capacity:" + std::to_string(max_capacity);
|
||||
throw errorMessage;
|
||||
}
|
||||
writeOffset = writeIndex;
|
||||
@@ -132,10 +132,10 @@ namespace zfoo {
|
||||
void setReadOffset(int32_t readIndex) {
|
||||
if (readIndex > writeOffset) {
|
||||
string errorMessage =
|
||||
"readIndex[" + std::to_string(readIndex) + "] out of bounds exception: readIndex: " +
|
||||
"readIndex[" + std::to_string(readIndex) + "] out of bounds exception: readOffset: " +
|
||||
std::to_string(readOffset) +
|
||||
", writeIndex: " + std::to_string(writeOffset) +
|
||||
"(expected: 0 <= readIndex <= writeIndex <= capacity:" + std::to_string(max_capacity);
|
||||
", writeOffset: " + std::to_string(writeOffset) +
|
||||
"(expected: 0 <= readOffset <= writeOffset <= capacity:" + std::to_string(max_capacity);
|
||||
throw errorMessage;
|
||||
}
|
||||
readOffset = readIndex;
|
||||
|
||||
@@ -120,10 +120,10 @@ namespace zfoo {
|
||||
void setWriteOffset(int32_t writeIndex) {
|
||||
if (writeIndex > max_capacity) {
|
||||
string errorMessage =
|
||||
"writeIndex[" + std::to_string(writeIndex) + "] out of bounds exception: readIndex: " +
|
||||
"writeIndex[" + std::to_string(writeIndex) + "] out of bounds exception: readOffset: " +
|
||||
std::to_string(readOffset) +
|
||||
", writIndex: " + std::to_string(writeOffset) +
|
||||
"(expected: 0 <= readIndex <= writeIndex <= capacity:" + std::to_string(max_capacity);
|
||||
", writeOffset: " + std::to_string(writeOffset) +
|
||||
"(expected: 0 <= readOffset <= writeOffset <= capacity:" + std::to_string(max_capacity);
|
||||
throw errorMessage;
|
||||
}
|
||||
writeOffset = writeIndex;
|
||||
@@ -132,10 +132,10 @@ namespace zfoo {
|
||||
void setReadOffset(int32_t readIndex) {
|
||||
if (readIndex > writeOffset) {
|
||||
string errorMessage =
|
||||
"readIndex[" + std::to_string(readIndex) + "] out of bounds exception: readIndex: " +
|
||||
"readIndex[" + std::to_string(readIndex) + "] out of bounds exception: readOffset: " +
|
||||
std::to_string(readOffset) +
|
||||
", writeIndex: " + std::to_string(writeOffset) +
|
||||
"(expected: 0 <= readIndex <= writeIndex <= capacity:" + std::to_string(max_capacity);
|
||||
", writeOffset: " + std::to_string(writeOffset) +
|
||||
"(expected: 0 <= readOffset <= writeOffset <= capacity:" + std::to_string(max_capacity);
|
||||
throw errorMessage;
|
||||
}
|
||||
readOffset = readIndex;
|
||||
|
||||
Reference in New Issue
Block a user