11 #include <boost/tuple/tuple.hpp>
21 KernelReader::KernelReader(
const std::string &observationFileName) :
22 observationFileName_(observationFileName), idx_(-1)
28 KernelReader::~KernelReader()
33 void KernelReader::init_()
38 Serial::readObject(kc_, observationFileName_);
39 }
catch (SerialError& e) {
40 throw ObservationIOError(e.what());
46 void KernelReader::reset()
53 NUKLEI_UNIQUE_PTR<Observation> KernelReader::readObservation_()
56 if (idx_ < 0)
NUKLEI_THROW(
"Reader does not seem inited.");
57 if (idx_ >=
int(kc_.size()))
return NUKLEI_UNIQUE_PTR<Observation>();
58 else return NUKLEI_UNIQUE_PTR<Observation>(
new SerializedKernelObservation(kc_.at(idx_++)));
62 KernelWriter::KernelWriter(
const std::string &observationFileName) :
63 observationFileName_(observationFileName)
69 KernelWriter::~KernelWriter()
73 void KernelWriter::init()
80 void KernelWriter::reset()
87 void KernelWriter::writeBuffer()
90 Serial::writeObject(kc_, observationFileName_);
94 void KernelWriter::writeObservation(
const Observation &o)
97 kc_.add(*o.getKernel());