ATLAS Offline Software
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
VP1Deserialise Class Reference

#include <VP1Deserialise.h>

Inheritance diagram for VP1Deserialise:
Collaboration diagram for VP1Deserialise:

Classes

class  Imp
 

Public Member Functions

 VP1Deserialise (const QByteArray &, IVP1System *sys=0)
 
virtual ~VP1Deserialise ()
 
qint32 version () const
 
void ignoreWidget (QWidget *)
 
void widgetHandled (QWidget *)
 
void warnUnrestored (QObject *)
 
void disableUnrestoredChecks ()
 
bool atEnd () const
 
bool restoreBool ()
 
void restore (QCheckBox *sb)
 
void restore (QGroupBox *)
 
QString restoreString ()
 
void restore (QComboBox *sb)
 
void restore (QLineEdit *)
 
void restoreByTitle (QToolBox *)
 
double restoreDouble ()
 
void restore (QDoubleSpinBox *sb, const double &unit=1.0)
 
qint32 restoreInt ()
 
void restore (QSpinBox *sb)
 
void restore (QSlider *)
 
void restore (QToolBox *tb)
 
void restore (QRadioButton *rb0, QRadioButton *rb1, QRadioButton *rb2=0, QRadioButton *rb3=0, QRadioButton *rb4=0, QRadioButton *rb5=0, QRadioButton *rb6=0, QRadioButton *rb7=0, QRadioButton *rb8=0, QRadioButton *rb9=0)
 
QByteArray restoreByteArray ()
 
void restore (VP1MaterialButton *)
 
void restore (SoMaterial *)
 
void restore (VP1CollectionWidget *)
 
void restore (VP1CollectionSettingsButtonBase *w)
 
void restore (VP1EtaPhiCutWidget *)
 
void restore (VP1DrawOptionsWidget *)
 
void restore (PhiSectionWidget *)
 
QColor restoreColor ()
 
void restore (VP1ColorSelectButton *)
 
template<class T >
restore ()
 
void ignoreBool ()
 
void ignoreInt ()
 
void ignoreDouble ()
 
void ignoreString ()
 
void ignoreByteArray ()
 
void ignoreColor ()
 
void ignoreObsoletePhiSectionWidgetState ()
 
void setSystemBasePointer (IVP1System *sys)
 
void message (const QString &) const
 
void message (const QStringList &, const QString &addtoend="") const
 
void message (const QString &addtostart, const QStringList &, const QString &addtoend="") const
 
void messageDebug (const QString &) const
 
void messageDebug (const QStringList &, const QString &addtoend="") const
 
void messageDebug (const QString &addtostart, const QStringList &, const QString &addtoend="") const
 
void messageVerbose (const QString &) const
 
void messageVerbose (const QStringList &, const QString &addtoend="") const
 
void messageVerbose (const QString &addtostart, const QStringList &, const QString &addtoend="") const
 
IVP1SystemsystemBase () const
 
const QString & helperClassName () const
 

Static Public Member Functions

static unsigned numberOfInstantiations ()
 
static void decrementNumberOfInstantiations ()
 
static bool verbose ()
 
static void warnUndeletedInstances ()
 
static QString str (const QString &s)
 
static QString str (const char *c)
 
static QString str (const bool b)
 
static QString str (const QColor &)
 
static QString str (const SbColor &)
 
static QString str (const VP1Interval &)
 
static QString str (const SbVec2d &)
 
static QString str (const SbVec2f &)
 
static QString str (const SbVec2s &)
 
static QString str (const SbVec3d &)
 
static QString str (const SbVec3f &)
 
static QString str (const SbVec3s &)
 
static QString str (const SbVec4d &)
 
static QString str (const SbVec4f &)
 
static QString str (short int n)
 
static QString str (unsigned short int n)
 
static QString str (long n)
 
static QString str (ulong n)
 
static QString str (int n)
 
static QString str (uint n)
 
static QString str (qlonglong n)
 
static QString str (qulonglong n)
 
static QString str (const double &d)
 
static QString str (const float &f)
 
static QString str (const void *)
 
template<class T >
static QString str (const T *t)
 
template<class T >
static QString str (const QFlags< T > &f)
 
template<class T >
static QString str (const HepGeom::BasicVector3D< T > &t)
 
static QString str (const Amg::Vector3D &t)
 
template<class T >
static QString str (const QList< T > &t)
 

Protected Member Functions

void setHelperClassName (const QString &n)
 

Private Member Functions

QDataStream * stream ()
 

Private Attributes

Impm_d
 
QString m_helpername
 
IVP1Systemm_system
 

Static Private Attributes

static const bool s_vp1verbose = VP1QtUtils::environmentVariableIsOn("VP1_VERBOSE_OUTPUT")
 

Detailed Description

Definition at line 44 of file VP1Deserialise.h.

Constructor & Destructor Documentation

◆ VP1Deserialise()

VP1Deserialise::VP1Deserialise ( const QByteArray &  ba,
IVP1System sys = 0 
)

Definition at line 101 of file VP1Deserialise.cxx.

102  : VP1HelperClassBase(sys,"VP1Deserialise"), m_d(new Imp(this))
103 {
105 
106  m_d->byteArray = ba;
107  m_d->buffer = new QBuffer(&(m_d->byteArray));
108  if (!m_d->buffer->open(QIODevice::ReadOnly)) {
109  delete m_d->buffer;
110  m_d->buffer = 0;
111  m_d->version = -1;
112  //Fixme: ensure that other methods do not do anything (or are not called!)
113  //Ensure that we are at end of stream when finished - and print versions (data+preferred).
114  } else {
115  m_d->state = new QDataStream(m_d->buffer);
116  m_d->version = restoreInt();
117  }
118 }

◆ ~VP1Deserialise()

VP1Deserialise::~VP1Deserialise ( )
virtual

Definition at line 121 of file VP1Deserialise.cxx.

122 {
123  if (!m_d->checkedUnused)
124  message("WARNING: warnUnrestored(..) was never called!");
125  if (!atEnd())
126  message("Destructor WARNING: Buffer not at end!");
127  m_d->buffer->close();
128  delete m_d->state;
129  m_d->state = 0;
130  delete m_d->buffer;
131  m_d->buffer = 0;
132  delete m_d;
133 }

Member Function Documentation

◆ atEnd()

bool VP1Deserialise::atEnd ( ) const

Definition at line 136 of file VP1Deserialise.cxx.

137 {
138  return m_d->buffer->atEnd();
139 }

◆ decrementNumberOfInstantiations()

void VP1Deserialise::decrementNumberOfInstantiations ( )
static

Definition at line 95 of file VP1Deserialise.cxx.

96 {
98 }

◆ disableUnrestoredChecks()

void VP1Deserialise::disableUnrestoredChecks ( )

Definition at line 689 of file VP1Deserialise.cxx.

690 {
691  m_d->checkedUnused = true;
692 }

◆ helperClassName()

const QString& VP1HelperClassBase::helperClassName ( ) const
inlineinherited

Definition at line 51 of file VP1HelperClassBase.h.

51 { return m_helpername; }

◆ ignoreBool()

void VP1Deserialise::ignoreBool ( )

Definition at line 587 of file VP1Deserialise.cxx.

588 {
589  bool b;
590  (*(m_d->state)) >> b;
591  if (VP1Msg::verbose()){
592  messageVerbose("Ignoring bool "+str(b));
593  }
594 }

◆ ignoreByteArray()

void VP1Deserialise::ignoreByteArray ( )

Definition at line 627 of file VP1Deserialise.cxx.

628 {
629  QByteArray ba;
630  (*(m_d->state)) >> ba;
631  if (VP1Msg::verbose()){
632  messageVerbose("Ignoring byte array (length = "+QString::number(ba.count())+")");
633  }
634 }

◆ ignoreColor()

void VP1Deserialise::ignoreColor ( )

◆ ignoreDouble()

void VP1Deserialise::ignoreDouble ( )

Definition at line 607 of file VP1Deserialise.cxx.

608 {
609  double dbl;
610  (*(m_d->state)) >> dbl;
611  if (VP1Msg::verbose()){
612  messageVerbose("Ignoring double "+str(dbl));
613  }
614 }

◆ ignoreInt()

void VP1Deserialise::ignoreInt ( )

Definition at line 597 of file VP1Deserialise.cxx.

598 {
599  qint32 i;
600  (*(m_d->state)) >> i;
601  if (VP1Msg::verbose()){
602  messageVerbose("Ignoring int "+str(i));
603  }
604 }

◆ ignoreObsoletePhiSectionWidgetState()

void VP1Deserialise::ignoreObsoletePhiSectionWidgetState ( )

Definition at line 637 of file VP1Deserialise.cxx.

638 {
639  QPair<int,QList<int> > state;
640  (*(m_d->state)) >> state;
641  if (VP1Msg::verbose()){
642  messageVerbose("Ignoring obsolete phi section widget state");
643  }
644 }

◆ ignoreString()

void VP1Deserialise::ignoreString ( )

Definition at line 617 of file VP1Deserialise.cxx.

618 {
619  QString t;
620  (*(m_d->state)) >> t;
621  if (VP1Msg::verbose()){
622  messageVerbose("Ignoring string "+t);
623  }
624 }

◆ ignoreWidget()

void VP1Deserialise::ignoreWidget ( QWidget *  w)

Definition at line 647 of file VP1Deserialise.cxx.

648 {
649  if(VP1Msg::debug()){
650  messageDebug("VP1Deserialise::ignoreWidget(QWidget) - name: " + w->objectName());
651  }
652  if (w)
653  m_d->ignoredWidgets.insert(w);
654 }

◆ message() [1/3]

void VP1HelperClassBase::message ( const QString &  str) const
inherited

Definition at line 49 of file VP1HelperClassBase.cxx.

50 {
51  if (m_helpername.isEmpty()) {
52  if (m_system)
54  else
55  std::cout<<VP1Msg::prefix_msg()<<" [nameless helper class]: "<<str.toStdString()<<std::endl;
56  } else {
57  if (m_system)
58  m_system->message("["+m_helpername+"] " + str);
59  else
60  std::cout<<VP1Msg::prefix_msg()<<" ["<<m_helpername.toStdString()<<"]: "<<str.toStdString()<<std::endl;
61  }
62 }

◆ message() [2/3]

void VP1HelperClassBase::message ( const QString &  addtostart,
const QStringList &  l,
const QString &  addtoend = "" 
) const
inherited

Definition at line 131 of file VP1HelperClassBase.cxx.

132 {
133  if (addtostart.isEmpty()) {
134  message(l,addtoend);
135  return;
136  }
137  if (addtoend.isEmpty()) {
138  for (const QString& s : l)
139  message(addtostart+s);
140  } else {
141  for (const QString& s : l)
142  message(addtostart+s+addtoend);
143  }
144 }

◆ message() [3/3]

void VP1HelperClassBase::message ( const QStringList &  l,
const QString &  addtoend = "" 
) const
inherited

Definition at line 91 of file VP1HelperClassBase.cxx.

92 {
93  if (addtoend.isEmpty()) {
94  for (const QString& s : l)
95  message(s);
96  } else {
97  for (const QString& s : l)
98  message(s+addtoend);
99  }
100 }

◆ messageDebug() [1/3]

void VP1HelperClassBase::messageDebug ( const QString &  str) const
inherited

Definition at line 65 of file VP1HelperClassBase.cxx.

66 {
67  if (!VP1Msg::debug())
68  return;
69  std::string sysstring(m_system ? " in "+m_system->name().toStdString() : std::string(""));
70  if (m_helpername.isEmpty()) {
71  std::cout<<VP1Msg::prefix_debug()<<" [helper"<<sysstring<<"]: "<<str.toStdString()<<std::endl;
72  } else {
73  std::cout<<VP1Msg::prefix_debug()<<" ["<<m_helpername.toStdString()<<sysstring<<"]: "<<str.toStdString()<<std::endl;
74  }
75 }

◆ messageDebug() [2/3]

void VP1HelperClassBase::messageDebug ( const QString &  addtostart,
const QStringList &  l,
const QString &  addtoend = "" 
) const
inherited

Definition at line 147 of file VP1HelperClassBase.cxx.

148 {
149  if (!VP1Msg::debug())
150  return;
151  if (addtostart.isEmpty()) {
152  messageDebug(l,addtoend);
153  return;
154  }
155  if (addtoend.isEmpty()) {
156  for (const QString& s : l)
157  messageDebug(addtostart+s);
158  } else {
159  for (const QString& s : l)
160  messageDebug(addtostart+s+addtoend);
161  }
162 }

◆ messageDebug() [3/3]

void VP1HelperClassBase::messageDebug ( const QStringList &  l,
const QString &  addtoend = "" 
) const
inherited

Definition at line 103 of file VP1HelperClassBase.cxx.

104 {
105  if (!VP1Msg::debug())
106  return;
107  if (addtoend.isEmpty()) {
108  for (const QString& s : l)
109  messageDebug(s);
110  } else {
111  for (const QString& s : l)
112  messageDebug(s+addtoend);
113  }
114 }

◆ messageVerbose() [1/3]

void VP1HelperClassBase::messageVerbose ( const QString &  str) const
inherited

Definition at line 78 of file VP1HelperClassBase.cxx.

79 {
80  if (!VP1Msg::verbose())
81  return;
82  std::string sysstring(m_system ? " in "+m_system->name().toStdString() : std::string(""));
83  if (m_helpername.isEmpty()) {
84  std::cout<<VP1Msg::prefix_verbose()<<" [helper"<<sysstring<<"]: "<<str.toStdString()<<std::endl;
85  } else {
86  std::cout<<VP1Msg::prefix_verbose()<<" ["<<m_helpername.toStdString()<<sysstring<<"]: "<<str.toStdString()<<std::endl;
87  }
88 }

◆ messageVerbose() [2/3]

void VP1HelperClassBase::messageVerbose ( const QString &  addtostart,
const QStringList &  l,
const QString &  addtoend = "" 
) const
inherited

Definition at line 165 of file VP1HelperClassBase.cxx.

166 {
167  if (!VP1Msg::verbose())
168  return;
169  if (addtostart.isEmpty()) {
170  messageVerbose(l,addtoend);
171  return;
172  }
173  if (addtoend.isEmpty()) {
174  for (const QString& s : l)
175  messageVerbose(addtostart+s);
176  } else {
177  for (const QString& s : l)
178  messageVerbose(addtostart+s+addtoend);
179  }
180 }

◆ messageVerbose() [3/3]

void VP1HelperClassBase::messageVerbose ( const QStringList &  l,
const QString &  addtoend = "" 
) const
inherited

Definition at line 117 of file VP1HelperClassBase.cxx.

118 {
119  if (!VP1Msg::verbose())
120  return;
121  if (addtoend.isEmpty()) {
122  for (const QString& s : l)
123  messageVerbose(s);
124  } else {
125  for (const QString& s : l)
126  messageVerbose(s+addtoend);
127  }
128 }

◆ numberOfInstantiations()

unsigned VP1Deserialise::numberOfInstantiations ( )
static

Definition at line 89 of file VP1Deserialise.cxx.

90 {
92 }

◆ restore() [1/18]

template<class T >
T VP1Deserialise::restore

Definition at line 137 of file VP1Deserialise.h.

137  {//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 }

◆ restore() [2/18]

void VP1Deserialise::restore ( PhiSectionWidget phi)

Definition at line 218 of file VP1Deserialise.cxx.

219 {
220  if(VP1Msg::debug()){
221  messageDebug("VP1Deserialise::restore(PhiSectionWidget) - name: " + phi->objectName());
222  }
223  m_d->handle(phi);
224  QByteArray ba(restoreByteArray());
225  if (phi&&ba != QByteArray()) {
226  m_d->block(phi);
227  phi->setState(std::move(ba));
228  m_d->unblock();
229  }
230 }

◆ restore() [3/18]

void VP1Deserialise::restore ( QCheckBox *  sb)

Definition at line 244 of file VP1Deserialise.cxx.

245 {
246  if(VP1Msg::debug()){
247  messageDebug("VP1Deserialise::restore(QCheckBox) - name: " + cb->objectName());
248  }
249 
250  m_d->handle(cb);
251 
252  bool b = restoreBool();
253 
254  if(VP1Msg::debug()){
255  messageDebug("bool b: "+QString::number(b));
256  messageDebug("bool cb: "+QString::number( cb->isChecked() ));
257  }
258 
259  if (cb->isChecked()!=b) {
260  m_d->block(cb);
261  if(VP1Msg::debug()){
262  messageDebug("setting - checked: "+QString::number( b ));
263  }
264  cb->setChecked(b);
265  m_d->unblock();
266  }
267 }

◆ restore() [4/18]

void VP1Deserialise::restore ( QComboBox *  sb)

Definition at line 287 of file VP1Deserialise.cxx.

288 {
289  if(VP1Msg::debug()){
290  messageDebug("VP1Deserialise::restore(QComboBox) - name: " + cb->objectName());
291  }
292  m_d->handle(cb);
293  QString t = restoreString();
294  if (t.isEmpty())
295  return;
296  int i = cb->findText(t);
297  if (i<0||i>cb->count()-1)
298  return;
299  if (cb->currentIndex()!=i) {
300  m_d->block(cb);
301  cb->setCurrentIndex(i);
302  m_d->unblock();
303  }
304 }

◆ restore() [5/18]

void VP1Deserialise::restore ( QDoubleSpinBox *  sb,
const double &  unit = 1.0 
)

Definition at line 322 of file VP1Deserialise.cxx.

323 {
324  if(VP1Msg::debug()){
325  messageDebug("VP1Deserialise::restore(QDoubleSpinBox) - name: " + sb->objectName());
326  }
327  m_d->handle(sb);
328  double dbl = (unit == 1.0 ? restoreDouble() : restoreDouble()/unit);
329  dbl = std:: max(std::min(dbl,sb->maximum()),sb->minimum());
330  if (sb->value()!=dbl) {
331  m_d->block(sb);
332  sb->setValue(dbl);
333  m_d->unblock();
334  }
335 }

◆ restore() [6/18]

void VP1Deserialise::restore ( QGroupBox *  gb)

Definition at line 270 of file VP1Deserialise.cxx.

271 {
272  if(VP1Msg::debug()){
273  messageDebug("VP1Deserialise::restore(QGroupBox) - name: " + gb->objectName());
274  }
275  if (!gb->isCheckable())
276  message("WARNING: Asked to handled GroupBox which is not checkable: "+gb->objectName());
277  m_d->handle(gb);
278  bool b = restoreBool();
279  if (gb->isChecked()!=b) {
280  m_d->block(gb);
281  gb->setChecked(b);
282  m_d->unblock();
283  }
284 }

◆ restore() [7/18]

void VP1Deserialise::restore ( QLineEdit *  le)

Definition at line 307 of file VP1Deserialise.cxx.

308 {
309  if(VP1Msg::debug()){
310  messageDebug("VP1Deserialise::restore(QLineEdit) - name: " + le->objectName());
311  }
312  m_d->handle(le);
313  QString s = restoreString();
314  if (s!=le->text()) {
315  m_d->block(le);
316  le->setText(s);
317  m_d->unblock();
318  }
319 }

◆ restore() [8/18]

void VP1Deserialise::restore ( QRadioButton *  rb0,
QRadioButton *  rb1,
QRadioButton *  rb2 = 0,
QRadioButton *  rb3 = 0,
QRadioButton *  rb4 = 0,
QRadioButton *  rb5 = 0,
QRadioButton *  rb6 = 0,
QRadioButton *  rb7 = 0,
QRadioButton *  rb8 = 0,
QRadioButton *  rb9 = 0 
)

Definition at line 450 of file VP1Deserialise.cxx.

460 {
461  qint32 ichecked = restoreInt();
462  QList<QRadioButton *> l;
463  l << rb0 << rb1 << rb2 << rb3 << rb4 << rb5 << rb6 << rb7 << rb8 << rb9;
464  for (qint32 i = 0; i < l.count(); ++i) {
465  if (l.at(i)) {
466  if(VP1Msg::debug()){
467  messageDebug("VP1Deserialise::restore(QRadioButton) - name: " + l.at(i)->objectName());
468  }
469  m_d->handle(l.at(i));
470  }
471  }
472  //We only change any state if we have a pointer to the one needing to be checked:
473  if (ichecked<0||ichecked>=l.count()||!l.at(ichecked))
474  return;
475  for (qint32 i = 0; i < l.count(); ++i) {
476  QRadioButton * rb = l.at(i);
477  if (rb&&rb->isChecked()!=(i==ichecked)) {
478  m_d->block(rb);
479  rb->setChecked(i==ichecked);
480  m_d->unblock();
481  }
482  }
483 }

◆ restore() [9/18]

void VP1Deserialise::restore ( QSlider *  s)

Definition at line 354 of file VP1Deserialise.cxx.

355 {
356  if(VP1Msg::debug()){
357  messageDebug("VP1Deserialise::restore(QSlider) - name: " + s->objectName());
358  }
359  m_d->handle(s);
360  qint32 i = restoreInt();
361  i = std:: max(std::min(i,s->maximum()),s->minimum());
362  if (s->value()!=i) {
363  m_d->block(s);
364  s->setValue(i);
365  m_d->unblock();
366  }
367 }

◆ restore() [10/18]

void VP1Deserialise::restore ( QSpinBox *  sb)

Definition at line 338 of file VP1Deserialise.cxx.

339 {
340  if(VP1Msg::debug()){
341  messageDebug("VP1Deserialise::restore(QSpinBox) - name: " + sb->objectName());
342  }
343  m_d->handle(sb);
344  qint32 i = restoreInt();
345  i = std:: max(std::min(i,sb->maximum()),sb->minimum());
346  if (sb->value()!=i) {
347  m_d->block(sb);
348  sb->setValue(i);
349  m_d->unblock();
350  }
351 }

◆ restore() [11/18]

void VP1Deserialise::restore ( QToolBox *  tb)

Definition at line 370 of file VP1Deserialise.cxx.

371 {
372  if(VP1Msg::debug()){
373  messageDebug("VP1Deserialise::restore(QToolBox) - name: " + tb->objectName());
374  }
375  m_d->handle(tb);
376  qint32 i = restoreInt();
377  if (i>=0&&i<tb->count()&&i!=tb->currentIndex()) {
378  m_d->block(tb);
379  tb->setCurrentIndex(i);
380  m_d->unblock();
381  }
382 }

◆ restore() [12/18]

void VP1Deserialise::restore ( SoMaterial *  m)

Definition at line 154 of file VP1Deserialise.cxx.

155 {
156  if(VP1Msg::debug()){
157  messageDebug("VP1Deserialise::restore(SoMaterial)");
158  }
159  QByteArray ba(restoreByteArray());
160  if (!m||ba.isEmpty())
161  return;
163 }

◆ restore() [13/18]

void VP1Deserialise::restore ( VP1CollectionSettingsButtonBase w)

Definition at line 514 of file VP1Deserialise.cxx.

515 {
516  if(VP1Msg::debug()){
517  messageDebug("VP1Deserialise::restore(VP1CollectionSettingsButtonBase) - name: " + w->objectName());
518  messageDebug("VP1Deserialise::restore(VP1CollectionSettingsButtonBase)- start...");
519  }
520  m_d->handle(w);
521  ignoreWidget(w);//To ignore all children of the widget.
522 
523  QByteArray ba = restoreByteArray();
524  if (w&&ba!=QByteArray()) {
525  m_d->block(w);
526  w->restoreFromState(ba);
527  m_d->unblock();
528  }
529  if(VP1Msg::debug()){
530  messageDebug("VP1Deserialise::restore(VP1CollectionSettingsButtonBase)- end.");
531  }
532 }

◆ restore() [14/18]

void VP1Deserialise::restore ( VP1CollectionWidget cw)

Definition at line 486 of file VP1Deserialise.cxx.

487 {
488  if(VP1Msg::debug()){
489  messageDebug("VP1Deserialise::restore(VP1CollectionWidget) - name: " + cw->objectName());
490  messageDebug("VP1Deserialise::restore(VP1CollectionWidget)- start...");
491  }
492  m_d->handle(cw);
493  ignoreWidget(cw);//To ignore all children of the collection widget.
494  QByteArray ba(restoreByteArray());
495  QBuffer buffer(&ba);
496  buffer.open(QIODevice::ReadOnly);
497  QDataStream state(&buffer);
498  qint32 version;
499  state >> version;
500  if (version!=0)
501  return;//We ignore wrong versions silently here.
502  VP1CollStates cwstates;
503  state >> cwstates;
504  buffer.close();
505  m_d->block(cw);
506  cw->addStateInfo(cwstates,true/*overwrite existing*/);
507  m_d->unblock();
508  if(VP1Msg::debug()){
509  messageDebug("VP1Deserialise::restore(VP1CollectionWidget)- end.");
510  }
511 }

◆ restore() [15/18]

void VP1Deserialise::restore ( VP1ColorSelectButton cb)

Definition at line 203 of file VP1Deserialise.cxx.

204 {
205  if(VP1Msg::debug()){
206  messageDebug("VP1Deserialise::restore(VP1ColorSelectButton) - name: " + cb->objectName());
207  }
208  m_d->handle(cb);
209  QColor c = restoreColor();
210  if (c.isValid()&&cb&&cb->color()!=c) {
211  m_d->block(cb);
212  cb->setColor(c);
213  m_d->unblock();
214  }
215 }

◆ restore() [16/18]

void VP1Deserialise::restore ( VP1DrawOptionsWidget w)

Definition at line 570 of file VP1Deserialise.cxx.

571 {
572  if(VP1Msg::debug()){
573  messageDebug("VP1Deserialise::restore(VP1DrawOptionsWidget) - name: " + w->objectName());
574  }
575  m_d->handle(w);
576  ignoreWidget(w);//To ignore all children of the widget.
577 
578  QByteArray ba = restoreByteArray();
579  if (w&&ba!=QByteArray()) {
580  m_d->block(w);
581  w->applyState(ba);
582  m_d->unblock();
583  }
584 }

◆ restore() [17/18]

void VP1Deserialise::restore ( VP1EtaPhiCutWidget w)

Definition at line 550 of file VP1Deserialise.cxx.

551 {
552  if(VP1Msg::debug()){
553  messageDebug("VP1Deserialise::restore(VP1EtaPhiCutWidget) - name: " + w->objectName());
554  }
555  m_d->handle(w);
556  ignoreWidget(w);//To ignore all children of the widget.
557 
558  QByteArray ba = restoreByteArray();
559  if (w&&ba!=QByteArray()) {
560  m_d->block(w);
561  w->restoreFromState(ba);
562  m_d->unblock();
563  }
564 }

◆ restore() [18/18]

void VP1Deserialise::restore ( VP1MaterialButton mb)

Definition at line 166 of file VP1Deserialise.cxx.

167 {
168  if(VP1Msg::debug()){
169  messageDebug("VP1Deserialise::restore(VP1MaterialButton)");
170  }
171  m_d->handle(mb);
172  SoMaterial * m(0);
173  QList<SoMaterial*> mats = mb ? mb->handledMaterials() : QList<SoMaterial*>();
174  bool tempmat = mats.isEmpty() || !mats.at(0);
175  m = tempmat ? new SoMaterial : mats.at(0);
176  m->ref();
177  restore(m);
178  if (mb) {
179  m_d->block(mb);
180  mb->copyValuesFromMaterial(m);
181  m_d->unblock();
182  }
183  if (tempmat)
184  m->unref();
185  else
186  m->unrefNoDelete();
187 }

◆ restoreBool()

bool VP1Deserialise::restoreBool ( )

Definition at line 418 of file VP1Deserialise.cxx.

419 {
420  bool b;
421  (*(m_d->state)) >> b;
422  if (VP1Msg::verbose()){
423  messageVerbose("Restoring bool "+str(b));
424  }
425  return b;
426 }

◆ restoreByteArray()

QByteArray VP1Deserialise::restoreByteArray ( )

Definition at line 233 of file VP1Deserialise.cxx.

234 {
235  QByteArray ba;
236  (*(m_d->state)) >> ba;
237  if (VP1Msg::verbose()){
238  messageVerbose("Restoring byte array (length = "+QString::number(ba.count())+")");
239  }
240  return ba;
241 }

◆ restoreByTitle()

void VP1Deserialise::restoreByTitle ( QToolBox *  tb)

Definition at line 385 of file VP1Deserialise.cxx.

386 {
387  if(VP1Msg::debug()){
388  messageDebug("VP1Deserialise::restore(QToolBox) - name: " + tb->objectName());
389  }
390  m_d->handle(tb);
391  QString s = restoreString();
392  int itarget (-1);
393  for (int i = 0; i < tb->count(); ++i) {
394  if (tb->itemText(i)==s) {
395  itarget = i;
396  break;
397  }
398  }
399  if (itarget>0&&itarget<tb->count()&&itarget!=tb->currentIndex()) {
400  m_d->block(tb);
401  tb->setCurrentIndex(itarget);
402  m_d->unblock();
403  }
404 }

◆ restoreColor()

QColor VP1Deserialise::restoreColor ( )

Definition at line 190 of file VP1Deserialise.cxx.

191 {
192  QColor c;
193  (*(m_d->state)) >> c;
194  if(VP1Msg::debug()){
195  messageDebug("VP1Deserialise::restore(QColor) - name: " + c.name());
196  }
197  if (VP1Msg::verbose())
198  messageVerbose("Restoring color "+str(c));
199  return c;
200 }

◆ restoreDouble()

double VP1Deserialise::restoreDouble ( )

Definition at line 428 of file VP1Deserialise.cxx.

429 {
430  double dbl;
431  (*(m_d->state)) >> dbl;
432  if (VP1Msg::verbose()){
433  messageVerbose("Restoring double "+str(dbl));
434  }
435  return dbl;
436 }

◆ restoreInt()

qint32 VP1Deserialise::restoreInt ( )

Definition at line 439 of file VP1Deserialise.cxx.

440 {
441  qint32 i;
442  (*(m_d->state)) >> i;
443  if (VP1Msg::verbose()){
444  messageVerbose("Restoring int "+str(i));
445  }
446  return i;
447 }

◆ restoreString()

QString VP1Deserialise::restoreString ( )

Definition at line 408 of file VP1Deserialise.cxx.

409 {
410  QString t;
411  (*(m_d->state)) >> t;
412  if (VP1Msg::verbose()){
413  messageVerbose("Restoring string "+t);
414  }
415  return t;
416 }

◆ setHelperClassName()

void VP1HelperClassBase::setHelperClassName ( const QString &  n)
inlineprotectedinherited

Definition at line 59 of file VP1HelperClassBase.h.

59 { m_helpername = n; }

◆ setSystemBasePointer()

void VP1HelperClassBase::setSystemBasePointer ( IVP1System sys)
inherited

Definition at line 197 of file VP1HelperClassBase.cxx.

198 {
199  m_system = sys;
200  if (VP1Msg::verbose()){
201  vp1helperclassbase_instanceMap[this] = (m_system?m_system->name():QString(""));
202  }
203 }

◆ str() [1/30]

static QString VP1String::str ( const Amg::Vector3D t)
inlinestaticinherited

Definition at line 98 of file VP1String.h.

98 { return "("+str(t.x())+", "+str(t.y())+", "+str(t.z())+")"; }

◆ str() [2/30]

static QString VP1String::str ( const bool  b)
inlinestaticinherited

Definition at line 53 of file VP1String.h.

53 { return b?"True":"False"; }

◆ str() [3/30]

static QString VP1String::str ( const char *  c)
inlinestaticinherited

Definition at line 50 of file VP1String.h.

50 { return c; }

◆ str() [4/30]

static QString VP1String::str ( const double &  d)
inlinestaticinherited

Definition at line 81 of file VP1String.h.

81 { return QString::number(d); }

◆ str() [5/30]

static QString VP1String::str ( const float &  f)
inlinestaticinherited

Definition at line 82 of file VP1String.h.

82 { return QString::number(f); }

◆ str() [6/30]

template<class T >
static QString VP1String::str ( const HepGeom::BasicVector3D< T > &  t)
inlinestaticinherited

Definition at line 95 of file VP1String.h.

95 { return "("+str(t.x())+", "+str(t.y())+", "+str(t.z())+")"; }

◆ str() [7/30]

QString VP1String::str ( const QColor &  c)
staticinherited

Definition at line 30 of file VP1String.cxx.

31 {
32  return c.isValid() ? c.name() : "Invalid";
33 }

◆ str() [8/30]

template<class T >
static QString VP1String::str ( const QFlags< T > &  f)
inlinestaticinherited

Definition at line 91 of file VP1String.h.

91 { return "0x"+QString::number(f, 16).toUpper().rightJustified(8,'0'); }

◆ str() [9/30]

template<class T >
static QString VP1String::str ( const QList< T > &  t)
inlinestaticinherited

Definition at line 102 of file VP1String.h.

102 { return "QList of size"+QString::number(t.size()); }

◆ str() [10/30]

static QString VP1String::str ( const QString &  s)
inlinestaticinherited

Definition at line 49 of file VP1String.h.

49 { return s; }

◆ str() [11/30]

QString VP1String::str ( const SbColor &  c)
staticinherited

Definition at line 36 of file VP1String.cxx.

37 {
39 }

◆ str() [12/30]

QString VP1String::str ( const SbVec2d &  v)
staticinherited

Definition at line 61 of file VP1String.cxx.

61 { double x,y; v.getValue(x,y); return "("+str(x)+", "+str(y)+")"; }

◆ str() [13/30]

QString VP1String::str ( const SbVec2f &  v)
staticinherited

Definition at line 62 of file VP1String.cxx.

62 { float x,y; v.getValue(x,y); return "("+str(x)+", "+str(y)+")"; }

◆ str() [14/30]

QString VP1String::str ( const SbVec2s &  v)
staticinherited

Definition at line 63 of file VP1String.cxx.

63 { short x,y; v.getValue(x,y); return "("+str(x)+", "+str(y)+")"; }

◆ str() [15/30]

QString VP1String::str ( const SbVec3d &  v)
staticinherited

Definition at line 64 of file VP1String.cxx.

64 { double x,y,z; v.getValue(x,y,z); return "("+str(x)+", "+str(y)+", "+str(z)+")"; }

◆ str() [16/30]

QString VP1String::str ( const SbVec3f &  v)
staticinherited

Definition at line 65 of file VP1String.cxx.

65 { float x,y,z; v.getValue(x,y,z); return "("+str(x)+", "+str(y)+", "+str(z)+")"; }

◆ str() [17/30]

QString VP1String::str ( const SbVec3s &  v)
staticinherited

Definition at line 66 of file VP1String.cxx.

66 { short x,y,z; v.getValue(x,y,z); return "("+str(x)+", "+str(y)+", "+str(z)+")"; }

◆ str() [18/30]

QString VP1String::str ( const SbVec4d &  v)
staticinherited

Definition at line 67 of file VP1String.cxx.

67 { double x,y,z,t; v.getValue(x,y,z,t); return "("+str(x)+", "+str(y)+", "+str(z)+", "+str(t)+")"; }

◆ str() [19/30]

QString VP1String::str ( const SbVec4f &  v)
staticinherited

Definition at line 68 of file VP1String.cxx.

68 { float x,y,z,t; v.getValue(x,y,z,t); return "("+str(x)+", "+str(y)+", "+str(z)+", "+str(t)+")"; }

◆ str() [20/30]

template<class T >
static QString VP1String::str ( const T *  t)
inlinestaticinherited

Definition at line 87 of file VP1String.h.

87 { return str(static_cast<const void* >(t)); }

◆ str() [21/30]

QString VP1String::str ( const void *  p)
staticinherited

Definition at line 48 of file VP1String.cxx.

49 {
50  if (p) {
51  std::ostringstream s;
52  s << p;
53  // Explicitly naming QString here avoids a cppcheck warning.
54  return QString (s.str().c_str());
55  } else {
56  return "NULL";
57  }
58 }

◆ str() [22/30]

QString VP1String::str ( const VP1Interval i)
staticinherited

Definition at line 42 of file VP1String.cxx.

43 {
44  return i.toString();
45 }

◆ str() [23/30]

static QString VP1String::str ( int  n)
inlinestaticinherited

Definition at line 77 of file VP1String.h.

77 { return QString::number(n); }

◆ str() [24/30]

static QString VP1String::str ( long  n)
inlinestaticinherited

Definition at line 75 of file VP1String.h.

75 { return QString::number(n); }

◆ str() [25/30]

static QString VP1String::str ( qlonglong  n)
inlinestaticinherited

Definition at line 79 of file VP1String.h.

79 { return QString::number(n); }

◆ str() [26/30]

static QString VP1String::str ( qulonglong  n)
inlinestaticinherited

Definition at line 80 of file VP1String.h.

80 { return QString::number(n); }

◆ str() [27/30]

static QString VP1String::str ( short int  n)
inlinestaticinherited

Definition at line 73 of file VP1String.h.

73 { return QString::number(n); }

◆ str() [28/30]

static QString VP1String::str ( uint  n)
inlinestaticinherited

Definition at line 78 of file VP1String.h.

78 { return QString::number(n); }

◆ str() [29/30]

static QString VP1String::str ( ulong  n)
inlinestaticinherited

Definition at line 76 of file VP1String.h.

76 { return QString::number(n); }

◆ str() [30/30]

static QString VP1String::str ( unsigned short int  n)
inlinestaticinherited

Definition at line 74 of file VP1String.h.

74 { return QString::number(n); }

◆ stream()

QDataStream * VP1Deserialise::stream ( )
private

Definition at line 148 of file VP1Deserialise.cxx.

149 {
150  return m_d->state;
151 }

◆ systemBase()

IVP1System* VP1HelperClassBase::systemBase ( ) const
inlineinherited

Definition at line 50 of file VP1HelperClassBase.h.

50 { return m_system; }

◆ verbose()

static bool VP1HelperClassBase::verbose ( )
inlinestaticinherited

Definition at line 32 of file VP1HelperClassBase.h.

32 { return s_vp1verbose; } // Returns true if env var VP1_VERBOSE_OUTPUT=1

◆ version()

qint32 VP1Deserialise::version ( ) const

Definition at line 142 of file VP1Deserialise.cxx.

143 {
144  return m_d->version;
145 }

◆ warnUndeletedInstances()

void VP1HelperClassBase::warnUndeletedInstances ( )
staticinherited

Definition at line 183 of file VP1HelperClassBase.cxx.

184 {
185  if (vp1helperclassbase_instanceMap.empty())
186  return;
187  std::cout << "WARNING: Detected "<<vp1helperclassbase_instanceMap.size()<<" undeleted helper class instances:"<<std::endl;
188 
189  std::map<VP1HelperClassBase*,QString>::iterator it,itE(vp1helperclassbase_instanceMap.end());
190  for (it = vp1helperclassbase_instanceMap.begin();it!=itE;++it) {
191  std::cout << " ==> "<<it->first<<": "<<it->first->m_helpername.toStdString()
192  << (it->second.isEmpty()?QString(""):" (in system "+it->second+")").toStdString()<<std::endl;
193  }
194 }

◆ warnUnrestored()

void VP1Deserialise::warnUnrestored ( QObject *  object)

Definition at line 695 of file VP1Deserialise.cxx.

696 {
697  //NB: Same code as in VP1Serialise::warnUnsaved
698 
699  if (!m_d->checkedUnused)
700  m_d->checkedUnused = true;
701 
702  if (!object)
703  return;
704 
705  if (object->isWidgetType()&&m_d->ignoredWidgets.contains(static_cast<QWidget*>(object)))
706  return;
707 
708  if (object->isWidgetType()&&!object->objectName().startsWith("qt_")) {
709  QWidget * wid = static_cast<QWidget*>(object);
710  if (!m_d->handledWidgets.contains(wid)&&m_d->expectsPersistification(wid)) {
711  QString s("WARNING Unrestored widget of type: "+QString(wid->metaObject()->className())+" and object name = "+wid->objectName());
712  if (VP1Msg::verbose()){
713  message(s);
714  }
715  if(VP1Msg::debug()){
716  messageDebug(s);
717  }
718  }
719  }
720  //Call recursively on all "children":
721  for (QObject* o : object->children())
722  warnUnrestored(static_cast<QWidget*>(o));
723 }

◆ widgetHandled()

void VP1Deserialise::widgetHandled ( QWidget *  w)

Definition at line 657 of file VP1Deserialise.cxx.

658 {
659  m_d->handle(w);
660 }

Member Data Documentation

◆ m_d

Imp* VP1Deserialise::m_d
private

Definition at line 127 of file VP1Deserialise.h.

◆ m_helpername

QString VP1HelperClassBase::m_helpername
privateinherited

Definition at line 67 of file VP1HelperClassBase.h.

◆ m_system

IVP1System* VP1HelperClassBase::m_system
privateinherited

Definition at line 68 of file VP1HelperClassBase.h.

◆ s_vp1verbose

const bool VP1HelperClassBase::s_vp1verbose = VP1QtUtils::environmentVariableIsOn("VP1_VERBOSE_OUTPUT")
staticprivateinherited

Definition at line 69 of file VP1HelperClassBase.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
VP1CollStates
QMap< QByteArray, QByteArray > VP1CollStates
Definition: VP1Collection.h:27
VP1Deserialise::Imp::ignoredWidgets
QSet< QWidget * > ignoredWidgets
Definition: VP1Deserialise.cxx:55
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
WriteCellNoiseToCool.rb
rb
Definition: WriteCellNoiseToCool.py:229
hist_file_dump.d
d
Definition: hist_file_dump.py:142
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
VP1Deserialise::Imp::unblock
void unblock()
Definition: VP1Deserialise.cxx:65
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
VP1HelperClassBase::m_helpername
QString m_helpername
Definition: VP1HelperClassBase.h:67
VP1Deserialise::Imp::checkedUnused
bool checkedUnused
Definition: VP1Deserialise.cxx:51
VP1HelperClassBase::messageVerbose
void messageVerbose(const QString &) const
Definition: VP1HelperClassBase.cxx:78
VP1ColorSelectButton::setColor
void setColor(const QColor &)
Definition: VP1ColorSelectButton.cxx:95
VP1HelperClassBase::s_vp1verbose
static const bool s_vp1verbose
Definition: VP1HelperClassBase.h:69
VP1HelperClassBase::verbose
static bool verbose()
Definition: VP1HelperClassBase.h:32
skel.it
it
Definition: skel.GENtoEVGEN.py:407
python.SystemOfUnits.second
float second
Definition: SystemOfUnits.py:135
VP1Msg::debug
static bool debug()
Definition: VP1Msg.h:32
VP1Deserialise::Imp::byteArray
QByteArray byteArray
Definition: VP1Deserialise.cxx:48
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:157
VP1HelperClassBase::m_system
IVP1System * m_system
Definition: VP1HelperClassBase.h:68
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
VP1Deserialise::Imp::version
qint32 version
Definition: VP1Deserialise.cxx:52
VP1Deserialise::restoreDouble
double restoreDouble()
Definition: VP1Deserialise.cxx:428
x
#define x
VP1String::str
static QString str(const QString &s)
Definition: VP1String.h:49
VP1HelperClassBase::messageDebug
void messageDebug(const QString &) const
Definition: VP1HelperClassBase.cxx:65
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
XMLtoHeader.count
count
Definition: XMLtoHeader.py:84
VP1QtInventorUtils::deserialiseSoMaterial
static bool deserialiseSoMaterial(QByteArray &, SoMaterial *&)
Definition: VP1QtInventorUtils.cxx:1180
TruthTest.itE
itE
Definition: TruthTest.py:25
VP1Deserialise::Imp::buffer
QBuffer * buffer
Definition: VP1Deserialise.cxx:49
VP1Deserialise::atEnd
bool atEnd() const
Definition: VP1Deserialise.cxx:136
VP1Deserialise::Imp::state
QDataStream * state
Definition: VP1Deserialise.cxx:50
VP1Deserialise::version
qint32 version() const
Definition: VP1Deserialise.cxx:142
Execution.tb
tb
Definition: Execution.py:15
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:11
VP1Deserialise::Imp::handle
void handle(const QWidget *w)
Definition: VP1Deserialise.cxx:72
VP1Deserialise::restoreBool
bool restoreBool()
Definition: VP1Deserialise.cxx:418
VP1Msg::prefix_msg
static const char * prefix_msg()
Definition: VP1Msg.h:56
VP1CollectionWidget::addStateInfo
void addStateInfo(const VP1CollStates &, bool overwritesExisting=true)
Definition: VP1CollectionWidget.cxx:289
lumiFormat.i
int i
Definition: lumiFormat.py:85
VP1Deserialise::stream
QDataStream * stream()
Definition: VP1Deserialise.cxx:148
z
#define z
beamspotman.n
n
Definition: beamspotman.py:727
IVP1System::name
const QString & name() const
Definition: IVP1System.cxx:50
hist_file_dump.f
f
Definition: hist_file_dump.py:140
VP1Deserialise::Imp::handledWidgets
QSet< const QWidget * > handledWidgets
Definition: VP1Deserialise.cxx:54
VP1ColorSelectButton::color
QColor color() const
Definition: VP1ColorSelectButton.cxx:108
VP1Deserialise::Imp::block
void block(QWidget *w)
Definition: VP1Deserialise.cxx:58
VP1Deserialise::Imp::numberOfInstantiations
static unsigned numberOfInstantiations
Definition: VP1Deserialise.cxx:83
VP1QtInventorUtils::sbcol2qcol
static QColor sbcol2qcol(const SbColor &)
Definition: VP1QtInventorUtils.cxx:1134
keylayer_zslicemap.sb
sb
Definition: keylayer_zslicemap.py:192
VP1Deserialise::restore
T restore()
Definition: VP1Deserialise.h:137
VP1Deserialise::restoreInt
qint32 restoreInt()
Definition: VP1Deserialise.cxx:439
VP1Deserialise::restoreColor
QColor restoreColor()
Definition: VP1Deserialise.cxx:190
python.selection.number
number
Definition: selection.py:20
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:76
VP1Msg::prefix_debug
static const char * prefix_debug()
Definition: VP1Msg.h:57
VP1Deserialise::warnUnrestored
void warnUnrestored(QObject *)
Definition: VP1Deserialise.cxx:695
python.PyAthena.v
v
Definition: PyAthena.py:154
VP1Msg::prefix_verbose
static const char * prefix_verbose()
Definition: VP1Msg.h:59
y
#define y
TRT_PAI_physicsConstants::mb
const double mb
1mb to cm2
Definition: TRT_PAI_physicsConstants.h:17
VP1Deserialise::m_d
Imp * m_d
Definition: VP1Deserialise.h:126
unit
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
Definition: AmgMatrixBasePlugin.h:21
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:147
VP1HelperClassBase::message
void message(const QString &) const
Definition: VP1HelperClassBase.cxx:49
VP1Deserialise::Imp::expectsPersistification
bool expectsPersistification(QWidget *w)
Definition: VP1Deserialise.cxx:663
pickleTool.object
object
Definition: pickleTool.py:29
str
Definition: BTagTrackIpAccessor.cxx:11
VP1Msg::verbose
static bool verbose()
Definition: VP1Msg.h:31
VP1HelperClassBase::VP1HelperClassBase
VP1HelperClassBase(IVP1System *sys=0, QString helpername="")
Definition: VP1HelperClassBase.cxx:28
VP1Deserialise::ignoreWidget
void ignoreWidget(QWidget *)
Definition: VP1Deserialise.cxx:647
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:198
VP1Deserialise::restoreByteArray
QByteArray restoreByteArray()
Definition: VP1Deserialise.cxx:233
python.compressB64.c
def c
Definition: compressB64.py:93
IVP1System::message
void message(const QString &) const
Definition: IVP1System.cxx:336
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
VP1Deserialise::restoreString
QString restoreString()
Definition: VP1Deserialise.cxx:408
python.SystemOfUnits.m
float m
Definition: SystemOfUnits.py:106