+/// Helper class, to guarantee that the export status
+/// gets reset properly. To use, simply create a local variable:
+/// MarkAsExporting mex(bufptr);
+/// and leave the rest to us.
+class MarkAsExporting {
+public:
+ MarkAsExporting(Buffer const * buf) : buf_(buf)
+ {
+ buf_->setExportStatus(true);
+ }
+ ~MarkAsExporting()
+ {
+ buf_->setExportStatus(false);
+ }
+private:
+ Buffer const * const buf_;
+};
+
+