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

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

◆ ~VP1Deserialise()

VP1Deserialise::~VP1Deserialise ( )
virtual

Definition at line 122 of file VP1Deserialise.cxx.

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

Member Function Documentation

◆ atEnd()

bool VP1Deserialise::atEnd ( ) const

Definition at line 137 of file VP1Deserialise.cxx.

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

◆ decrementNumberOfInstantiations()

void VP1Deserialise::decrementNumberOfInstantiations ( )
static

Definition at line 96 of file VP1Deserialise.cxx.

97 {
99 }

◆ disableUnrestoredChecks()

void VP1Deserialise::disableUnrestoredChecks ( )

Definition at line 690 of file VP1Deserialise.cxx.

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

◆ helperClassName()

QString VP1HelperClassBase::helperClassName ( ) const
inlineinherited

Definition at line 51 of file VP1HelperClassBase.h.

51 { return m_helpername; }

◆ ignoreBool()

void VP1Deserialise::ignoreBool ( )

Definition at line 588 of file VP1Deserialise.cxx.

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

◆ ignoreByteArray()

void VP1Deserialise::ignoreByteArray ( )

Definition at line 628 of file VP1Deserialise.cxx.

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

◆ ignoreColor()

void VP1Deserialise::ignoreColor ( )

◆ ignoreDouble()

void VP1Deserialise::ignoreDouble ( )

Definition at line 608 of file VP1Deserialise.cxx.

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

◆ ignoreInt()

void VP1Deserialise::ignoreInt ( )

Definition at line 598 of file VP1Deserialise.cxx.

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

◆ ignoreObsoletePhiSectionWidgetState()

void VP1Deserialise::ignoreObsoletePhiSectionWidgetState ( )

Definition at line 638 of file VP1Deserialise.cxx.

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

◆ ignoreString()

void VP1Deserialise::ignoreString ( )

Definition at line 618 of file VP1Deserialise.cxx.

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

◆ ignoreWidget()

void VP1Deserialise::ignoreWidget ( QWidget *  w)

Definition at line 648 of file VP1Deserialise.cxx.

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

◆ 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 (QString s : l)
139  message(addtostart+s);
140  } else {
141  for (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 (QString s : l)
95  message(s);
96  } else {
97  for (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 (QString s : l)
157  messageDebug(addtostart+s);
158  } else {
159  for (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 (QString s : l)
109  messageDebug(s);
110  } else {
111  for (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 (QString s : l)
175  messageVerbose(addtostart+s);
176  } else {
177  for (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 (QString s : l)
123  messageVerbose(s);
124  } else {
125  for (QString s : l)
126  messageVerbose(s+addtoend);
127  }
128 }

◆ numberOfInstantiations()

unsigned VP1Deserialise::numberOfInstantiations ( )
static

Definition at line 90 of file VP1Deserialise.cxx.

91 {
93 }

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

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

◆ restore() [3/18]

void VP1Deserialise::restore ( QCheckBox *  sb)

Definition at line 245 of file VP1Deserialise.cxx.

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

◆ restore() [4/18]

void VP1Deserialise::restore ( QComboBox *  sb)

Definition at line 288 of file VP1Deserialise.cxx.

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

◆ restore() [5/18]

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

Definition at line 323 of file VP1Deserialise.cxx.

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

◆ restore() [6/18]

void VP1Deserialise::restore ( QGroupBox *  gb)

Definition at line 271 of file VP1Deserialise.cxx.

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

◆ restore() [7/18]

void VP1Deserialise::restore ( QLineEdit *  le)

Definition at line 308 of file VP1Deserialise.cxx.

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

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

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

◆ restore() [9/18]

void VP1Deserialise::restore ( QSlider *  s)

Definition at line 355 of file VP1Deserialise.cxx.

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

◆ restore() [10/18]

void VP1Deserialise::restore ( QSpinBox *  sb)

Definition at line 339 of file VP1Deserialise.cxx.

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

◆ restore() [11/18]

void VP1Deserialise::restore ( QToolBox *  tb)

Definition at line 371 of file VP1Deserialise.cxx.

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

◆ restore() [12/18]

void VP1Deserialise::restore ( SoMaterial *  m)

Definition at line 155 of file VP1Deserialise.cxx.

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

◆ restore() [13/18]

void VP1Deserialise::restore ( VP1CollectionSettingsButtonBase w)

Definition at line 515 of file VP1Deserialise.cxx.

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

◆ restore() [14/18]

void VP1Deserialise::restore ( VP1CollectionWidget cw)

Definition at line 487 of file VP1Deserialise.cxx.

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

◆ restore() [15/18]

void VP1Deserialise::restore ( VP1ColorSelectButton cb)

Definition at line 204 of file VP1Deserialise.cxx.

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

◆ restore() [16/18]

void VP1Deserialise::restore ( VP1DrawOptionsWidget w)

Definition at line 571 of file VP1Deserialise.cxx.

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

◆ restore() [17/18]

void VP1Deserialise::restore ( VP1EtaPhiCutWidget w)

Definition at line 551 of file VP1Deserialise.cxx.

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

◆ restore() [18/18]

void VP1Deserialise::restore ( VP1MaterialButton mb)

Definition at line 167 of file VP1Deserialise.cxx.

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

◆ restoreBool()

bool VP1Deserialise::restoreBool ( )

Definition at line 419 of file VP1Deserialise.cxx.

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

◆ restoreByteArray()

QByteArray VP1Deserialise::restoreByteArray ( )

Definition at line 234 of file VP1Deserialise.cxx.

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

◆ restoreByTitle()

void VP1Deserialise::restoreByTitle ( QToolBox *  tb)

Definition at line 386 of file VP1Deserialise.cxx.

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

◆ restoreColor()

QColor VP1Deserialise::restoreColor ( )

Definition at line 191 of file VP1Deserialise.cxx.

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

◆ restoreDouble()

double VP1Deserialise::restoreDouble ( )

Definition at line 429 of file VP1Deserialise.cxx.

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

◆ restoreInt()

qint32 VP1Deserialise::restoreInt ( )

Definition at line 440 of file VP1Deserialise.cxx.

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

◆ restoreString()

QString VP1Deserialise::restoreString ( )

Definition at line 409 of file VP1Deserialise.cxx.

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

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

150 {
151  return m_d->state;
152 }

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

144 {
145  return m_d->version;
146 }

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

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

◆ widgetHandled()

void VP1Deserialise::widgetHandled ( QWidget *  w)

Definition at line 658 of file VP1Deserialise.cxx.

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

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
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
VP1Deserialise::Imp::ignoredWidgets
QSet< QWidget * > ignoredWidgets
Definition: VP1Deserialise.cxx:55
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
max
#define max(a, b)
Definition: cfImp.cxx:41
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:137
VP1Deserialise::Imp::unblock
void unblock()
Definition: VP1Deserialise.cxx:65
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:396
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:158
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:429
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:85
VP1QtInventorUtils::deserialiseSoMaterial
static bool deserialiseSoMaterial(QByteArray &, SoMaterial *&)
Definition: VP1QtInventorUtils.cxx:1188
TruthTest.itE
itE
Definition: TruthTest.py:25
VP1Deserialise::Imp::buffer
QBuffer * buffer
Definition: VP1Deserialise.cxx:49
VP1Deserialise::atEnd
bool atEnd() const
Definition: VP1Deserialise.cxx:137
VP1Deserialise::Imp::state
QDataStream * state
Definition: VP1Deserialise.cxx:50
VP1Deserialise::version
qint32 version() const
Definition: VP1Deserialise.cxx:143
Execution.tb
tb
Definition: Execution.py:15
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:12
VP1Deserialise::restoreBool
bool restoreBool()
Definition: VP1Deserialise.cxx:419
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:149
z
#define z
beamspotman.n
n
Definition: beamspotman.py:731
IVP1System::name
const QString & name() const
Definition: IVP1System.cxx:50
hist_file_dump.f
f
Definition: hist_file_dump.py:135
VP1ColorSelectButton::color
QColor color() const
Definition: VP1ColorSelectButton.cxx:108
VP1Deserialise::Imp::block
void block(QWidget *w)
Definition: VP1Deserialise.cxx:58
min
#define min(a, b)
Definition: cfImp.cxx:40
VP1Deserialise::Imp::numberOfInstantiations
static unsigned numberOfInstantiations
Definition: VP1Deserialise.cxx:84
VP1QtInventorUtils::sbcol2qcol
static QColor sbcol2qcol(const SbColor &)
Definition: VP1QtInventorUtils.cxx:1142
keylayer_zslicemap.sb
sb
Definition: keylayer_zslicemap.py:192
VP1Deserialise::restore
T restore()
Definition: VP1Deserialise.h:137
VP1Deserialise::restoreInt
qint32 restoreInt()
Definition: VP1Deserialise.cxx:440
VP1Deserialise::restoreColor
QColor restoreColor()
Definition: VP1Deserialise.cxx:191
python.selection.number
number
Definition: selection.py:20
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
VP1Msg::prefix_debug
static const char * prefix_debug()
Definition: VP1Msg.h:57
VP1Deserialise::warnUnrestored
void warnUnrestored(QObject *)
Definition: VP1Deserialise.cxx:696
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:15
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
VP1HelperClassBase::message
void message(const QString &) const
Definition: VP1HelperClassBase.cxx:49
VP1Deserialise::Imp::expectsPersistification
bool expectsPersistification(QWidget *w)
Definition: VP1Deserialise.cxx:664
pickleTool.object
object
Definition: pickleTool.py:30
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:648
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
VP1Deserialise::restoreByteArray
QByteArray restoreByteArray()
Definition: VP1Deserialise.cxx:234
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:409