ATLAS Offline Software
Loading...
Searching...
No Matches
VP1BanksSystem.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "ui_vp1bankscontroller.h"
10
11#include "GaudiKernel/IClassIDSvc.h"
12#include "GaudiKernel/ISvcLocator.h"
13
14//____________________________________________________________________
16public:
19 bool useDetStore();
21 Ui::VP1BanksSystemControllerForm ui{};
22
23 QString idToName(const CLID&) const;
24 SmartIF<IClassIDSvc> clidSvc;
25
26 QStringList lastEmitted_keys;
27 QStringList lastEmitted_types;
28 QStringList lastEmitted_ids;
29
30 void emitIfChanged(const QStringList& keys, const QStringList& types, const QStringList& ids) {
32 return;
36 theclass->messageVerbose("emitting entriesChanged(..) with "+str(keys.count())+" entries");
37 theclass->entriesChanged(keys,types,ids);
38 }
39
40};
41
42
43//____________________________________________________________________
45 : IVP1System("Banks",
46 "System for browsing the contents of StoreGate",
47 "Joe Boudreau <boudreau@pitt.edu> (original), Thomas.Kittelmann@cern.ch (VP1 implementation)"),
48 m_d(new Imp(this))
49{
50 m_d->ui.radioButton_store_event = 0;
51 m_d->ui.radioButton_store_detector = 0;
52 m_d->ui.pushButton_refresh = 0;
53}
54
55
56//____________________________________________________________________
58{
59 delete m_d; m_d=0;
60}
61
62//____________________________________________________________________
63QString VP1BanksSystem::Imp::idToName( const CLID& id ) const
64{
65 if (!clidSvc)
66 return "";
67 std::string n;
68 if (clidSvc->getTypeNameOfID(id, n).isFailure())
69 return "<unknown>";
70 return n.c_str();
71}
72
73//____________________________________________________________________
75{
76 return ui.radioButton_store_event && !ui.radioButton_store_event->isChecked();
77}
78
79
80//____________________________________________________________________
82{
83 QWidget * controller = new QWidget;
84 m_d->ui.setupUi(controller);
85 connect(m_d->ui.radioButton_store_event,SIGNAL(toggled(bool)),this,SLOT(refreshList()));
86 connect(m_d->ui.pushButton_refresh,SIGNAL(clicked()),this,SLOT(refreshList()));
87 registerController(controller);
88
89 ISvcLocator* svcLoc = serviceLocator();
90 if (!svcLoc) {
91 message("Error: Got NULL pointer to the service locator!");
92 return;
93 }
94
95 m_d->clidSvc = svcLoc->service( "ClassIDSvc" );
96 if(!m_d->clidSvc) {
97 message("Error: Could not retrieve ClassIDSvc!!");
98 return;
99 }
100
101
102}
103
104//____________________________________________________________________
106{
107 m_d->allowRefresh = true;
108 refreshList();
109}
110
111//____________________________________________________________________
113{
114 if (!m_d->allowRefresh)
115 return;
116 messageVerbose("Refreshing list for "+QString(m_d->useDetStore()?"detector":"event")+" store");
117
118 QStringList entry_key;
119 QStringList entry_type;
120 QStringList entry_id;
121
122 VP1SGContentsHelper sgcont(this,m_d->useDetStore());
123
124 int i(0);
125 for (CLID id : sgcont.getPossibleCLIDs()) {
126 QStringList keys = sgcont.getKeys(id);
127 if (!keys.isEmpty()) {
128 QString typeName = m_d->idToName(id);
129 QString idstr = QString::number(id);
130 for (const QString& key : keys) {
131 entry_key << key;
132 entry_type << typeName;
133 entry_id << idstr;
134 }
135 }
136 if (!i++%20)
137 updateGUI();
138 }
139 m_d->emitIfChanged(entry_key,entry_type,entry_id);
140}
141
142//____________________________________________________________________
144{
145 m_d->allowRefresh = false;
146 m_d->emitIfChanged(QStringList(),QStringList(),QStringList());
147}
148
149
150//____________________________________________________________________
152{
153 VP1Serialise serialise(0/*version*/,this);
154 serialise.save(IVP1System::saveState());//Info from base class
155
156 serialise.save(m_d->ui.radioButton_store_event,m_d->ui.radioButton_store_detector);
157
158 serialise.warnUnsaved(controllerWidget());
159 return serialise.result();
160
161}
162
163//____________________________________________________________________
165{
166 VP1Deserialise state(ba,this);
167 if (state.version()!=0) {
168 message("Warning: State data in .vp1 file is in wrong format - ignoring!");
169 return;
170 }
171 IVP1System::restoreFromState(state.restoreByteArray());
172
173 state.restore(m_d->ui.radioButton_store_event,m_d->ui.radioButton_store_detector);
174
175 state.warnUnrestored(controllerWidget());
176}
uint32_t CLID
The Class ID type.
static Double_t tc
static const std::vector< std::string > types
void messageVerbose(const QString &) const
virtual void restoreFromState(QByteArray)
State state() const
QWidget * controllerWidget()
void updateGUI()
IVP1System(const QString &name, const QString &information, const QString &contact_info)
void message(const QString &) const
void registerController(QWidget *)
ISvcLocator * serviceLocator() const
virtual QByteArray saveState()
The Athena Transient Store API.
QStringList lastEmitted_keys
QStringList lastEmitted_types
QStringList lastEmitted_ids
QString idToName(const CLID &) const
VP1BanksSystem * theclass
Ui::VP1BanksSystemControllerForm ui
void emitIfChanged(const QStringList &keys, const QStringList &types, const QStringList &ids)
SmartIF< IClassIDSvc > clidSvc
Imp(VP1BanksSystem *tc)
void refresh(StoreGateSvc *storegate)
virtual ~VP1BanksSystem()
void create(StoreGateSvc *detstore)
void restoreFromState(QByteArray)
QByteArray saveState()
QStringList getKeys() const
QList< CLID > getPossibleCLIDs() const