ATLAS Offline Software
VP1Collection.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 // //
8 // Header file for class VP1Collection //
9 // //
10 // Description: Base class for collection handles. Can be //
11 // displayed in VP1CollectionWidget's. //
12 // //
13 // Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
14 // Initial version: June 2008 //
15 // //
17 
18 #ifndef VP1COLLECTION_H
19 #define VP1COLLECTION_H
20 
22 
23 #include <QByteArray>
24 #include <QList>
25 #include <QMap>
26 #include <QString>
27 class QWidget;
28 
29 typedef QMap<QByteArray,QByteArray> VP1CollStates;//persistifiable id->state
30 
32 public:
33  VP1Collection( IVP1System * sys = 0, const QString& helperClassName="VP1Collection" );//sys!=0 for messages in gui
34  virtual ~VP1Collection();
35 
36  QByteArray persistifiableID() const;//Could essentially contain a SG key, or, when multiple
37  //types go in the same list, key+some integer giving the type
38  QString section() const;//If all collections have empty sections, the collection widget won't make section headers
39 
40  QString sectionToolTip() const;//Tooltip to go with the section (NB. provide same tooltip in all instances
41  // providing a given section. It is arbitrary which we use for the tooltip!)
42 
43  virtual QByteArray persistifiableState() const = 0;//Provide default implementation based on widget list + version
44  virtual void setState(const QByteArray&) = 0;//Provide default implementation based on widget list + version
45  virtual QList<QWidget*> widgetsForGuiRow() const;
46 
47 
48 protected:
49 
50  virtual QList<QWidget*> provideWidgetsForGuiRow() const = 0;//Should never return empty list.
51  virtual QByteArray providePersistifiableID() const = 0; //Will be called exactly once.
52  virtual QString provideSection() const = 0; //Will be called exactly once.
53  virtual QString provideSectionToolTip() const { return ""; }//Will be called exactly once.
54 
55 private:
56 
59  class Imp;
60  Imp * m_d;
61 
62 public:
63 
65  // Static convenience methods for handling states: //
67 
68  static VP1CollStates getStates(QList<VP1Collection*>);
69  static void applyStates(QList<VP1Collection*>, const VP1CollStates&);
70  static void updateStates(VP1CollStates& state, const VP1CollStates& newInfo);//Similar entries in newInfo will override those in state.
71  template <class T>
72  static QList<VP1Collection*> toBaseCollList( const QList<T*>& );
73 };
74 
76 // INLINES //
78 
79 template <class T>
80 QList<VP1Collection*> VP1Collection::toBaseCollList( const QList<T*>& in)
81 {
82  QList<VP1Collection*> l;
83  for (T * t : in)
84  l << static_cast<T*>(t);
85  return l;
86 }
87 
88 #endif
VP1CollStates
QMap< QByteArray, QByteArray > VP1CollStates
Definition: VP1Collection.h:27
VP1Collection::provideWidgetsForGuiRow
virtual QList< QWidget * > provideWidgetsForGuiRow() const =0
VP1Collection::VP1Collection
VP1Collection(const VP1Collection &)
VP1Collection::updateStates
static void updateStates(VP1CollStates &state, const VP1CollStates &newInfo)
Definition: VP1Collection.cxx:118
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
VP1Collection::getStates
static VP1CollStates getStates(QList< VP1Collection * >)
Definition: VP1Collection.cxx:92
VP1Collection::setState
virtual void setState(const QByteArray &)=0
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
VP1Collection::Imp
Definition: VP1Collection.cxx:19
IVP1System
Definition: IVP1System.h:36
VP1Collection::sectionToolTip
QString sectionToolTip() const
Definition: VP1Collection.cxx:82
VP1Collection::section
QString section() const
Definition: VP1Collection.cxx:72
VP1Collection::toBaseCollList
static QList< VP1Collection * > toBaseCollList(const QList< T * > &)
Definition: VP1Collection.h:80
VP1Collection::m_d
Imp * m_d
Definition: VP1Collection.h:59
VP1Collection::~VP1Collection
virtual ~VP1Collection()
Definition: VP1Collection.cxx:43
VP1Collection::persistifiableID
QByteArray persistifiableID() const
Definition: VP1Collection.cxx:49
VP1Collection::applyStates
static void applyStates(QList< VP1Collection * >, const VP1CollStates &)
Definition: VP1Collection.cxx:108
VP1Collection::VP1Collection
VP1Collection(IVP1System *sys=0, const QString &helperClassName="VP1Collection")
Definition: VP1Collection.cxx:37
VP1HelperClassBase
Definition: VP1HelperClassBase.h:28
VP1Collection
Definition: VP1Collection.h:31
VP1Collection::providePersistifiableID
virtual QByteArray providePersistifiableID() const =0
VP1Collection::widgetsForGuiRow
virtual QList< QWidget * > widgetsForGuiRow() const
Definition: VP1Collection.cxx:62
VP1HelperClassBase.h
VP1Collection::provideSection
virtual QString provideSection() const =0
VP1Collection::provideSectionToolTip
virtual QString provideSectionToolTip() const
Definition: VP1Collection.h:53
VP1Collection::persistifiableState
virtual QByteArray persistifiableState() const =0
VP1HelperClassBase::helperClassName
QString helperClassName() const
Definition: VP1HelperClassBase.h:51
VP1Collection::operator=
VP1Collection & operator=(const VP1Collection &)
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35