示例#1
0
			static void multiwayMergeFiles(
				std::vector < std::string > const & inputfilenames,
				std::string const & outputfilename
				)
			{
				typedef ::libmaus2::graph::TripleEdgeInput input_type;
				typedef input_type::unique_ptr_type input_ptr_type;
				::libmaus2::autoarray::AutoArray<input_ptr_type> inputs(inputfilenames.size());
				
				for ( uint64_t i = 0; i < inputfilenames.size(); ++i )
				{
					input_ptr_type tinputsi (
                                                new input_type ( inputfilenames[i] , 32*1024 )
                                                );
					inputs[i] = UNIQUE_PTR_MOVE(tinputsi);
				}
						
				::libmaus2::autoarray::AutoArray < ::libmaus2::graph::TripleEdge > triples(inputfilenames.size());
				::libmaus2::autoarray::AutoArray < bool > ok(inputfilenames.size());
			
				::libmaus2::graph::TripleEdgeOutputMerge output(outputfilename, 32*1024);

				for ( uint64_t i = 0; i < inputfilenames.size(); ++i )
					ok [i] = inputs[i]->getNextTriple ( triples[i] );

				while ( anyTrue ( ok ) )
				{
					uint64_t const minidx = minOk(ok,triples);
					output.write ( triples[minidx] );
					ok[minidx] = inputs[minidx]->getNextTriple( triples[minidx] );
				}
			}
示例#2
0
    bool for_each_span_while( Pred f) const
    {
        if( size() < 2)
            return false;

        bezier::curve_t<Imath::V2f> span;

        for( shape_t::const_triple_iterator it( triples().begin()); it != triples().end()-1; )
        {
            span.p[0] = it->p1();
            span.p[1] = it->p2();
            ++it;
            span.p[2] = it->p0();
            span.p[3] = it->p1();

            if( f( span))
                return true;
        }

        if( closed())
        {
            span.p[0] = triples().back().p1();
            span.p[1] = triples().back().p2();
            span.p[2] = triples().front().p0();
            span.p[3] = triples().front().p1();

            if( f( span))
                return true;
        }

        return false;
    }