RTXI  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
DefaultGUIModel Class Reference

#include <default_gui_model.h>

Inheritance diagram for DefaultGUIModel:
RT::ThreadPlugin::ObjectWorkspace::InstanceEvent::HandlerRT::List< T >::NodeSettings::ObjectIO::BlockSettings::Object

Classes

struct  param_t
 

Public Types

enum  update_flags_t {
  INIT, MODIFY, PERIOD, PAUSE,
  UNPAUSE, EXIT
}
 
typedef Workspace::variable_t variable_t
 
- Public Types inherited from RT::Thread
typedef unsigned long Priority
 
- Public Types inherited from Settings::Object
typedef unsigned long ID
 

Public Slots

void resizeMe ()
 
virtual void exit (void)
 
virtual void refresh (void)
 
virtual void modify (void)
 
virtual void pause (bool)
 

Public Member Functions

QGridLayout * getLayout (void)
 
 DefaultGUIModel (std::string name, variable_t *variables, size_t size)
 
virtual ~DefaultGUIModel (void)
 
virtual void update (update_flags_t flag)
 
void createGUI (DefaultGUIModel::variable_t *var, int size)
 
- Public Member Functions inherited from RT::Thread
 Thread (Priority p=DefaultPriority)
 
virtual ~Thread (void)
 
Priority getPriority (void) const
 
virtual void execute (void)
 
bool getActive (void) const
 
void setActive (bool)
 
- Public Member Functions inherited from RT::List< T >::Node
 Node (void)
 
virtual ~Node (void)
 
bool operator== (const Node &x) const
 
- Public Member Functions inherited from Plugin::Object
 Object (void)
 
virtual ~Object (void)
 
std::string getLibrary (void) const
 
void unload (void)
 
- Public Member Functions inherited from Settings::Object
 Object (void)
 
ID getID (void) const
 
State save (void) const
 
void load (const State &)
 
void deferred (const State &)
 
- Public Member Functions inherited from Workspace::Instance
 Instance (std::string name, variable_t *variables, size_t size)
 
virtual ~Instance (void)
 
size_t getCount (IO::flags_t type) const
 
std::string getName (IO::flags_t type, size_t index) const
 
std::string getDescription (IO::flags_t type, size_t index) const
 
double getValue (IO::flags_t type, size_t index) const
 
std::string getValueString (IO::flags_t type, size_t index) const
 
void setValue (size_t index, double value)
 
void setComment (size_t index, std::string comment)
 
- Public Member Functions inherited from IO::Block
 Block (std::string name, channel_t *channels, size_t size)
 
virtual ~Block (void)
 
std::string getName (void) const
 
double input (size_t index) const
 
double output (size_t index) const
 
- Public Member Functions inherited from Event::Handler
 Handler (void)
 
virtual ~Handler (void)
 

Public Attributes

QPushButton * pauseButton
 
QPushButton * modifyButton
 
QPushButton * unloadButton
 
std::map< QString, param_tparameter
 
QPalette palette
 

Static Public Attributes

static const IO::flags_t INPUT = Workspace::INPUT
 
static const IO::flags_t OUTPUT = Workspace::OUTPUT
 
static const IO::flags_t PARAMETER = Workspace::PARAMETER
 
static const IO::flags_t STATE = Workspace::STATE
 
static const IO::flags_t EVENT = Workspace::EVENT
 
static const IO::flags_t COMMENT = Workspace::COMMENT
 
static const IO::flags_t DOUBLE = Workspace::COMMENT<<1
 
static const IO::flags_t INTEGER = Workspace::COMMENT<<2
 
static const IO::flags_t UINTEGER = Workspace::COMMENT<<3
 
- Static Public Attributes inherited from RT::Thread
static const Priority MinimumPriority = 0
 
static const Priority MaximumPriority = 100
 
static const Priority DefaultPriority = MaximumPriority/2
 
- Static Public Attributes inherited from Settings::Object
static const ID INVALID = 0
 

Protected Member Functions

QString getParameter (const QString &name)
 
void setParameter (const QString &name, double value)
 
void setParameter (const QString &name, const QString value)
 
QString getComment (const QString &name)
 
void setComment (const QString &name, const QString comment)
 
void setState (const QString &name, double &ref)
 
void setEvent (const QString &name, double &ref)
 
- Protected Member Functions inherited from Workspace::Instance
double * getData (IO::flags_t type, size_t index)
 
void setData (IO::flags_t type, size_t index, double *value)
 
- Protected Member Functions inherited from IO::Block
double & output (size_t index)
 

Protected Attributes

QGridLayout * layout
 

Private Member Functions

void doDeferred (const Settings::Object::State &)
 
void doLoad (const Settings::Object::State &)
 
void doSave (Settings::Object::State &) const
 
void receiveEvent (const Event::Object *)
 

Private Attributes

bool periodEventPaused
 
QString junk
 
QWidget * gridBox
 
QGroupBox * buttonGroup
 
std::string myname
 
QMdiSubWindow * subWindow
 

Detailed Description

A class that provides a simplified C++ interface for model creation.

Definition at line 52 of file default_gui_model.h.

Member Typedef Documentation

Structure used to pass variable information to the constructor

See also
DefaultGUIModel::DefaultGUIModel()
Workspace::variable_t

Definition at line 124 of file default_gui_model.h.

Member Enumeration Documentation

Flag passed to DefaultGUIModel::update to signal the kind of update.

See also
DefaultGUIModel::update()
Enumerator
INIT 

The parameters need to be initialized.

MODIFY 

The parameters have been modified by the user.

PERIOD 

The system period has changed.

PAUSE 

The Pause button has been activated

UNPAUSE 

When the pause button has been deactivated

EXIT 

When the module has been told to exit

Definition at line 131 of file default_gui_model.h.

Constructor & Destructor Documentation

DefaultGUIModel::DefaultGUIModel(std::string name,
DefaultGUIModel::variable_tvar,
size_t size 
)

The constructor needs to be provided with a specification of the variables that will be embedded in the enclosed workspace.

See also
Workspace::Instance::Instance()
DefaultGUIModel::variable_t

Definition at line 61 of file default_gui_model.cpp.

DefaultGUIModel::~DefaultGUIModel(void )
virtual

Definition at line 72 of file default_gui_model.cpp.

Member Function Documentation

void DefaultGUIModel::createGUI(DefaultGUIModel::variable_tvar,
int size 
)

Function that builds the Qt GUI.

Parameters
varThe structure defining the module's parameters, states, inputs, and outputs.
sizeThe size of the structure vars.
See also
DefaultGUIModel::update_flags_t

Definition at line 85 of file default_gui_model.cpp.

void DefaultGUIModel::doDeferred(const Settings::Object::State)
privatevirtual

Reimplemented from Settings::Object.

Definition at line 358 of file default_gui_model.cpp.

void DefaultGUIModel::doLoad(const Settings::Object::States)
privatevirtual

Reimplemented from Settings::Object.

Definition at line 363 of file default_gui_model.cpp.

void DefaultGUIModel::doSave(Settings::Object::States)const
privatevirtual

Reimplemented from Settings::Object.

Definition at line 383 of file default_gui_model.cpp.

void DefaultGUIModel::exit(void )
virtualslot

Function that allows the object to safely delete and unload itself.

Definition at line 213 of file default_gui_model.cpp.

QString DefaultGUIModel::getComment(const QString & name)
protected

Definition at line 272 of file default_gui_model.cpp.

QGridLayout* DefaultGUIModel::getLayout(void )
inline

Definition at line 64 of file default_gui_model.h.

QString DefaultGUIModel::getParameter(const QString & name)
protected

Get the value of the parameter in the GUI, and update the value within the Workspace.

Parameters
nameThe parameter's name.
Returns
The value of the parameter.

Definition at line 292 of file default_gui_model.cpp.

void DefaultGUIModel::modify(void )
virtualslot

Function that calls DefaultGUIModel::update with the MODIFY flag

See also
DefaultGUIModel::update_flags_t

Definition at line 249 of file default_gui_model.cpp.

void DefaultGUIModel::pause(bool p)
virtualslot

Function that pauses/unpauses the model.

Definition at line 346 of file default_gui_model.cpp.

void DefaultGUIModel::receiveEvent(const Event::Objectevent)
privatevirtual

Function that is called in non-realtime everytime an non-realtime event is posted.

Parameters
eventThe the event being posted.
See also
Event::Object
Event::Manager::postEvent()

Reimplemented from Event::Handler.

Definition at line 402 of file default_gui_model.cpp.

void DefaultGUIModel::refresh(void )
virtualslot

Function that updates the GUI with new parameter values.

See also
DefaultGUIModel::update_flags_t

Definition at line 225 of file default_gui_model.cpp.

void DefaultGUIModel::resizeMe()
slot

Function that resizes widgets to properly fit layouts after overloading

Definition at line 208 of file default_gui_model.cpp.

void DefaultGUIModel::setComment(const QString & name,
const QString comment 
)
protected

Definition at line 280 of file default_gui_model.cpp.

void DefaultGUIModel::setEvent(const QString & name,
double & ref 
)
protected

Set the reference to this event within the Workspace via Workspace::setData().

Parameters
nameThe event name.
refA reference to the event.
See also
Workspace::setData()

Definition at line 336 of file default_gui_model.cpp.

void DefaultGUIModel::setParameter(const QString & name,
double value 
)
protected

Set the value of this parameter within the Workspace and GUI.

Parameters
nameThe name of the parameter.
refA reference to the parameter.
See also
Workspace::setData()

Definition at line 304 of file default_gui_model.cpp.

void DefaultGUIModel::setParameter(const QString & name,
const QString value 
)
protected

Set the value of this parameter within the Workspace and GUI.

Parameters
nameThe parameter's name.
valueThe parameter's new value.

Definition at line 315 of file default_gui_model.cpp.

void DefaultGUIModel::setState(const QString & name,
double & ref 
)
protected

Set the reference to this state within the Workspace via Workspace::setData().

Parameters
nameThe state's name.
refA reference to the state.
See also
Workspace::setData()

Definition at line 326 of file default_gui_model.cpp.

void DefaultGUIModel::update(DefaultGUIModel::update_flags_t flag)
virtual

Callback function that is called when the system state changes.

Parameters
flagThe kind of update to signal.
See also
DefaultGUIModel::update_flags_t

Definition at line 204 of file default_gui_model.cpp.

Member Data Documentation

QGroupBox* DefaultGUIModel::buttonGroup
private

Definition at line 283 of file default_gui_model.h.

const IO::flags_t DefaultGUIModel::COMMENT = Workspace::COMMENT
static

Flag that marks a variable as a comment.

See also
Workspace::COMMENT

Definition at line 104 of file default_gui_model.h.

const IO::flags_t DefaultGUIModel::DOUBLE = Workspace::COMMENT<<1
static

Flag that marks a parameter as being of double type.

Definition at line 108 of file default_gui_model.h.

const IO::flags_t DefaultGUIModel::EVENT = Workspace::EVENT
static

Flag that marks a variable as an event.

See also
Workspace::STATE

Definition at line 98 of file default_gui_model.h.

QWidget* DefaultGUIModel::gridBox
private

Definition at line 282 of file default_gui_model.h.

const IO::flags_t DefaultGUIModel::INPUT = Workspace::INPUT
static

Flag that marks a variable as an input.

See also
Workspace::INPUT

Definition at line 74 of file default_gui_model.h.

const IO::flags_t DefaultGUIModel::INTEGER = Workspace::COMMENT<<2
static

Flag that marks a parameter as being of integer type.

Definition at line 112 of file default_gui_model.h.

QString DefaultGUIModel::junk
mutableprivate

Definition at line 280 of file default_gui_model.h.

QGridLayout* DefaultGUIModel::layout
protected

Definition at line 215 of file default_gui_model.h.

QPushButton* DefaultGUIModel::modifyButton

Definition at line 172 of file default_gui_model.h.

std::string DefaultGUIModel::myname
private

Definition at line 284 of file default_gui_model.h.

const IO::flags_t DefaultGUIModel::OUTPUT = Workspace::OUTPUT
static

Flag that marks a variable as an output.

See also
Workspace::OUTPUT

Definition at line 80 of file default_gui_model.h.

QPalette DefaultGUIModel::palette

Definition at line 184 of file default_gui_model.h.

const IO::flags_t DefaultGUIModel::PARAMETER = Workspace::PARAMETER
static

Flag that marks a variable as a parameter.

See also
Workspace::PARAMETER

Definition at line 86 of file default_gui_model.h.

std::map<QString,param_t> DefaultGUIModel::parameter

Definition at line 183 of file default_gui_model.h.

QPushButton* DefaultGUIModel::pauseButton

Definition at line 171 of file default_gui_model.h.

bool DefaultGUIModel::periodEventPaused
private

Definition at line 279 of file default_gui_model.h.

const IO::flags_t DefaultGUIModel::STATE = Workspace::STATE
static

Flag that marks a variable as a state.

See also
Workspace::STATE

Definition at line 92 of file default_gui_model.h.

QMdiSubWindow* DefaultGUIModel::subWindow
private

Definition at line 285 of file default_gui_model.h.

const IO::flags_t DefaultGUIModel::UINTEGER = Workspace::COMMENT<<3
static

Flag that marks a parameter as being of unsigned integer type.

Definition at line 116 of file default_gui_model.h.

QPushButton* DefaultGUIModel::unloadButton

Definition at line 173 of file default_gui_model.h.


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