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 104 of file VP1Deserialise.cxx.

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

◆ ~VP1Deserialise()

VP1Deserialise::~VP1Deserialise ( )
virtual

Definition at line 124 of file VP1Deserialise.cxx.

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

Member Function Documentation

◆ atEnd()

bool VP1Deserialise::atEnd ( ) const

Definition at line 139 of file VP1Deserialise.cxx.

140 {
141  return m_d->buffer->atEnd();
142 }

◆ decrementNumberOfInstantiations()

void VP1Deserialise::decrementNumberOfInstantiations ( )
static

Definition at line 98 of file VP1Deserialise.cxx.

99 {
101 }

◆ disableUnrestoredChecks()

void VP1Deserialise::disableUnrestoredChecks ( )

Definition at line 692 of file VP1Deserialise.cxx.

693 {
694  m_d->checkedUnused = true;
695 }

◆ 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 590 of file VP1Deserialise.cxx.

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

◆ ignoreByteArray()

void VP1Deserialise::ignoreByteArray ( )

Definition at line 630 of file VP1Deserialise.cxx.

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

◆ ignoreColor()

void VP1Deserialise::ignoreColor ( )

◆ ignoreDouble()

void VP1Deserialise::ignoreDouble ( )

Definition at line 610 of file VP1Deserialise.cxx.

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

◆ ignoreInt()

void VP1Deserialise::ignoreInt ( )

Definition at line 600 of file VP1Deserialise.cxx.

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

◆ ignoreObsoletePhiSectionWidgetState()

void VP1Deserialise::ignoreObsoletePhiSectionWidgetState ( )

Definition at line 640 of file VP1Deserialise.cxx.

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

◆ ignoreString()

void VP1Deserialise::ignoreString ( )

Definition at line 620 of file VP1Deserialise.cxx.

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

◆ ignoreWidget()

void VP1Deserialise::ignoreWidget ( QWidget *  w)

Definition at line 650 of file VP1Deserialise.cxx.

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

◆ 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 92 of file VP1Deserialise.cxx.

93 {
95 }

◆ 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 221 of file VP1Deserialise.cxx.

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

◆ restore() [3/18]

void VP1Deserialise::restore ( QCheckBox *  sb)

Definition at line 247 of file VP1Deserialise.cxx.

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

◆ restore() [4/18]

void VP1Deserialise::restore ( QComboBox *  sb)

Definition at line 290 of file VP1Deserialise.cxx.

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

◆ restore() [5/18]

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

Definition at line 325 of file VP1Deserialise.cxx.

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

◆ restore() [6/18]

void VP1Deserialise::restore ( QGroupBox *  gb)

Definition at line 273 of file VP1Deserialise.cxx.

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

◆ restore() [7/18]

void VP1Deserialise::restore ( QLineEdit *  le)

Definition at line 310 of file VP1Deserialise.cxx.

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

◆ 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 453 of file VP1Deserialise.cxx.

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

◆ restore() [9/18]

void VP1Deserialise::restore ( QSlider *  s)

Definition at line 357 of file VP1Deserialise.cxx.

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

◆ restore() [10/18]

void VP1Deserialise::restore ( QSpinBox *  sb)

Definition at line 341 of file VP1Deserialise.cxx.

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

◆ restore() [11/18]

void VP1Deserialise::restore ( QToolBox *  tb)

Definition at line 373 of file VP1Deserialise.cxx.

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

◆ restore() [12/18]

void VP1Deserialise::restore ( SoMaterial *  m)

Definition at line 157 of file VP1Deserialise.cxx.

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

◆ restore() [13/18]

void VP1Deserialise::restore ( VP1CollectionSettingsButtonBase w)

Definition at line 517 of file VP1Deserialise.cxx.

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

◆ restore() [14/18]

void VP1Deserialise::restore ( VP1CollectionWidget cw)

Definition at line 489 of file VP1Deserialise.cxx.

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

◆ restore() [15/18]

void VP1Deserialise::restore ( VP1ColorSelectButton cb)

Definition at line 206 of file VP1Deserialise.cxx.

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

◆ restore() [16/18]

void VP1Deserialise::restore ( VP1DrawOptionsWidget w)

Definition at line 573 of file VP1Deserialise.cxx.

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

◆ restore() [17/18]

void VP1Deserialise::restore ( VP1EtaPhiCutWidget w)

Definition at line 553 of file VP1Deserialise.cxx.

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

◆ restore() [18/18]

void VP1Deserialise::restore ( VP1MaterialButton mb)

Definition at line 169 of file VP1Deserialise.cxx.

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

◆ restoreBool()

bool VP1Deserialise::restoreBool ( )

Definition at line 421 of file VP1Deserialise.cxx.

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

◆ restoreByteArray()

QByteArray VP1Deserialise::restoreByteArray ( )

Definition at line 236 of file VP1Deserialise.cxx.

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

◆ restoreByTitle()

void VP1Deserialise::restoreByTitle ( QToolBox *  tb)

Definition at line 388 of file VP1Deserialise.cxx.

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

◆ restoreColor()

QColor VP1Deserialise::restoreColor ( )

Definition at line 193 of file VP1Deserialise.cxx.

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

◆ restoreDouble()

double VP1Deserialise::restoreDouble ( )

Definition at line 431 of file VP1Deserialise.cxx.

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

◆ restoreInt()

qint32 VP1Deserialise::restoreInt ( )

Definition at line 442 of file VP1Deserialise.cxx.

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

◆ restoreString()

QString VP1Deserialise::restoreString ( )

Definition at line 411 of file VP1Deserialise.cxx.

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

◆ 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 151 of file VP1Deserialise.cxx.

152 {
153  return m_d->state;
154 }

◆ 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 145 of file VP1Deserialise.cxx.

146 {
147  return m_d->version;
148 }

◆ 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 698 of file VP1Deserialise.cxx.

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

◆ widgetHandled()

void VP1Deserialise::widgetHandled ( QWidget *  w)

Definition at line 660 of file VP1Deserialise.cxx.

661 {
662  m_d->handle(w);
663 }

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:431
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
VP1Deserialise::Imp::handle
void handle(QWidget *w)
Definition: VP1Deserialise.cxx:72
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:139
VP1Deserialise::Imp::state
QDataStream * state
Definition: VP1Deserialise.cxx:50
VP1Deserialise::version
qint32 version() const
Definition: VP1Deserialise.cxx:145
Execution.tb
tb
Definition: Execution.py:15
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:11
VP1Deserialise::restoreBool
bool restoreBool()
Definition: VP1Deserialise.cxx:421
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:151
z
#define z
beamspotman.n
n
Definition: beamspotman.py:729
IVP1System::name
const QString & name() const
Definition: IVP1System.cxx:50
hist_file_dump.f
f
Definition: hist_file_dump.py:140
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:86
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:442
VP1Deserialise::restoreColor
QColor restoreColor()
Definition: VP1Deserialise.cxx:193
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:698
python.PyAthena.v
v
Definition: PyAthena.py:154
VP1Msg::prefix_verbose
static const char * prefix_verbose()
Definition: VP1Msg.h:59
y
#define y
VP1Deserialise::Imp::handledWidgets
QSet< QWidget * > handledWidgets
Definition: VP1Deserialise.cxx:54
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:666
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:650
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:198
VP1Deserialise::restoreByteArray
QByteArray restoreByteArray()
Definition: VP1Deserialise.cxx:236
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:411
python.SystemOfUnits.m
float m
Definition: SystemOfUnits.py:106