+template<class INT>
+INT blocks( const INT &bytes ) {
+ INT numblocks = bytes / bytes_in_block;
+ if( 0 != bytes % bytes_in_block ) numblocks++;
+
+ return numblocks;
+}
+
+template<class ITER, class INT>
+void sizes( ITER begin, const ITER &end, INT &numblocks, INT &numbytes ) {
+ numblocks = 0;
+ numbytes = 0;
+
+ while( begin != end ) {
+ INT filesize = (*begin)->getFileSize();
+
+ numbytes += filesize;
+ numblocks += blocks( filesize );
+ begin++;
+ }
+}
+
+template<class I, class O>
+void copy_filenames( I begin, const I &end, O out ) {
+ while( begin != end ) {
+ string output = (*begin)->getFileName();
+ output.push_back( 0 );
+ *out = output;
+ ++out;
+ ++begin;
+ }
+}
+
+template<class ITER>
+void updateLastBackupDate( ITER begin, const ITER &end, unsigned long long date ) {
+ while( begin != end ) {
+ (*begin)->setLastBackupDate( date );
+ ++begin;
+ }
+}
+
+template<class ITER>
+void delete_objects( ITER begin, const ITER &end ) {
+ while( begin != end ) {
+ delete *begin;
+ ++begin;
+ }
+}
+