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 apps/SchemaEditor/SchemaCustomMethodModel.cpp).
5 :
6 : #include "dbe/SchemaCustomMethodModel.hpp"
7 :
8 : using namespace dunedaq::oks;
9 :
10 0 : dbse::CustomMethodModel::CustomMethodModel ( OksClass * ClassInfo, QStringList Headers,
11 0 : bool Derived )
12 : : CustomModelInterface ( Headers ),
13 0 : SchemaClass ( ClassInfo ),
14 0 : SchemaDerived ( Derived )
15 : {
16 0 : setupModel();
17 0 : }
18 :
19 0 : void dbse::CustomMethodModel::setupModel()
20 : {
21 0 : Data.clear();
22 0 : const std::list<OksMethod *> * MethodList;
23 0 : std::set<std::string> direct_methods;
24 0 : auto methods = SchemaClass->direct_methods();
25 0 : if (methods != nullptr) {
26 0 : for (auto method : *methods) {
27 0 : direct_methods.insert(method->get_name());
28 : }
29 : }
30 :
31 0 : if ( SchemaDerived )
32 : {
33 0 : MethodList = SchemaClass->all_methods();
34 : }
35 : else
36 : {
37 0 : MethodList = SchemaClass->direct_methods();
38 : }
39 :
40 0 : if ( MethodList != nullptr )
41 : {
42 0 : for ( OksMethod * Method : *MethodList )
43 : {
44 0 : QStringList row;
45 0 : auto name = Method->get_name();
46 0 : row.append ( QString::fromStdString ( name ) );
47 0 : if (direct_methods.contains(name)) {
48 0 : row.append("D");
49 : }
50 : else {
51 0 : row.append("I");
52 : }
53 0 : Data.append ( row );
54 0 : }
55 : }
56 0 : }
57 :
58 0 : dbse::CustomMethodModel::~CustomMethodModel() = default;
|