CFEL - ASG Software Suite  2.5.0
CASS
Signals | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
jocassview::DataSourceManager Class Reference

singleton class to manage the available data sources More...

#include <data_source_manager.h>

+ Inheritance diagram for jocassview::DataSourceManager:
+ Collaboration diagram for jocassview::DataSourceManager:

Signals

void sourceChanged (QString newSource)
 signal when a new source was chosen More...
 

Static Public Member Functions

static DataSourceManagerinstance ()
 generate an instance of this, if not already existent More...
 
static DataSourcesource (const QString &sourcename=QString())
 retrieve an available source More...
 
static QString currentSourceName ()
 return the current source name More...
 
static QStringList sourceNames ()
 retrieve the names of all current active sources More...
 
static void setMenu (QMenu *menu)
 set the Menu where the data sources will be displayed in More...
 
static void addSource (const QString &sourcename, DataSource *source, bool setActive=true)
 add a data source More...
 

Private Member Functions

 DataSourceManager ()
 constructor More...
 
 DataSourceManager (const DataSourceManager &)
 copy constructor More...
 
DataSourceManageroperator= (const DataSourceManager &)
 self assignment More...
 

Private Attributes

QMap< QString, DataSource * > _sources
 container for all data sources More...
 
QMenu_sourceMenu
 the source menu More...
 
QActionGroup_actionGroup
 the action group where the menue items will be grouped More...
 
QSignalMapper_mapper
 mapper for the signals of the signal group More...
 

Static Private Attributes

static DataSourceManager_instance
 an instane of this More...
 

Additional Inherited Members

- Public Member Functions inherited from QObject
 QObject (QObject *parent=0)
 
 blockSignals (bool block)
 
 childEvent (QChildEvent *event)
 
 children ()
 
 connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type=Qt::AutoConnection)
 
 connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type=Qt::AutoConnection)
 
 connectNotify (const char *signal)
 
 customEvent (QEvent *event)
 
 deleteLater ()
 
 destroyed (QObject *obj=0)
 
 disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
 disconnect (const char *signal=0, const QObject *receiver=0, const char *method=0)
 
 disconnect (const QObject *receiver, const char *method=0)
 
 disconnectNotify (const char *signal)
 
 dumpObjectInfo ()
 
 dumpObjectTree ()
 
 dynamicPropertyNames ()
 
 event (QEvent *e)
 
 eventFilter (QObject *watched, QEvent *event)
 
 findChild (const QString &name=QString()
 
 findChildren (const QString &name=QString()
 
 findChildren (const QRegExp &regExp)
 
 inherits (const char *className)
 
 installEventFilter (QObject *filterObj)
 
 isWidgetType ()
 
 killTimer (int id)
 
 metaObject ()
 
 moveToThread (QThread *targetThread)
 
 parent ()
 
 property (const char *name)
 
 receivers (const char *signal)
 
 removeEventFilter (QObject *obj)
 
 sender ()
 
 setParent (QObject *parent)
 
 setProperty (const char *name, const QVariant &value)
 
 signalsBlocked ()
 
 startTimer (int interval)
 
 thread ()
 
 timerEvent (QTimerEvent *event)
 
 tr (const char *sourceText, const char *disambiguation=0, int n=-1)
 
 trUtf8 (const char *sourceText, const char *disambiguation=0, int n=-1)
 
 staticMetaObject
 

Detailed Description

singleton class to manage the available data sources

Author
Lutz Foucar

Definition at line 28 of file data_source_manager.h.

Constructor & Destructor Documentation

DataSourceManager::DataSourceManager ( )
private

constructor

Definition at line 28 of file data_source_manager.cpp.

Referenced by instance().

jocassview::DataSourceManager::DataSourceManager ( const DataSourceManager )
private

copy constructor

Member Function Documentation

void DataSourceManager::addSource ( const QString sourcename,
DataSource source,
bool  setActive = true 
)
static

add a data source

the added source will be set as the current active source

Parameters
sourcenamethe name of the data source that should be added
sourcethe data source that should be added
setActiveSet added source as the current active one and emit the signal that a new source has been

Definition at line 79 of file data_source_manager.cpp.

References _actionGroup, _mapper, _sourceMenu, _sources, QMenu::addAction(), QActionGroup::addAction(), QObject::connect(), instance(), map, QSignalMapper::setMapping(), source(), and sourceChanged().

Referenced by jocassview::JoCASSViewer::JoCASSViewer(), jocassview::OneDViewer::on_add_graph_triggered(), and jocassview::JoCASSViewer::openFile().

QString DataSourceManager::currentSourceName ( )
static

return the current source name

Returns
name of current active source

Definition at line 56 of file data_source_manager.cpp.

References _actionGroup, QActionGroup::checkedAction(), and instance().

Referenced by jocassview::OneDViewer::on_add_graph_triggered(), source(), and jocassview::JoCASSViewer::updateViewers().

DataSourceManager * DataSourceManager::instance ( )
static

generate an instance of this, if not already existent

Returns
the singleton instance of this

Definition at line 36 of file data_source_manager.cpp.

References _instance, and DataSourceManager().

Referenced by addSource(), currentSourceName(), jocassview::JoCASSViewer::JoCASSViewer(), setMenu(), source(), and sourceNames().

DataSourceManager& jocassview::DataSourceManager::operator= ( const DataSourceManager )
private

self assignment

void DataSourceManager::setMenu ( QMenu menu)
static

set the Menu where the data sources will be displayed in

Parameters
menuthe menu that displays the available data sources

Definition at line 70 of file data_source_manager.cpp.

References _actionGroup, _mapper, _sourceMenu, QObject::connect(), instance(), and sourceChanged().

Referenced by jocassview::JoCASSViewer::JoCASSViewer().

DataSource * DataSourceManager::source ( const QString sourcename = QString())
static

retrieve an available source

if no name of the source is given the current active one will be returned If no are available or the requested doesn't exist a 0 pointer will be returned

Returns
pointer to the requested source
Parameters
sourcenamethe name of the requested source

Definition at line 46 of file data_source_manager.cpp.

References _sources, currentSourceName(), instance(), and QString::isEmpty().

Referenced by addSource(), jocassview::JoCASSViewer::broadcastDarkcalCommand(), jocassview::JoCASSViewer::broadcastGaincalCommand(), jocassview::JoCASSViewer::changeServerAddress(), jocassview::JoCASSViewer::clearHistogram(), jocassview::OneDViewer::on_add_graph_triggered(), jocassview::JoCASSViewer::refreshDisplayableItemsList(), jocassview::JoCASSViewer::sendCustomCommand(), and jocassview::JoCASSViewer::updateViewers().

void jocassview::DataSourceManager::sourceChanged ( QString  newSource)
signal

signal when a new source was chosen

Parameters
newSourcethe name of the new source

Referenced by addSource(), and setMenu().

QStringList DataSourceManager::sourceNames ( )
static

retrieve the names of all current active sources

Returns
list of names of the sources

Definition at line 65 of file data_source_manager.cpp.

References _sources, and instance().

Referenced by jocassview::OneDViewer::on_add_graph_triggered().

Member Data Documentation

QActionGroup* jocassview::DataSourceManager::_actionGroup
private

the action group where the menue items will be grouped

Definition at line 107 of file data_source_manager.h.

Referenced by addSource(), currentSourceName(), and setMenu().

DataSourceManager * DataSourceManager::_instance
staticprivate

an instane of this

Definition at line 98 of file data_source_manager.h.

Referenced by instance().

QSignalMapper* jocassview::DataSourceManager::_mapper
private

mapper for the signals of the signal group

Definition at line 110 of file data_source_manager.h.

Referenced by addSource(), and setMenu().

QMenu* jocassview::DataSourceManager::_sourceMenu
private

the source menu

Definition at line 104 of file data_source_manager.h.

Referenced by addSource(), and setMenu().

QMap<QString,DataSource*> jocassview::DataSourceManager::_sources
private

container for all data sources

Definition at line 101 of file data_source_manager.h.

Referenced by addSource(), source(), and sourceNames().


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