Line data Source code
1 : #include "dbe/SchemaCustomAttributeModel.hpp"
2 :
3 : using namespace dunedaq::oks;
4 :
5 0 : dbse::CustomAttributeModel::CustomAttributeModel ( OksClass * ClassInfo,
6 : QStringList Headers,
7 0 : bool Derived )
8 : : CustomModelInterface ( Headers ),
9 0 : SchemaClass ( ClassInfo ),
10 0 : SchemaDerived ( Derived )
11 : {
12 0 : setupModel();
13 0 : }
14 :
15 0 : void dbse::CustomAttributeModel::setupModel()
16 : {
17 0 : Data.clear();
18 0 : const std::list<OksAttribute *> * AttributeList;
19 :
20 0 : if ( SchemaDerived )
21 : {
22 0 : AttributeList = SchemaClass->all_attributes();
23 : }
24 : else
25 : {
26 0 : AttributeList = SchemaClass->direct_attributes();
27 : }
28 :
29 0 : if ( AttributeList )
30 : {
31 0 : for ( OksAttribute * Attribute : *AttributeList )
32 : {
33 0 : QStringList Row;
34 0 : Row.append ( QString::fromStdString ( Attribute->get_name() ) );
35 0 : Row.append ( QString::fromStdString ( Attribute->get_type() ) );
36 0 : Data.append ( Row );
37 0 : }
38 : }
39 0 : }
40 :
41 0 : dbse::CustomAttributeModel::~CustomAttributeModel() = default;
|