ATLAS Offline Software
Loading...
Searching...
No Matches
VP1Deserialise.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7// //
8// Header file for class VP1Deserialise //
9// //
10// Description: ... //
11// //
12// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
13// Initial version: June 2008 //
14// //
16
17#ifndef VP1DESERIALISE_H
18#define VP1DESERIALISE_H
19
21#include "VP1Base/VP1Msg.h"
22#include <typeinfo>
29//class JetCollectionSettingsButton;
31class SoMaterial;
32class QCheckBox;
33class QGroupBox;
34class QComboBox;
35class QLineEdit;
36class QDoubleSpinBox;
37class QSpinBox;
38class QSlider;
39class QToolBox;
40class QRadioButton;
41class QObject;
42class QWidget;
43
45public:
46
47 VP1Deserialise(const QByteArray &, IVP1System * sys = 0);//sys!=0 for messages in gui
48 virtual ~VP1Deserialise();
49
50 qint32 version() const;//Negative version indicates an error.
51
52 void ignoreWidget(QWidget*);//Ignores widget and all children.
53 void widgetHandled(QWidget*);//Indicates that the widget should be considered as handled.
54 void warnUnrestored(QObject*);//Any (stateful) widget children whose state was not saved result in a warning!
55 void disableUnrestoredChecks();//In the rare case where you really do not want to call the previous method, disable warnings by calling this.
56
57 bool atEnd() const;
58
59 //Bools:
60 bool restoreBool();
61 void restore(QCheckBox *sb);
62 void restore(QGroupBox*);//Checkable groupboxes only
63
64 //Strings:
65 QString restoreString();
66 void restore(QComboBox *sb);
67 void restore(QLineEdit*);
68 void restoreByTitle(QToolBox*);//Better if number of pages is not constant.
69
70 //Doubles:
71 double restoreDouble();
72 void restore(QDoubleSpinBox *sb, const double& unit = 1.0 );
73
74 //Ints:
75 qint32 restoreInt();
76 void restore(QSpinBox *sb);
77 void restore(QSlider*);
78 void restore(QToolBox *tb);
79 void restore( QRadioButton * rb0,//Add all radio buttons in a given group here.
80 QRadioButton * rb1,//We save an integer indicating which is checked.
81 QRadioButton * rb2 = 0,
82 QRadioButton * rb3 = 0,
83 QRadioButton * rb4 = 0,
84 QRadioButton * rb5 = 0,
85 QRadioButton * rb6 = 0,
86 QRadioButton * rb7 = 0,
87 QRadioButton * rb8 = 0,
88 QRadioButton * rb9 = 0 );
89
90 //ByteArrays:
91 QByteArray restoreByteArray();
93 void restore(SoMaterial*);
95// void restore(JetCollectionSettingsButton*w);
100
101 //QColor's:
102 QColor restoreColor();
104
105 //Custom (with datastream):
106 template <class T>
107 T restore();
108
109
110 //When ensuring backwards compatibility, older version()'s might
111 //require calls to one of the following to ignore parts of the data
112 //in the stream:
113 void ignoreBool();
114 void ignoreInt();
115 void ignoreDouble();
116 void ignoreString();
117 void ignoreByteArray();
119 void ignoreObsoletePhiSectionWidgetState();//QPair<int,QList<int> >
120
121 static unsigned numberOfInstantiations();//Number of times the constructor was invoked.
122 static void decrementNumberOfInstantiations();//Only ever call this from code in VP1Base!!
123
124private:
125
126 class Imp;
128 QDataStream * stream();
129
130};
131
133// INLINES //
135
136template <class T>
137T VP1Deserialise::restore() {//Fallback template method
138 if (verbose())
139 messageVerbose("Restoring "+QString(typeid(T).name())+" via datastream operator");
140 T t;
141 *(stream()) >> t;
142 return t;
143}
144
145#endif
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
VP1Deserialise(const QByteArray &, IVP1System *sys=0)
static unsigned numberOfInstantiations()
QByteArray restoreByteArray()
void ignoreWidget(QWidget *)
bool atEnd() const
void disableUnrestoredChecks()
QString restoreString()
virtual ~VP1Deserialise()
void ignoreObsoletePhiSectionWidgetState()
void warnUnrestored(QObject *)
void ignoreColor()
static void decrementNumberOfInstantiations()
QDataStream * stream()
void widgetHandled(QWidget *)
qint32 version() const
void restoreByTitle(QToolBox *)
VP1HelperClassBase(IVP1System *sys=0, QString helpername="")
void messageVerbose(const QString &) const