CuteHMI - Services (CuteHMI.Services.3)
|
Service group. More...
#include <cutehmi/services/ServiceGroup.hpp>
Public Types | |
enum | EventType { CONDITION_CHECK_EVENT = QEvent::User + 1 , SUBCLASS_EVENT } |
Public Types inherited from cutehmi::services::Serviceable | |
typedef std::function< void(QState &state, const QString &status)> | AssignStatusFunction |
Public Slots | |
void | postConditionCheckEvent () const |
Public Slots inherited from cutehmi::services::AbstractService | |
void | start () |
void | stop () |
void | activate () |
Signals | |
void | startedCountChanged () |
void | startingCountChanged () |
void | stoppingCountChanged () |
void | stoppedCountChanged () |
void | brokenCountChanged () |
void | repairingCountChanged () |
void | evacuatingCountChanged () |
void | interruptedCountChanged () |
void | activeCountChanged () |
void | yieldingCountChanged () |
void | idlingCountChanged () |
Signals inherited from cutehmi::services::AbstractService | |
void | stopTimeoutChanged () |
void | startTimeoutChanged () |
void | repairTimeoutChanged () |
void | shutdownTimeoutChanged () |
void | nameChanged () |
void | statusChanged () |
void | started () |
void | stopped () |
void | activated () |
void | initialized () |
This signal is emitted, when service has performed all the initialization tasks and it is ready to be started. More... | |
Public Member Functions | |
ServiceGroup (QObject *parent=nullptr) | |
~ServiceGroup () override | |
int | startedCount () const |
int | startingCount () const |
int | stoppingCount () const |
int | stoppedCount () const |
int | brokenCount () const |
int | repairingCount () const |
int | evacuatingCount () const |
int | interruptedCount () const |
int | activeCount () const |
int | yieldingCount () const |
int | idlingCount () const |
QQmlListProperty< cutehmi::services::ServiceGroupRule > | ruleList () |
Q_INVOKABLE void | appendRule (cutehmi::services::ServiceGroupRule *rule) |
Q_INVOKABLE void | clearRules () |
QQmlListProperty< cutehmi::services::AbstractService > | serviceList () |
Q_INVOKABLE void | appendService (cutehmi::services::AbstractService *service) |
Q_INVOKABLE void | clearServices () |
void | configureStarting (QState *starting, AssignStatusFunction assignStatus) override |
Configure starting state. More... | |
void | configureStarted (QState *active, const QState *idling, const QState *yielding, AssignStatusFunction assignStatus) override |
Configure started state. More... | |
void | configureStopping (QState *stopping, AssignStatusFunction assignStatus) override |
Configure stopping state. More... | |
void | configureBroken (QState *broken, AssignStatusFunction assignStatus) override |
Configure broken state. More... | |
void | configureRepairing (QState *repairing, AssignStatusFunction assignStatus) override |
Configure repairing state. More... | |
void | configureEvacuating (QState *evacuating, AssignStatusFunction assignStatus) override |
Configure evacuating state. More... | |
std::unique_ptr< QAbstractTransition > | transitionToStarted () const override |
Transition to started state. More... | |
std::unique_ptr< QAbstractTransition > | transitionToStopped () const override |
Transition to stopped state. More... | |
std::unique_ptr< QAbstractTransition > | transitionToBroken () const override |
Transition to broken state. More... | |
std::unique_ptr< QAbstractTransition > | transitionToYielding () const override |
Transition to yielding state. More... | |
std::unique_ptr< QAbstractTransition > | transitionToIdling () const override |
Transition to idling state. More... | |
void | classBegin () override |
void | componentComplete () override |
Public Member Functions inherited from cutehmi::services::AbstractService | |
~AbstractService () override | |
int | shutdownTimeout () const |
void | setShutdownTimeout (int shutdownTimeout) |
Set shutdown timeout. More... | |
int | stopTimeout () const |
void | setStopTimeout (int stopTimeout) |
Set stop timeout. More... | |
int | startTimeout () const |
void | setStartTimeout (int startTimeout) |
Set start timeout. More... | |
int | repairTimeout () const |
void | setRepairTimeout (int repairTimeout) |
Set repair timeout. More... | |
QString | name () const |
void | setName (const QString &name) |
QString | status () const |
cutehmi::services::StateInterface * | states () const |
Get state interface. More... | |
QQmlListProperty< cutehmi::services::AbstractServiceController > | defaultControllerList () |
QQmlListProperty< cutehmi::services::AbstractServiceController > | controllerList () |
Q_INVOKABLE void | appendController (cutehmi::services::AbstractServiceController *controller) |
Q_INVOKABLE void | clearControllers () |
Public Member Functions inherited from QObject | |
virtual const QMetaObject * | metaObject () const const |
QObject (QObject *parent) | |
virtual | ~QObject () |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
QString | objectName () const const |
void | setObjectName (const QString &name) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
bool | signalsBlocked () const const |
bool | blockSignals (bool block) |
QThread * | thread () const const |
void | moveToThread (QThread *targetThread) |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
void | killTimer (int id) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
const QObjectList & | children () const const |
void | setParent (QObject *parent) |
void | installEventFilter (QObject *filterObj) |
void | removeEventFilter (QObject *obj) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectTree () |
void | dumpObjectInfo () |
void | dumpObjectTree () const const |
void | dumpObjectInfo () const const |
bool | setProperty (const char *name, const QVariant &value) |
QVariant | property (const char *name) const const |
QList< QByteArray > | dynamicPropertyNames () const const |
void | destroyed (QObject *obj) |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
bool | inherits (const char *className) const const |
void | deleteLater () |
Q_DISABLE_COPY (Class) | |
Q_DISABLE_MOVE (Class) | |
Q_DISABLE_COPY_MOVE (Class) | |
T | qobject_cast (QObject *object) |
T | qobject_cast (const QObject *object) |
T | qFindChild (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
Q_CLASSINFO (Name, Value) | |
Q_INTERFACES (...) | |
Q_PROPERTY (...) | |
Q_ENUMS (...) | |
Q_FLAGS (...) | |
Q_ENUM (...) | |
Q_FLAG (...) | |
Q_ENUM_NS (...) | |
Q_FLAG_NS (...) | |
Q_OBJECT Q_OBJECT | |
Q_GADGET Q_GADGET | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_SIGNALS Q_SIGNALS | |
Q_SIGNAL Q_SIGNAL | |
Q_SLOTS Q_SLOTS | |
Q_SLOT Q_SLOT | |
Q_EMIT Q_EMIT | |
Q_INVOKABLE Q_INVOKABLE | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
virtual void | classBegin ()=0 |
virtual void | componentComplete ()=0 |
virtual void | configureStarting (QState *starting, AssignStatusFunction assignStatus)=0 |
Configure starting state. More... | |
virtual void | configureStarted (QState *active, const QState *idling, const QState *yielding, AssignStatusFunction assignStatus)=0 |
Configure started state. More... | |
virtual void | configureStopping (QState *stopping, AssignStatusFunction assignStatus)=0 |
Configure stopping state. More... | |
virtual void | configureBroken (QState *broken, AssignStatusFunction assignStatus)=0 |
Configure broken state. More... | |
virtual void | configureRepairing (QState *repairing, AssignStatusFunction assignStatus)=0 |
Configure repairing state. More... | |
virtual void | configureEvacuating (QState *evacuating, AssignStatusFunction assignStatus)=0 |
Configure evacuating state. More... | |
virtual std::unique_ptr< QAbstractTransition > | transitionToStarted () const =0 |
Transition to started state. More... | |
virtual std::unique_ptr< QAbstractTransition > | transitionToStopped () const =0 |
Transition to stopped state. More... | |
virtual std::unique_ptr< QAbstractTransition > | transitionToBroken () const =0 |
Transition to broken state. More... | |
virtual std::unique_ptr< QAbstractTransition > | transitionToYielding () const =0 |
Transition to yielding state. More... | |
virtual std::unique_ptr< QAbstractTransition > | transitionToIdling () const =0 |
Transition to idling state. More... | |
Static Public Member Functions | |
static void | PostConditionCheckEvent (QStateMachine *stateMachine) |
Static Public Member Functions inherited from QObject | |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
Protected Types | |
typedef QList< ServiceGroupRule * > | RulesContainer |
typedef QList< AbstractService * > | ServicesContainer |
Protected Types inherited from cutehmi::services::AbstractService | |
typedef QList< AbstractServiceController * > | ControllersContainer |
Protected Slots | |
void | handleCounters () |
Protected Slots inherited from cutehmi::services::AbstractService | |
void | setStatus (const QString &status) |
Protected Member Functions | |
void | setStartedCount (int count) |
void | setStartingCount (int count) |
void | setStoppingCount (int count) |
void | setStoppedCount (int count) |
void | setBrokenCount (int count) |
void | setRepairingCount (int count) |
void | setEvacuatingCount (int count) |
void | setInterruptedCount (int count) |
void | setActiveCount (int count) |
void | setYieldingCount (int count) |
void | setIdlingCount (int count) |
const RulesContainer & | rules () const |
RulesContainer & | rules () |
const ServicesContainer & | services () const |
ServicesContainer & | services () |
Q_SIGNAL void | groupBroken () |
Q_SIGNAL void | groupStarted () |
Q_SIGNAL void | groupStopped () |
Protected Member Functions inherited from cutehmi::services::AbstractService | |
AbstractService (StateInterface *stateInterface, const QString &status, QObject *parent=nullptr, const ControllersContainer *defaultControllers=&DefaultControllers()) | |
Constructor. More... | |
const ControllersContainer & | controllers () const |
ControllersContainer & | controllers () |
Protected Member Functions inherited from QObject | |
QObject * | sender () const const |
int | senderSignalIndex () const const |
int | receivers (const char *signal) const const |
bool | isSignalConnected (const QMetaMethod &signal) const const |
virtual void | timerEvent (QTimerEvent *event) |
virtual void | childEvent (QChildEvent *event) |
virtual void | customEvent (QEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
Protected Member Functions inherited from cutehmi::services::Serviceable | |
Serviceable ()=default | |
virtual | ~Serviceable ()=default |
Serviceable (const Serviceable &other)=default | |
Serviceable & | operator= (const Serviceable &other)=default |
Static Protected Member Functions | |
static const ControllersContainer & | DefaultControllers () |
Static Protected Member Functions inherited from cutehmi::services::AbstractService | |
static const ControllersContainer & | DefaultControllers () |
Properties | |
int | startedCount |
int | startingCount |
int | stoppingCount |
int | stoppedCount |
int | brokenCount |
int | repairingCount |
int | evacuatingCount |
int | interruptedCount |
int | activeCount |
int | yieldingCount |
int | idlingCount |
QQmlListProperty< cutehmi::services::ServiceGroupRule > | rules |
QQmlListProperty< cutehmi::services::AbstractService > | services |
Properties inherited from cutehmi::services::AbstractService | |
int | shutdownTimeout |
int | stopTimeout |
int | startTimeout |
int | repairTimeout |
QString | name |
QString | status |
cutehmi::services::StateInterface * | states |
QQmlListProperty< cutehmi::services::AbstractServiceController > | defaultControllers |
QQmlListProperty< cutehmi::services::AbstractServiceController > | controllers |
Properties inherited from QObject | |
objectName | |
Additional Inherited Members | |
Public Attributes inherited from QObject | |
typedef | QObjectList |
Static Public Attributes inherited from cutehmi::services::AbstractService | |
static constexpr int | INITIAL_SHUTDOWN_TIMEOUT = 180000 |
static constexpr int | INITIAL_STOP_TIMEOUT = 30000 |
static constexpr int | INITIAL_START_TIMEOUT = 30000 |
static constexpr int | INITIAL_REPAIR_TIMEOUT = 30000 |
static constexpr const char * | INITIAL_NAME = "Unnamed Service" |
Service group.
Service group allows to collectively manage a group of services. By its most basic principle, whenever any of start(), stop() or activate() slots is called on the group it forwards the call to the services managed by it. This basic behavior can be customized by the use of rules.
Service group is a service by itself, so it makes use of the state machine to handle propagation of slot calls. Internally for each service it creates substates, which are a children of its own states configured via Serviceable interface. These substates are executed in parallel, so for example all services will be started at once. However if some service group rule can be applied to a particular service, then additional subsequent states are added to the substate created for a particular service and the rule defines the transition between them.
|
protected |
|
protected |
|
explicit |
|
override |
int cutehmi::services::ServiceGroup::activeCount | ( | ) | const |
|
signal |
void cutehmi::services::ServiceGroup::appendRule | ( | cutehmi::services::ServiceGroupRule * | rule | ) |
void cutehmi::services::ServiceGroup::appendService | ( | cutehmi::services::AbstractService * | service | ) |
int cutehmi::services::ServiceGroup::brokenCount | ( | ) | const |
|
signal |
|
overridevirtual |
Implements QQmlParserStatus.
void cutehmi::services::ServiceGroup::clearRules | ( | ) |
void cutehmi::services::ServiceGroup::clearServices | ( | ) |
|
overridevirtual |
Implements QQmlParserStatus.
|
overridevirtual |
Configure broken state.
broken | state. |
assignStatus | a function callback that allows one to associate the state with custom service status. |
Implements cutehmi::services::Serviceable.
|
overridevirtual |
Configure evacuating state.
evacuating | state. |
assignStatus | a function callback that allows one to associate the state with custom service status. |
Implements cutehmi::services::Serviceable.
|
overridevirtual |
Configure repairing state.
repairing | state. |
assignStatus | a function callback that allows one to associate the state with custom service status. |
Implements cutehmi::services::Serviceable.
|
overridevirtual |
Configure started state.
Started state is not directly accessible. Intead its child states shall be configured.
active | active state. In this state any resource-hungry and intense operations shall be performed. Serviceable object may add child states to active state for its own use. |
idling | idling state. In this state a serviceable should not perform any intense operations or consume resources. Serviceable decides by itself when to enter idling state. Some objects may never activate the transition to idling state. When serviceable object is ready to become active again it should signal it by activating transitionToIdling(). No child states can be added to idling state. |
yielding | yielding state. In this state a service should not perform any intense operations or consume resources. It should just wait until it is activated, therefore no child states can be added to yielding state. |
assignStatus | a function callback that allows one to associate the state with custom service status. |
Implements cutehmi::services::Serviceable.
|
overridevirtual |
Configure starting state.
starting | state. |
assignStatus | a function callback that allows one to associate the state with custom service status. |
Implements cutehmi::services::Serviceable.
|
overridevirtual |
Configure stopping state.
stopping | state. |
assignStatus | a function callback that allows one to associate the state with custom service status. |
Implements cutehmi::services::Serviceable.
|
staticprotected |
int cutehmi::services::ServiceGroup::evacuatingCount | ( | ) | const |
|
signal |
|
protected |
|
protected |
|
protected |
|
protectedslot |
int cutehmi::services::ServiceGroup::idlingCount | ( | ) | const |
|
signal |
int cutehmi::services::ServiceGroup::interruptedCount | ( | ) | const |
|
signal |
|
slot |
|
static |
int cutehmi::services::ServiceGroup::repairingCount | ( | ) | const |
|
signal |
QQmlListProperty< ServiceGroupRule > cutehmi::services::ServiceGroup::ruleList | ( | ) |
|
protected |
|
protected |
QQmlListProperty< AbstractService > cutehmi::services::ServiceGroup::serviceList | ( | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
int cutehmi::services::ServiceGroup::startedCount | ( | ) | const |
|
signal |
int cutehmi::services::ServiceGroup::startingCount | ( | ) | const |
|
signal |
int cutehmi::services::ServiceGroup::stoppedCount | ( | ) | const |
|
signal |
int cutehmi::services::ServiceGroup::stoppingCount | ( | ) | const |
|
signal |
|
overridevirtual |
Transition to broken state.
nullptr
. In such case service will never enter broken or repairing states. Implements cutehmi::services::Serviceable.
|
overridevirtual |
Transition to idling state.
nullptr
. In such case service will not enter idling state and will remain persistently active. This will make service impolite. Implements cutehmi::services::Serviceable.
|
overridevirtual |
Transition to started state.
nullptr
. In such case transition from starting to started state will be immediate. Implements cutehmi::services::Serviceable.
|
overridevirtual |
Transition to stopped state.
nullptr
. In such case transition from stopping to stopped state will be immediate. Implements cutehmi::services::Serviceable.
|
overridevirtual |
Transition to yielding state.
nullptr
. In such case service will skip yielding state and immediately become active. This will make service impolite. Implements cutehmi::services::Serviceable.
int cutehmi::services::ServiceGroup::yieldingCount | ( | ) | const |
|
signal |
|
read |
|
read |
|
read |
|
read |
|
read |
|
read |
|
read |
|
read |
|
read |
|
read |
|
read |
|
read |
|
read |