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