00001 /***************************************************************************** 00002 * Author: Valient Gough <vgough@pobox.com> 00003 * 00004 ***************************************************************************** 00005 * Copyright (c) 2001, Valient Gough 00006 * 00007 * This library is free software; you can distribute it and/or modify it under 00008 * the terms of the GNU Lesser General Public License (LGPL), as published by 00009 * the Free Software Foundation; either version 2.1 of the License, or (at your 00010 * option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, but WITHOUT 00013 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 * FITNESS FOR A PARTICULAR PURPOSE. See the LGPL in the file COPYING for more 00015 * details. 00016 * 00017 */ 00018 00019 #ifndef _DeviceRewinder_incl_ 00020 #define _DeviceRewinder_incl_ 00021 00022 #include <rel/TypeStream.h> 00023 00024 namespace rel 00025 { 00026 00037 class DeviceRewinder 00038 { 00039 public: 00040 /* It is ok to use a const restartable coding with a DeviceRewinder, 00041 * because it makes sure the the coding is restarted when it is done, 00042 * so it is effectively const (as long as there are no interleaved 00043 * accesses by users). 00044 */ 00045 explicit DeviceRewinder(const TypeStream &coding); 00046 explicit DeviceRewinder(const TypeStream *coding); 00047 DeviceRewinder(const DeviceRewinder &src); 00048 00049 ~DeviceRewinder(); 00050 00051 void reset() const; 00052 00053 operator TypeStream * () const; 00054 operator const TypeStream & () const; 00055 00056 private: 00057 const TypeStream *fCoding; 00058 int fBegin; 00059 00060 }; 00061 00062 } // namespace rel 00063 00064 #endif