+void
+RLEEncoder::addBit(usint value)
+{
+ this->addRun(value, 1);
+}
+
+void
+RLEEncoder::addRun(usint start, usint len)
+{
+ if(this->run.second == 0)
+ {
+ this->run = pair_type(start, len);
+ }
+ else if(start == this->run.first + this->run.second)
+ {
+ this->run.second += len;
+ }
+ else
+ {
+ this->setRun(this->run.first, this->run.second);
+ this->run = pair_type(start, len);
+ }
+}
+
+void
+RLEEncoder::flush()
+{
+ this->setRun(this->run.first, this->run.second);
+ this->run.second = 0;
+}
+