| 1 | /* | 
|---|
| 2 | * QSeisCurveRegistry.hpp | 
|---|
| 3 | * | 
|---|
| 4 | *  Created on: Jan 30, 2011 | 
|---|
| 5 | *      Author: landvogt | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef QSEISCURVEREGISTRY_HPP | 
|---|
| 9 | #define QSEISCURVEREGISTRY_HPP | 
|---|
| 10 |  | 
|---|
| 11 | // include config.h | 
|---|
| 12 | #ifdef HAVE_CONFIG_H | 
|---|
| 13 | #include <config.h> | 
|---|
| 14 | #endif | 
|---|
| 15 |  | 
|---|
| 16 | #include <QtCore/QObject> | 
|---|
| 17 | #include "CodePatterns/Registry.hpp" | 
|---|
| 18 | #include "CodePatterns/Singleton.hpp" | 
|---|
| 19 |  | 
|---|
| 20 | /** | 
|---|
| 21 | * \class QSeisCurveRegistry | 
|---|
| 22 | * | 
|---|
| 23 | * This class acts as a registry for all | 
|---|
| 24 | * currently available QSeisPlotCurves. | 
|---|
| 25 | * | 
|---|
| 26 | * The (un)registerInstance functions where | 
|---|
| 27 | * reimplemented to include the curveAdded/ | 
|---|
| 28 | * Changed/Removed signals. | 
|---|
| 29 | * The QSeisPageRegistry relays on this | 
|---|
| 30 | * signals to maintain the existing list of | 
|---|
| 31 | * available curves. | 
|---|
| 32 | * | 
|---|
| 33 | * The resetRegistry() function is basically | 
|---|
| 34 | * the normal Registry::cleanup() function, | 
|---|
| 35 | * it only emits additionally the curveRemoved() | 
|---|
| 36 | * signal for every curve to keep the | 
|---|
| 37 | * PageRegistry on track. | 
|---|
| 38 | **/ | 
|---|
| 39 |  | 
|---|
| 40 | class QSeisPlotCurve; | 
|---|
| 41 |  | 
|---|
| 42 | class QSeisCurveRegistry : public QObject, public Registry<QSeisPlotCurve>, public Singleton<QSeisCurveRegistry> | 
|---|
| 43 | { | 
|---|
| 44 | Q_OBJECT | 
|---|
| 45 |  | 
|---|
| 46 | friend class Singleton<QSeisCurveRegistry>; | 
|---|
| 47 |  | 
|---|
| 48 | public: | 
|---|
| 49 | void registerInstance(QSeisPlotCurve *instance); | 
|---|
| 50 | void unregisterInstance(QSeisPlotCurve *instance); | 
|---|
| 51 | void resetRegistry(); | 
|---|
| 52 |  | 
|---|
| 53 | private: | 
|---|
| 54 | QSeisCurveRegistry(); | 
|---|
| 55 | ~QSeisCurveRegistry(); | 
|---|
| 56 |  | 
|---|
| 57 | signals: | 
|---|
| 58 | void curveAdded(std::string name, QString type); | 
|---|
| 59 | void curveChanged(std::string name, QString type); | 
|---|
| 60 | void curveRemoved(std::string name, QString type); | 
|---|
| 61 | }; | 
|---|
| 62 |  | 
|---|
| 63 | #endif // QSEISCURVEREGISTRY_HPP | 
|---|