Exemplo n.º 1
0
void removeSequence( const sp::Sequence& s )
{
	std::ssize_t first;
	std::ssize_t last;
	if( selectRange )
	{
		first = std::max( s.getFirstTime(), firstImage );
		last  = std::min( s.getLastTime(), lastImage );
	}
	else
	{
		first = s.getFirstTime();
		last  = s.getLastTime();
	}
//	TUTTLE_TCOUT( "remove sequence." );
//	TUTTLE_TCOUT("remove from " << first << " to " << last);

	for( sp::Time t = first; t <= last; t += s.getStep() )
	{
		bfs::path sFile = s.getAbsoluteFilenameAt(t);
		if( !bfs::exists( sFile ) )
		{
			TUTTLE_CERR("Could not remove (file not exist): " << _color._red << sFile.string() << _color._std );
		}
		else
		{
			if(verbose)
			{
				TUTTLE_COUT("remove: " << _color._folder << sFile.string() << _color._std );
			}
			try
			{
				bfs::remove( sFile );
			}
			catch(const boost::filesystem::filesystem_error& e)
			{
//			   if( e.code() == boost::system::errc::permission_denied )
//				   "permission denied"
				TUTTLE_CERR( "sam-rm: Error:\t\n" << e.what() );
				/// @todo cin
//				TUTTLE_COUT( "sam-rm: Continue ? (Yes/No/Yes for All/No for All)" );
				
			}
		}
	}
}
Exemplo n.º 2
0
void dumpImageProperties( const sp::Sequence& s )
{
	TUTTLE_COUT(s);
	printImageProperties( s.getAbsoluteFirstFilename() );
	sam::wasSthgDumped = true;
}
Exemplo n.º 3
0
void copy_sequence( const sp::Sequence& s, const sp::Time firstImage, const sp::Time lastImage, const sp::Sequence& d, int offset = 0 )
{
	sp::Time begin;
	sp::Time end;
	sp::Time step;
	if (offset > 0) {
		begin = lastImage;
		end = firstImage;
		step = -s.getStep();
	} else {
		begin = firstImage;
		end = lastImage;
		step = s.getStep();
	}
	
	for( sp::Time t = begin;
		 (offset > 0) ? (t >= end) :
		 (t <= end); t += step )
	{
		bfs::path sFile = s.getAbsoluteFilenameAt(t);
		//TUTTLE_TLOG_VAR( TUTTLE_TRACE, sFile );
		if( bfs::exists( sFile) )
		{
			bfs::path dFile = d.getAbsoluteFilenameAt(t + offset);
			//TUTTLE_TLOG( TUTTLE_TRACE, "do " << sFile << " -> " << dFile );
#ifndef SAM_MOVEFILES // copy file(s)
			if( bfs::exists(dFile) )
			{
				TUTTLE_LOG_ERROR( "Could not copy: " << dFile.string( ) );
			}
			else
			{
				try
				{
					//TUTTLE_LOG_TRACE( "copy " << sFile << " -> " << dFile );
					bfs::copy_file(sFile, dFile);
				}
				catch (const bpo::error& e)
				{
					TUTTLE_LOG_ERROR( "error : " << e.what() );
				}
				catch (...)
				{
					TUTTLE_LOG_ERROR( boost::current_exception_diagnostic_information( ) );
				}
			}
#else // move file(s)
			if( bfs::exists( dFile ) )
			{
				TUTTLE_LOG_ERROR( "Could not move: " << dFile.string( ) );
			}
			else
			{
				try
				{
					//TUTTLE_LOG_TRACE( "move " << sFile << " -> " << dFile );
					bfs::rename( sFile, dFile );
				}
				catch( const bpo::error& e )
				{
					TUTTLE_LOG_ERROR( "error : " << e.what() );
				}
				catch( ... )
				{
					TUTTLE_LOG_ERROR( boost::current_exception_diagnostic_information( ) );
				}
			}
#endif
		}
	}
}
Exemplo n.º 4
0
void copy_sequence( const sp::Sequence& s, const bfs::path& d, const sp::Time offset = 0 )
{
	copy_sequence( s, s.getFirstTime(), s.getLastTime(), d, offset );
}
Exemplo n.º 5
0
void diffSequence(Graph::Node& read1, Graph::Node& read2, Graph::Node& stat, Graph& graph, const sp::Sequence& seq1, const sp::Sequence& seq2, const sp::Time first,
                  const sp::Time last) {
    for (sp::Time t = first; t <= last; ++t) {
        diffFile(read1, read2, stat, graph, seq1.getAbsoluteFilenameAt(t), seq2.getAbsoluteFilenameAt(t));
    }
}
Exemplo n.º 6
0
void diffSequence(Graph::Node& read1, Graph::Node& read2, Graph::Node& stat, Graph& graph, const sp::Sequence& seq1, const sp::Sequence& seq2) {
    for (sp::Time t = seq1.getFirstTime(); t <= seq1.getLastTime(); ++t) {
        diffFile(read1, read2, stat, graph, seq1.getAbsoluteFilenameAt(t), seq2.getAbsoluteFilenameAt(t));
    }
}