1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
/*++
Module Name:
MultiInputReadSupplier.h
Abstract:
Headers for a read supplier that combines other read suppliers. It's used when there are muliple input files to process.
Authors:
Bill Bolosky, November, 2012
Environment:
User mode service.
Revision History:
--*/
#pragma once
#include "Read.h"
#include "Compat.h"
class MultiInputReadSupplier: public ReadSupplier {
public:
MultiInputReadSupplier(int nReadSuppliers, ReadSupplier **i_readSuppliers);
virtual ~MultiInputReadSupplier();
virtual Read *getNextRead();
virtual void holdBatch(DataBatch batch);
virtual bool releaseBatch(DataBatch batch);
private:
// info for a currently active supplier
struct ActiveRead
{
int index; // index in readSuppliers array
DataBatch lastBatch; // last batch read from this supplier
Read* firstReadInNextBatch;
};
int nRemainingReadSuppliers;
int nReadSuppliers;
int nextReadSupplier;
ReadSupplier **readSuppliers;
ActiveRead *activeReadSuppliers;
};
class MultiInputPairedReadSupplier: public PairedReadSupplier {
public:
MultiInputPairedReadSupplier(int nReadSuppliers, PairedReadSupplier **i_pairedReadSuppliers);
virtual ~MultiInputPairedReadSupplier();
virtual bool getNextReadPair(Read **read0, Read **read1);
virtual void holdBatch(DataBatch batch);
virtual bool releaseBatch(DataBatch batch);
private:
// info for a currently active supplier
struct ActiveRead
{
int index; // index in readSuppliers array
DataBatch lastBatch[2]; // last batch read from this supplier
Read* firstReadInNextBatch[2];
};
int nRemainingReadSuppliers;
int nReadSuppliers;
int nextReadSupplier;
PairedReadSupplier **pairedReadSuppliers;
ActiveRead *activeReadSuppliers;
};
class MultiInputReadSupplierGenerator: public ReadSupplierGenerator
{
public:
MultiInputReadSupplierGenerator(int i_nReadSuppliers, ReadSupplierGenerator **i_readSupplierGenerators);
virtual ~MultiInputReadSupplierGenerator();
virtual ReadSupplier *generateNewReadSupplier();
virtual ReaderContext* getContext();
private:
int nReadSuppliers;
ReadSupplierGenerator **readSupplierGenerators;
};
class MultiInputPairedReadSupplierGenerator: public PairedReadSupplierGenerator
{
public:
MultiInputPairedReadSupplierGenerator(int i_nReadSuppliers, PairedReadSupplierGenerator **i_readSupplierGenerators);
virtual ~MultiInputPairedReadSupplierGenerator();
virtual PairedReadSupplier *generateNewPairedReadSupplier();
virtual ReaderContext* getContext();
private:
int nReadSuppliers;
PairedReadSupplierGenerator **readSupplierGenerators;
};
|