summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/devices/nld_log.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/netlist/devices/nld_log.cpp')
-rw-r--r--src/lib/netlist/devices/nld_log.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/lib/netlist/devices/nld_log.cpp b/src/lib/netlist/devices/nld_log.cpp
index c2a6523f64a..a3dae6a4b39 100644
--- a/src/lib/netlist/devices/nld_log.cpp
+++ b/src/lib/netlist/devices/nld_log.cpp
@@ -1,4 +1,4 @@
-// license:GPL-2.0+
+// license:BSD-3-Clause
// copyright-holders:Couriersud
/*
* nld_log.cpp
@@ -28,10 +28,8 @@
#include <thread>
#include <vector>
-namespace netlist
-{
- namespace devices
- {
+namespace netlist::devices {
+
NETLIB_OBJECT(log)
{
NETLIB_CONSTRUCTOR(log)
@@ -102,7 +100,7 @@ namespace netlist
for (auto &e : b)
/* use pstring::sprintf, it is a LOT faster */
- m_writer.writeline(plib::pfmt("{1:.9} {2}").e(e.t.as_fp<nl_fptype>()).e(e.v));
+ m_writer.write_line(plib::pfmt("{1:.9} {2}").e(e.t.as_fp<nl_fptype>()).e(e.v));
b.clear();
m_sem_r.release();
m_r++;
@@ -119,6 +117,7 @@ namespace netlist
static constexpr std::size_t BUF_SIZE=16384;
static constexpr std::size_t BUFFERS=4;
analog_input_t m_I;
+ private:
plib::ofstream m_strm;
plib::putf8_writer m_writer;
bool m_reset;
@@ -131,14 +130,17 @@ namespace netlist
std::thread m_write_thread;
};
- NETLIB_OBJECT_DERIVED(logD, log)
+ class NETLIB_NAME(logD) : public NETLIB_NAME(log)
{
- NETLIB_CONSTRUCTOR(logD)
- , m_I2(*this, "I2", nldelegate(&NETLIB_NAME(logD)::input, this))
+ public:
+ NETLIB_NAME(logD)(constructor_param_t data)
+ : NETLIB_NAME(log)(data)
+ , m_I2(*this, "I2", nl_delegate(&NETLIB_NAME(logD)::input, this))
{
- m_I.set_delegate(nldelegate(&NETLIB_NAME(logD)::input, this));
+ m_I.set_delegate(nl_delegate(&NETLIB_NAME(logD)::input, this));
}
+ private:
NETLIB_HANDLERI(input)
{
log_value(static_cast<nl_fptype>(m_I() - m_I2()));
@@ -153,7 +155,7 @@ namespace netlist
~NETLIB_NAME(wav)();
analog_input_t m_I;
private:
- // FIXME: rewrite sound/wavwrite.h to be an object ...
+ // FIXME: rewrite `sound/wavwrite.h` to be an object ...
void *m_file;
);
#endif
@@ -162,7 +164,7 @@ namespace netlist
// FIXME: Implement wav later, this must be clock triggered device where the input to be written
- // is on a subdevice ..
+ // is on a sub device ..
#if 0
NETLIB_START(wav)
{
@@ -187,5 +189,4 @@ namespace netlist
NETLIB_DEVICE_IMPL(log, "LOG", "+I")
NETLIB_DEVICE_IMPL(logD, "LOGD", "+I,+I2")
- } //namespace devices
-} // namespace netlist
+} // namespace netlist::devices