Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+119
@@ -0,0 +1,119 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Firing Timer, a helperclass for ExplosionCluster
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Norbert Thoden, ESVG, 2024-09-03
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "aes_export.h"
|
||||
#include "../logger.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
#define SUPPORT_STATE_CHANGE_DELAYED
|
||||
|
||||
|
||||
namespace AreaEffectSimulation
|
||||
{
|
||||
|
||||
class AES_COMMON_EXPORT FiringTimer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
using BaseClass = QObject;
|
||||
|
||||
public:
|
||||
|
||||
enum class CMD
|
||||
{
|
||||
CMD_UNDEFINED,
|
||||
CMD_START,
|
||||
CMD_RESUME,
|
||||
CMD_PAUSE,
|
||||
CMD_EXPIRED,
|
||||
CMD_EXPIRED_PLUS,
|
||||
};
|
||||
Q_ENUM(CMD);
|
||||
|
||||
|
||||
enum class FiringMode
|
||||
{
|
||||
FM_Undefined = 0, //
|
||||
FM_Prepared = 1, //
|
||||
FM_Active = 2, //
|
||||
FM_Paused = 3, //
|
||||
FM_Expired = 4, //
|
||||
FM_ExpiredPlus = 6 //
|
||||
};
|
||||
|
||||
// ctor/dtor
|
||||
explicit FiringTimer(const QString &debugInfo = QStringLiteral("FiringTimer"));
|
||||
~FiringTimer();
|
||||
|
||||
void setDebugInfo(const QString &debugInfo);
|
||||
|
||||
// initialisation
|
||||
bool init(long effectDurationMsec, int ammoCount, long ammoFlightDurationMsec);
|
||||
void reset();
|
||||
|
||||
//
|
||||
bool startFiring();
|
||||
bool pauseFiring();
|
||||
bool resumeFiring();
|
||||
|
||||
|
||||
FiringMode currentFiringMode() const;
|
||||
long ammoFlightDurationMsec() const;
|
||||
int firedAmmoCount() const;
|
||||
int nextAmmoToFire() const;
|
||||
int remainingAmmoCount() const;
|
||||
long intervallMsec() const;
|
||||
|
||||
|
||||
QStringList getLogHistorie() const;
|
||||
|
||||
static QString toString(const CMD cmd);
|
||||
|
||||
public Q_SLOTS:
|
||||
bool startFiringDelay(qint64 delayMsec);
|
||||
|
||||
Q_SIGNALS:
|
||||
void firing(int currentFiringNumber, int totalAmmoCount);
|
||||
void impact(int currentImpactNumber, int totalAmmoCount);
|
||||
|
||||
void firingFinished();
|
||||
void firingFinishedPlus();
|
||||
|
||||
#ifdef SUPPORT_STATE_CHANGE_DELAYED
|
||||
// Q_SIGNALS:
|
||||
// void stateChangeDelayed(AreaEffectSimulation::FiringTimer::CMD cmd); // problems: Q_DECLARE_METATYPE and/or qRegisterMetatType... - grrrr
|
||||
void stateChangeDelayedAsInt(int cmdAsInt, int firedAmmoCount);
|
||||
public Q_SLOTS:
|
||||
void emitStateChangeDelayed(FiringTimer::CMD cmd, int firedAmmoCount);
|
||||
#endif // SUPPORT_STATE_CHANGE_DELAYED
|
||||
|
||||
protected Q_SLOTS:
|
||||
void onFiringTimout();
|
||||
void onFiringTimoutExpiredPlus();
|
||||
|
||||
|
||||
private:
|
||||
class Private;
|
||||
|
||||
Private *d;
|
||||
LOGGER_T m_logger; ///< Interface of the Logging-Facility
|
||||
};
|
||||
|
||||
AES_COMMON_EXPORT std::ostream &operator<< (std::ostream &stream, const FiringTimer::CMD value);
|
||||
|
||||
} // namespace AreaEffectSimulation
|
||||
|
||||
// at global scope
|
||||
Q_DECLARE_METATYPE(AreaEffectSimulation::FiringTimer::CMD);
|
||||
Reference in new issue
Block a user