driver.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 "driver.h"
15 #include "interface.h"
16 
17 DECLARE_TYPE_HOLDER(XDriverList)
18 
19 XDriverList::XDriverList(const char *name, bool runtime,
20  const shared_ptr<XMeasure> &measure) :
21  XCustomTypeListNode<XDriver>(name, runtime),
22  m_measure(measure) {
23 }
24 
25 shared_ptr<XNode>
26 XDriverList::createByTypename(const XString &type, const XString& name) {
27  shared_ptr<XMeasure> measure(m_measure.lock());
28  shared_ptr<XNode> ptr;
29  measure->iterate_commit_if([=, &ptr](Transaction &tr)->bool{
30  ptr = creator(type)
31  (name.c_str(), false, ref(tr), measure);
32  if(ptr)
33  if( !insert(tr, ptr))
34  return false;
35  return true;
36  });
37  return ptr;
38 }
39 
40 XDriver::XBufferUnderflowRecordError::XBufferUnderflowRecordError(const char *file, int line) :
41  XRecordError(i18n("Buffer Underflow."), file, line) {}
42 
43 XDriver::XDriver(const char *name, bool runtime, Transaction &tr_meas, const shared_ptr<XMeasure> &meas) :
44  XNode(name, runtime) {
45 }
46 
47 void
49  const XTime &time_awared, const XTime &time_recorded) {
50  tr[ *this].m_awaredTime = time_awared;
51  tr[ *this].m_recordTime = time_recorded;
52  tr.mark(tr[ *this].onRecord(), this);
53 }

Generated for KAME4 by  doxygen 1.8.3