File: SimulationThread.cpp

package info (click to toggle)
dyssol 1.5.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,204 kB
  • sloc: cpp: 53,870; sh: 85; python: 59; makefile: 11
file content (45 lines) | stat: -rw-r--r-- 841 bytes parent folder | download
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
/* Copyright (c) 2023, DyssolTEC GmbH.
 * All rights reserved. This file is part of Dyssol. See LICENSE file for license information. */

#include "SimulationThread.h"

CSimulationThread::CSimulationThread(const RunFunc& _run, const StopFunc& _stop, QObject* _parent)
	: CBasicThread{ _parent }
	, m_run{ _run }
	, m_stop{ _stop }
{
}

CSimulationThread::CSimulationThread(QObject* _parent)
	: CSimulationThread{ RunFunc{}, StopFunc{}, _parent }
{
}

void CSimulationThread::SetFunctions(const RunFunc& _run, const StopFunc& _stop)
{
	m_run = _run;
	m_stop = _stop;
}

bool CSimulationThread::WasAborted() const
{
	return m_aborted;
}

void CSimulationThread::StartTask()
{
	m_aborted = false;	// reset flag

	if (m_run)
		m_run();

	emit Finished();
}

void CSimulationThread::RequestStop()
{
	if (m_stop)
		m_stop();

	m_aborted = true;
}