| 1 |
/* |
| 2 |
* Copyright (C) 2013-2015, 2019 by the Konclude Developer Team. |
| 3 |
* |
| 4 |
* This file is part of the reasoning system Konclude. |
| 5 |
* For details and support, see <http://konclude.com/>. |
| 6 |
* |
| 7 |
* Konclude is free software: you can redistribute it and/or modify |
| 8 |
* it under the terms of version 3 of the GNU Lesser General Public |
| 9 |
* License (LGPLv3) as published by the Free Software Foundation. |
| 10 |
* |
| 11 |
* Konclude is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU (Lesser) General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU (Lesser) General Public |
| 17 |
* License along with Konclude. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
*/ |
| 20 |
#include "CIntervalThreadData.h" |
| 21 |
|
| 22 |
|
| 23 |
namespace Konclude { |
| 24 |
|
| 25 |
namespace Concurrent { |
| 26 |
|
| 27 |
|
| 28 |
CIntervalThreadData::CIntervalThreadData() { |
| 29 |
id = 0; |
| 30 |
timerID = 0; |
| 31 |
interval = 0; |
| 32 |
active = false; |
| 33 |
deactivateCount = 0; |
| 34 |
remInvocations = 0; |
| 35 |
} |
| 36 |
|
| 37 |
CIntervalThreadData::~CIntervalThreadData() { |
| 38 |
} |
| 39 |
|
| 40 |
|
| 41 |
void CIntervalThreadData::setTimerID(qint64 timerID) { |
| 42 |
id = timerID; |
| 43 |
} |
| 44 |
|
| 45 |
qint64 CIntervalThreadData::getTimerID() { |
| 46 |
return id; |
| 47 |
} |
| 48 |
|
| 49 |
void CIntervalThreadData::setInterval(qint64 timerInterval) { |
| 50 |
interval = timerInterval; |
| 51 |
} |
| 52 |
|
| 53 |
qint64 CIntervalThreadData::getInterval() { |
| 54 |
return interval; |
| 55 |
} |
| 56 |
|
| 57 |
void CIntervalThreadData::setTimerActive(bool timerIsActive) { |
| 58 |
active = timerIsActive; |
| 59 |
} |
| 60 |
|
| 61 |
bool CIntervalThreadData::isTimerActive() { |
| 62 |
return active; |
| 63 |
} |
| 64 |
|
| 65 |
void CIntervalThreadData::setTimerThreadID(qint64 timerThreadID) { |
| 66 |
timerID = timerThreadID; |
| 67 |
} |
| 68 |
|
| 69 |
qint64 CIntervalThreadData::getTimerThreadID() { |
| 70 |
return timerID; |
| 71 |
} |
| 72 |
|
| 73 |
void CIntervalThreadData::incDeactivateCount() { |
| 74 |
deactivateCount++; |
| 75 |
} |
| 76 |
|
| 77 |
void CIntervalThreadData::decDeactivateCount() { |
| 78 |
deactivateCount--; |
| 79 |
if (deactivateCount < 0) { |
| 80 |
deactivateCount = 0; |
| 81 |
} |
| 82 |
} |
| 83 |
|
| 84 |
qint64 CIntervalThreadData::getDeactivateCount() { |
| 85 |
return deactivateCount; |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
void CIntervalThreadData::setRemainingTimerInvocations(qint64 remInvoc) { |
| 90 |
remInvocations = remInvoc; |
| 91 |
} |
| 92 |
|
| 93 |
qint64 CIntervalThreadData::getRemainingTimerInvocations() { |
| 94 |
return remInvocations; |
| 95 |
} |
| 96 |
|
| 97 |
bool CIntervalThreadData::hasRemainingTimerInvocations() { |
| 98 |
return remInvocations > 0 || remInvocations == -1; |
| 99 |
} |
| 100 |
|
| 101 |
void CIntervalThreadData::decRemainingTimerInvocations(qint64 decCount) { |
| 102 |
if (remInvocations > 0) { |
| 103 |
remInvocations -= decCount; |
| 104 |
if (remInvocations < 0) { |
| 105 |
remInvocations = 0; |
| 106 |
} |
| 107 |
} |
| 108 |
} |
| 109 |
|
| 110 |
|
| 111 |
}; // end namespace Concurrent |
| 112 |
|
| 113 |
}; // end namespace Konclude |