DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbse::SchemaMethodImplementationEditor Class Reference

#include <SchemaMethodImplementationEditor.hpp>

Inheritance diagram for dbse::SchemaMethodImplementationEditor:
[legend]
Collaboration diagram for dbse::SchemaMethodImplementationEditor:
[legend]

Signals

void RebuildModel ()
 

Public Member Functions

 ~SchemaMethodImplementationEditor ()
 
 SchemaMethodImplementationEditor (dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, dunedaq::oks::OksMethodImplementation *Implementation, QWidget *parent=nullptr)
 
 SchemaMethodImplementationEditor (dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, QWidget *parent=nullptr)
 
void SetController ()
 
void InitialSettings ()
 
void ParseToSave ()
 
void ParseToCreate ()
 

Protected Member Functions

void FillInfo ()
 

Private Slots

void ProxySlot ()
 
void ClassUpdated (QString ClassName)
 

Private Attributes

std::unique_ptr< dbse::Ui::SchemaMethodImplementationEditor > ui
 
dunedaq::oks::OksClassm_class
 
dunedaq::oks::OksMethodm_method
 
dunedaq::oks::OksMethodImplementationm_implementation
 
bool UsedNew
 

Detailed Description

Definition at line 17 of file SchemaMethodImplementationEditor.hpp.

Constructor & Destructor Documentation

◆ ~SchemaMethodImplementationEditor()

dbse::SchemaMethodImplementationEditor::~SchemaMethodImplementationEditor ( )
default

◆ SchemaMethodImplementationEditor() [1/2]

dbse::SchemaMethodImplementationEditor::SchemaMethodImplementationEditor ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksMethod * Method,
dunedaq::oks::OksMethodImplementation * Implementation,
QWidget * parent = nullptr )
explicit

Definition at line 11 of file SchemaMethodImplementationEditor.cpp.

13 : QWidget ( parent ),
14 ui ( new Ui::SchemaMethodImplementationEditor ),
15 m_class ( Class ),
16 m_method ( Method ),
17 m_implementation ( Implementation ),
18 UsedNew ( false )
19{
20 QWidget::setAttribute(Qt::WA_DeleteOnClose);
21 ui->setupUi ( this );
24}
std::unique_ptr< dbse::Ui::SchemaMethodImplementationEditor > ui
dunedaq::oks::OksMethodImplementation * m_implementation

◆ SchemaMethodImplementationEditor() [2/2]

dbse::SchemaMethodImplementationEditor::SchemaMethodImplementationEditor ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksMethod * Method,
QWidget * parent = nullptr )
explicit

Definition at line 26 of file SchemaMethodImplementationEditor.cpp.

30 : QWidget ( parent ),
31 ui ( new Ui::SchemaMethodImplementationEditor ),
32 m_class ( Class ),
33 m_method ( Method ),
34 m_implementation ( nullptr ),
35 UsedNew ( true )
36{
37 QWidget::setAttribute(Qt::WA_DeleteOnClose);
38 ui->setupUi ( this );
41}

Member Function Documentation

◆ ClassUpdated

void dbse::SchemaMethodImplementationEditor::ClassUpdated ( QString ClassName)
privateslot

Definition at line 50 of file SchemaMethodImplementationEditor.cpp.

51{
52 if(!UsedNew && class_name.toStdString() == m_class->get_name()) {
54 FillInfo();
55 } else {
56 QWidget::close();
57 }
58 }
59}
const std::string & get_name() const noexcept
Definition class.hpp:363
const std::string & get_language() const noexcept
Definition method.hpp:63
OksMethodImplementation * find_implementation(const std::string &language) const
Find method implementation.
Definition method.cpp:354

◆ FillInfo()

void dbse::SchemaMethodImplementationEditor::FillInfo ( )
protected

Definition at line 61 of file SchemaMethodImplementationEditor.cpp.

62{
63 ui->MethodImplementationLanguage->setText (
64 QString::fromStdString ( m_implementation->get_language() ) );
65 ui->MethodImplementationPrototype->setText (
66 QString::fromStdString ( m_implementation->get_prototype() ) );
67 ui->MethodImplementationDescription->setPlainText (
68 QString::fromStdString ( m_implementation->get_body() ) );
69
70 std::string name = m_class->get_name() + m_method->get_name()
72 setObjectName ( QString::fromStdString(name) );
73}
const std::string & get_body() const noexcept
Definition method.hpp:99
const std::string & get_prototype() const noexcept
Definition method.hpp:82
const std::string & get_name() const noexcept
Definition method.hpp:196

◆ InitialSettings()

void dbse::SchemaMethodImplementationEditor::InitialSettings ( )

Definition at line 75 of file SchemaMethodImplementationEditor.cpp.

76{
77 std::string title = "Method Implementation for " + m_method->get_name() ;
78 setWindowTitle (QString::fromStdString(title));
79 std::string name = m_method->get_name();
80 setObjectName ( QString::fromStdString(name) );
81
82 if ( !UsedNew ) {
83 FillInfo();
84 }
85}

◆ ParseToCreate()

void dbse::SchemaMethodImplementationEditor::ParseToCreate ( )

Definition at line 130 of file SchemaMethodImplementationEditor.cpp.

131{
132 if ( ui->MethodImplementationLanguage->text().isEmpty()
133 && ui->MethodImplementationLanguage->text().isEmpty()
134 && ui->MethodImplementationDescription->toPlainText().isEmpty() ) {
135 // Close empty dialogue box
136 close();
137 return;
138 }
139
140 if ( ui->MethodImplementationLanguage->text().isEmpty() )
141 {
142 QMessageBox::warning (
143 0, "Schema editor",
144 QString ( "Please Provide a Language for the method implementation !" ) );
145 return;
146 }
147
148 if ( ui->MethodImplementationPrototype->text().isEmpty() )
149 {
150 QMessageBox::warning (
151 0, "Schema editor",
152 QString ( "Please Provide a prototype for the method implementation !" ) );
153 return;
154 }
155
156 std::string MethodLanguage = ui->MethodImplementationLanguage->text().toStdString();
157 std::string MethodPrototype = ui->MethodImplementationPrototype->text().toStdString();
158 std::string MethodDescription = ui->MethodImplementationDescription->toPlainText()
159 .toStdString();
160
162 m_method,
163 MethodLanguage,
164 MethodPrototype,
165 MethodDescription );
166 emit RebuildModel();
167 close();
168}
static KernelWrapper & GetInstance()
void PushAddMethodImplementationComand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string Language, std::string Prototype, std::string Body)

◆ ParseToSave()

void dbse::SchemaMethodImplementationEditor::ParseToSave ( )

Definition at line 87 of file SchemaMethodImplementationEditor.cpp.

88{
89 bool changed = false;
90 std::string MethodLanguage = ui->MethodImplementationLanguage->text().toStdString();
91 std::string MethodPrototype = ui->MethodImplementationPrototype->text().toStdString();
92 std::string MethodDescription = ui->MethodImplementationDescription->toPlainText()
93 .toStdString();
94
95 if ( MethodLanguage != m_implementation->get_language() )
96 {
100 MethodLanguage );
101 changed = true;
102 }
103
104 if ( MethodPrototype != m_implementation->get_prototype() )
105 {
107 m_method,
109 MethodPrototype );
110 changed = true;
111 }
112
113 if ( MethodDescription != m_implementation->get_body() )
114 {
116 m_method,
118 MethodDescription );
119 changed = true;
120 }
121
122 if ( changed )
123 {
124 emit RebuildModel();
125 }
126
127 close();
128}
void PushSetMethodImplementationLanguage(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, dunedaq::oks::OksMethodImplementation *Implementation, std::string Language)
Method implementation commands.
void PushSetMethodImplementationPrototype(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, dunedaq::oks::OksMethodImplementation *Implementation, std::string Prototype)
void PushSetMethodImplementationBody(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, dunedaq::oks::OksMethodImplementation *Implementation, std::string Body)
Only Configuration DB opened by rdbconfig or oksconflibs plug in can be changed

◆ ProxySlot

void dbse::SchemaMethodImplementationEditor::ProxySlot ( )
privateslot

◆ RebuildModel

void dbse::SchemaMethodImplementationEditor::RebuildModel ( )
signal

◆ SetController()

void dbse::SchemaMethodImplementationEditor::SetController ( )

Definition at line 43 of file SchemaMethodImplementationEditor.cpp.

44{
45 connect ( ui->SaveButton, SIGNAL ( clicked() ), this, SLOT ( ProxySlot() ) );
46 connect ( &KernelWrapper::GetInstance(), SIGNAL ( ClassUpdated ( QString ) ), this,
47 SLOT ( ClassUpdated ( QString ) ) );
48}

Member Data Documentation

◆ m_class

dunedaq::oks::OksClass* dbse::SchemaMethodImplementationEditor::m_class
private

Definition at line 40 of file SchemaMethodImplementationEditor.hpp.

◆ m_implementation

dunedaq::oks::OksMethodImplementation* dbse::SchemaMethodImplementationEditor::m_implementation
private

Definition at line 42 of file SchemaMethodImplementationEditor.hpp.

◆ m_method

dunedaq::oks::OksMethod* dbse::SchemaMethodImplementationEditor::m_method
private

Definition at line 41 of file SchemaMethodImplementationEditor.hpp.

◆ ui

std::unique_ptr<dbse::Ui::SchemaMethodImplementationEditor> dbse::SchemaMethodImplementationEditor::ui
private

Definition at line 39 of file SchemaMethodImplementationEditor.hpp.

◆ UsedNew

bool dbse::SchemaMethodImplementationEditor::UsedNew
private

Definition at line 43 of file SchemaMethodImplementationEditor.hpp.


The documentation for this class was generated from the following files: