summaryrefslogtreecommitdiff
path: root/node/Buffer.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-10-06 11:47:16 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-10-06 11:47:16 -0700
commit5341afcdcd7d2d1ae5546ae44024d039b03ccad3 (patch)
treeee2ccf4dcea1e4925c50af6b3bbedad4e57da65a /node/Buffer.hpp
parent57c857e89a1b4616ffb091b9d834c68b4b8d93d0 (diff)
downloadinfinitytier-5341afcdcd7d2d1ae5546ae44024d039b03ccad3.tar.gz
infinitytier-5341afcdcd7d2d1ae5546ae44024d039b03ccad3.zip
Handling of CIRCUIT_TEST, should be ready to test.
Diffstat (limited to 'node/Buffer.hpp')
-rw-r--r--node/Buffer.hpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/node/Buffer.hpp b/node/Buffer.hpp
index 789b835a..46924c14 100644
--- a/node/Buffer.hpp
+++ b/node/Buffer.hpp
@@ -392,6 +392,23 @@ public:
}
/**
+ * Erase something from the middle of the buffer
+ *
+ * @param start Starting position
+ * @param length Length of block to erase
+ * @throw std::out_of_range Position plus length is beyond size of buffer
+ */
+ inline void erase(const unsigned int at,const unsigned int length)
+ throw(std::out_of_range)
+ {
+ const unsigned int endr = at + length;
+ if (endr > _l)
+ throw std::out_of_range("Buffer: erase() range beyond end of buffer");
+ ::memmove(_b + at,_b + endr,_l - endr);
+ _l -= length;
+ }
+
+ /**
* Set buffer data length to zero
*/
inline void clear()