diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-07-10 17:24:27 -0400 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-07-10 17:24:27 -0400 |
commit | 9e28bbfbb2671f71527e76dd20fe4a659109ad4b (patch) | |
tree | 8017270bb4dfc7570c40797d73b02df7d37b99d9 /node/Buffer.hpp | |
parent | 47f611e7b8d2ff95a3ff795574798b4e24a6719d (diff) | |
download | infinitytier-9e28bbfbb2671f71527e76dd20fe4a659109ad4b.tar.gz infinitytier-9e28bbfbb2671f71527e76dd20fe4a659109ad4b.zip |
Factored out multicast propagation algorithm from Switch and Topology, also cleaned up and clarified it a bit.
Diffstat (limited to 'node/Buffer.hpp')
-rw-r--r-- | node/Buffer.hpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/node/Buffer.hpp b/node/Buffer.hpp index 0320ddb7..ed463bf6 100644 --- a/node/Buffer.hpp +++ b/node/Buffer.hpp @@ -241,6 +241,22 @@ public: } /** + * Append a run of bytes + * + * @param c Character value to append + * @param n Number of times to append + * @throws std::out_of_range Attempt to append beyond capacity + */ + inline void append(unsigned char c,unsigned int n) + throw(std::out_of_range) + { + if ((_l + n) > C) + throw std::out_of_range("Buffer: append beyond capacity"); + for(unsigned int i=0;i<n;++i) + _b[_l++] = (char)c; + } + + /** * Append a C-array of bytes * * @param b Data |