openETCS
case study for the European Train Control System developed for the authors dissertation
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Attributes | List of all members
oETCS::DF::CDMIQWidget Class Reference

Driver Machine Interface Qt4 class. More...

#include <DriverMachineInterfaceMOC.h>

Inheritance diagram for oETCS::DF::CDMIQWidget:
Inheritance graph
Collaboration diagram for oETCS::DF::CDMIQWidget:
Collaboration graph

Public Slots

void DataEntered () throw ()
 slot for notification about entered data
QStringList GetInputs ()
 gets all active inputs
::QStringList GetOutputs ()
 gets all available ouputs
QString GetOutputValue (const QString &OutputName)
 gets a value of a certain output
bool HasInput ()
 gets the flag for the existence of any input field
void SetBooleanValue (const QString &InputName, bool bValue)
 sets a value of an boolean input field
void SetDoubleValue (const QString &InputName, double dValue)
 sets a value of an double input field
void SetIntegerValue (const QString &InputName, int iValue)
 sets a value of an integer input field
void SetStringValue (const QString &InputName, const QString &Value)
 sets a value of an string input field
virtual void UpdateSlot () throw ()
 slot after a Update() message from the EVC State Machine

Signals

void Error (const ::QString &ErrorMessage)
 signal for sending an error
void Updated ()
 signal emited, if a Update() message from the EVC state machine was received

Public Member Functions

 CDMIQWidget (oETCS::DF::CEVCStateMachine *const pStateMachine, QWidget *pWidgetParent=0, const bool &bSimAdaptor=false) throw ()
 general constructor
virtual void Detached () throw ()
 notifies an observer about it was detached by the EVC state machine
virtual void Update () throw ()
 updates the observer representation
virtual ~CDMIQWidget () throw ()
 destructor

Static Public Member Functions

template<class ELEMENT_T , class CONTAINER_T = ::std::vector< ELEMENT_T >>
static bool IsPartOf (const ELEMENT_T &Element, const CONTAINER_T &Container) throw ()
 checks, if an element is part of an vector

Protected Attributes

oETCS::DF::CEVCStateMachine *const m_pStateMachine
 pointer to the related state machine

Private Attributes

::std::vector< ::QPushButton * > m_InputButtons
 vector of pointer to all push buttons to submit entered data by the driver
::std::vector< ::QWidget * > m_InputWidgets
 vector with pointers to all input widgets
::std::vector< ::QLabel * > m_Labels
 vector with pointers to labels used for inputs and outputs in grid layout
::QGridLayout m_Layout
 layout object of the Dialog
::QMutex m_Mutex
 mutable exclusion for setting DMI values while subject changes
::std::vector< ::QWidget * > m_OutputWidgets
 vector with pointers to all output widgets
::ADMI * m_pAdaptor
 pointer to the DMI adaptor object (used for simulation only)
oETCS::DF::CDMISubjectm_pLastSubject
 poniter to the last subject used in Update().

Detailed Description

Driver Machine Interface Qt4 class.

Observer implementation as Qt4 QWidget.

Definition at line 62 of file DriverMachineInterfaceMOC.h.

Constructor & Destructor Documentation

oETCS::DF::CDMIQWidget::CDMIQWidget ( oETCS::DF::CEVCStateMachine *const  pStateMachine,
QWidget pWidgetParent = 0,
const bool &  bSimAdaptor = false 
) throw ()
explicit

general constructor

Attaches the concrete Qt4 observer to a EVC state machine object.

Parameters
[in]pStateMachinepointer to the related state machine
[in]pWidgetParentoptional pointer to the parent QWidget object
[in]bSimAdaptoroptional flag to actiavate instance as D-Bus adaptor for simulation

Definition at line 36 of file DriverMachineInterfaceMOC.cpp.

oETCS::DF::CDMIQWidget::~CDMIQWidget ( ) throw ()
virtual

destructor

Definition at line 100 of file DriverMachineInterfaceMOC.cpp.

References m_InputButtons, m_InputWidgets, m_Labels, m_Layout, m_OutputWidgets, and m_pAdaptor.

Member Function Documentation

void oETCS::DF::CDMIQWidget::DataEntered ( ) throw ()
slot
void oETCS::DF::CDMIQWidget::Detached ( ) throw ()
virtual

notifies an observer about it was detached by the EVC state machine

In the implementation for the Qt observer this cause a closing of the QWidget.

Implements oETCS::DF::CDMIObserver.

Definition at line 187 of file DriverMachineInterfaceMOC.cpp.

void oETCS::DF::CDMIQWidget::Error ( const ::QString &  ErrorMessage)
signal

signal for sending an error

This signal should be emitted in the case that an error in the HW ocurres.

Parameters
[in]ErrorMessagetextual description of the error
QStringList oETCS::DF::CDMIQWidget::GetInputs ( )
slot

gets all active inputs

Returns
list of active/enabled inputs

Definition at line 691 of file DriverMachineInterfaceMOC.cpp.

References m_InputWidgets, m_Labels, and m_OutputWidgets.

Referenced by HasInput().

Here is the caller graph for this function:

QStringList oETCS::DF::CDMIQWidget::GetOutputs ( )
slot

gets all available ouputs

Returns
list of all all outputs

Definition at line 736 of file DriverMachineInterfaceMOC.cpp.

References m_Labels, m_Mutex, and m_OutputWidgets.

QString oETCS::DF::CDMIQWidget::GetOutputValue ( const QString &  OutputName)
slot

gets a value of a certain output

Parameters
[in]OutputNamename of the output field
Returns
output value

Definition at line 773 of file DriverMachineInterfaceMOC.cpp.

References m_InputWidgets, m_Labels, m_Mutex, and m_OutputWidgets.

bool oETCS::DF::CDMIQWidget::HasInput ( )
slot

gets the flag for the existence of any input field

Returns
true, if any input field exists

Definition at line 836 of file DriverMachineInterfaceMOC.cpp.

References GetInputs().

Here is the call graph for this function:

template<class ELEMENT_T , class CONTAINER_T >
bool oETCS::DF::CDMIQWidget::IsPartOf ( const ELEMENT_T &  Element,
const CONTAINER_T &  Container 
) throw ()
inlinestatic

checks, if an element is part of an vector

Parameters
[in]Elementelement to be searched in container
[in]Containercontainer to be searched in
Returns
true, if element is found

Definition at line 293 of file DriverMachineInterfaceMOC.h.

Referenced by DataEntered().

Here is the caller graph for this function:

void oETCS::DF::CDMIQWidget::SetBooleanValue ( const QString &  InputName,
bool  bValue 
)
slot

sets a value of an boolean input field

Parameters
[in]InputNamename of the input field
[in]bValuenew value

Definition at line 854 of file DriverMachineInterfaceMOC.cpp.

References m_InputButtons, m_InputWidgets, m_Labels, m_Mutex, and m_OutputWidgets.

void oETCS::DF::CDMIQWidget::SetDoubleValue ( const QString &  InputName,
double  dValue 
)
slot

sets a value of an double input field

Parameters
[in]InputNamename of the input field
[in]dValuenew value

Definition at line 938 of file DriverMachineInterfaceMOC.cpp.

References m_InputButtons, m_InputWidgets, m_Labels, m_Mutex, and m_OutputWidgets.

void oETCS::DF::CDMIQWidget::SetIntegerValue ( const QString &  InputName,
int  iValue 
)
slot

sets a value of an integer input field

Parameters
[in]InputNamename of the input field
[in]iValuenew value

Definition at line 1022 of file DriverMachineInterfaceMOC.cpp.

References m_InputButtons, m_InputWidgets, m_Labels, m_Mutex, and m_OutputWidgets.

void oETCS::DF::CDMIQWidget::SetStringValue ( const QString &  InputName,
const QString &  Value 
)
slot

sets a value of an string input field

Parameters
[in]InputNamename of the input field
[in]Valuenew value

Definition at line 1095 of file DriverMachineInterfaceMOC.cpp.

References m_InputButtons, m_InputWidgets, m_Labels, m_Mutex, and m_OutputWidgets.

void oETCS::DF::CDMIQWidget::Update ( ) throw ()
virtual

updates the observer representation

Implements oETCS::DF::CDMIObserver.

Definition at line 175 of file DriverMachineInterfaceMOC.cpp.

References Updated().

Here is the call graph for this function:

void oETCS::DF::CDMIQWidget::Updated ( )
signal

signal emited, if a Update() message from the EVC state machine was received

Referenced by Update().

Here is the caller graph for this function:

void oETCS::DF::CDMIQWidget::UpdateSlot ( ) throw ()
virtualslot

Member Data Documentation

::std::vector< ::QPushButton* > oETCS::DF::CDMIQWidget::m_InputButtons
private

vector of pointer to all push buttons to submit entered data by the driver

Definition at line 278 of file DriverMachineInterfaceMOC.h.

Referenced by DataEntered(), SetBooleanValue(), SetDoubleValue(), SetIntegerValue(), SetStringValue(), UpdateSlot(), and ~CDMIQWidget().

::std::vector< ::QWidget* > oETCS::DF::CDMIQWidget::m_InputWidgets
private

vector with pointers to all input widgets

Definition at line 257 of file DriverMachineInterfaceMOC.h.

Referenced by DataEntered(), GetInputs(), GetOutputValue(), SetBooleanValue(), SetDoubleValue(), SetIntegerValue(), SetStringValue(), UpdateSlot(), and ~CDMIQWidget().

::std::vector< ::QLabel* > oETCS::DF::CDMIQWidget::m_Labels
private

vector with pointers to labels used for inputs and outputs in grid layout

Definition at line 250 of file DriverMachineInterfaceMOC.h.

Referenced by GetInputs(), GetOutputs(), GetOutputValue(), SetBooleanValue(), SetDoubleValue(), SetIntegerValue(), SetStringValue(), UpdateSlot(), and ~CDMIQWidget().

::QGridLayout oETCS::DF::CDMIQWidget::m_Layout
private

layout object of the Dialog

Definition at line 243 of file DriverMachineInterfaceMOC.h.

Referenced by UpdateSlot(), and ~CDMIQWidget().

::QMutex oETCS::DF::CDMIQWidget::m_Mutex
private

mutable exclusion for setting DMI values while subject changes

Definition at line 285 of file DriverMachineInterfaceMOC.h.

Referenced by DataEntered(), GetOutputs(), GetOutputValue(), SetBooleanValue(), SetDoubleValue(), SetIntegerValue(), SetStringValue(), and UpdateSlot().

::std::vector< ::QWidget* > oETCS::DF::CDMIQWidget::m_OutputWidgets
private

vector with pointers to all output widgets

Definition at line 264 of file DriverMachineInterfaceMOC.h.

Referenced by GetInputs(), GetOutputs(), GetOutputValue(), SetBooleanValue(), SetDoubleValue(), SetIntegerValue(), SetStringValue(), UpdateSlot(), and ~CDMIQWidget().

::ADMI* oETCS::DF::CDMIQWidget::m_pAdaptor
private

pointer to the DMI adaptor object (used for simulation only)

Definition at line 236 of file DriverMachineInterfaceMOC.h.

Referenced by ~CDMIQWidget().

oETCS::DF::CDMISubject* oETCS::DF::CDMIQWidget::m_pLastSubject
private

poniter to the last subject used in Update().

Definition at line 271 of file DriverMachineInterfaceMOC.h.

Referenced by DataEntered(), and UpdateSlot().

oETCS::DF::CEVCStateMachine* const oETCS::DF::CDMIObserver::m_pStateMachine
protectedinherited

pointer to the related state machine

Definition at line 1526 of file EVCStateMachine.h.

Referenced by UpdateSlot().


The documentation for this class was generated from the following files:

Copyright (C) 2010-2012 Johannes Feuser (feuser@uni-bremen.de)
The openETCS library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
The openETCS library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the openETCS library. If not, see "http://www.gnu.org/licenses/.