Line data Source code
1 : // DUNE DAQ modification notice:
2 : // This file has been modified from the original ATLAS dbe source for the DUNE DAQ project.
3 : // Fork baseline commit: dbe-02-12-17 (2022-05-12).
4 : // Renamed since fork: yes (from src/SchemaEditor/SchemaCustomMethodModel.cpp to
5 : // apps/SchemaEditor/SchemaCustomMethodModel.cpp).
6 :
7 : #include "dbe/SchemaCustomMethodModel.hpp"
8 :
9 : using namespace dunedaq::oks;
10 :
11 0 : dbse::CustomMethodModel::CustomMethodModel(OksClass* ClassInfo, QStringList Headers, bool Derived)
12 : : CustomModelInterface(Headers)
13 0 : , SchemaClass(ClassInfo)
14 0 : , SchemaDerived(Derived)
15 : {
16 0 : setupModel();
17 0 : }
18 :
19 : void
20 0 : dbse::CustomMethodModel::setupModel()
21 : {
22 0 : Data.clear();
23 0 : const std::list<OksMethod*>* MethodList;
24 0 : std::set<std::string> direct_methods;
25 0 : auto methods = SchemaClass->direct_methods();
26 0 : if (methods != nullptr) {
27 0 : for (auto method : *methods) {
28 0 : direct_methods.insert(method->get_name());
29 : }
30 : }
31 :
32 0 : if (SchemaDerived) {
33 0 : MethodList = SchemaClass->all_methods();
34 : } else {
35 0 : MethodList = SchemaClass->direct_methods();
36 : }
37 :
38 0 : if (MethodList != nullptr) {
39 0 : for (OksMethod* Method : *MethodList) {
40 0 : QStringList row;
41 0 : auto name = Method->get_name();
42 0 : row.append(QString::fromStdString(name));
43 0 : if (direct_methods.contains(name)) {
44 0 : row.append("D");
45 : } else {
46 0 : row.append("I");
47 : }
48 0 : Data.append(row);
49 0 : }
50 : }
51 0 : }
52 :
53 0 : dbse::CustomMethodModel::~CustomMethodModel() = default;
|