primarydriver.cpp
1 /***************************************************************************
2  Copyright (C) 2002-2015 Kentaro Kitagawa
3  kitagawa@phys.s.u-tokyo.ac.jp
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  You should have received a copy of the GNU Library General
11  Public License and a list of authors along with this program;
12  see the files COPYING and AUTHORS.
13 ***************************************************************************/
14 #include "primarydriver.h"
15 
16 XPrimaryDriver::XPrimaryDriver(const char *name, bool runtime,
17  Transaction &tr_meas, const shared_ptr<XMeasure> &meas) :
18  XDriver(name, runtime, tr_meas, meas) {
19 }
20 
21 void
22 XPrimaryDriver::finishWritingRaw(const shared_ptr<const RawData> &rawdata,
23  const XTime &time_awared, const XTime &time_recorded_org) {
24 
25  XTime time_recorded = time_recorded_org;
26  XKameError err;
27  Snapshot shot = iterate_commit([=, &time_recorded, &err](Transaction &tr){
28  bool skipped = false;
29  if(time_recorded) {
30  try {
31  RawDataReader reader( *rawdata);
32  tr[ *this].m_rawData = rawdata;
33  analyzeRaw(reader, tr);
34  }
35  catch (XSkippedRecordError& e) {
36  skipped = true;
37  err = e;
38  }
39  catch (XRecordError& e) {
40  time_recorded = XTime(); //record is invalid
41  err = e;
42  }
43  }
44  if( !skipped)
45  record(tr, time_awared, time_recorded);
46  });
47  if(err.msg().length())
48  err.print(getLabel() + ": ");
49  visualize(shot);
50 }

Generated for KAME4 by  doxygen 1.8.3