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_class->get_name() + "::" + m_method->get_name();
78 setWindowTitle (QString::fromStdString(title));
79
80 if ( UsedNew ) {
81 std::string name = m_class->get_name() + m_method->get_name();
82 setObjectName ( QString::fromStdString(name) );
83 }
84 else {
85 FillInfo();
86 }
87}

◆ ParseToCreate()

void dbse::SchemaMethodImplementationEditor::ParseToCreate ( )

Definition at line 133 of file SchemaMethodImplementationEditor.cpp.

134{
135 if ( ui->MethodImplementationLanguage->text().isEmpty()
136 && ui->MethodImplementationLanguage->text().isEmpty()
137 && ui->MethodImplementationDescription->toPlainText().isEmpty() ) {
138 // Close empty dialogue box
139 close();
140 return;
141 }
142
143 if ( ui->MethodImplementationLanguage->text().isEmpty() )
144 {
145 QMessageBox::warning (
146 0, "Schema editor",
147 QString ( "Please Provide a Language for the method implementation !" ) );
148 return;
149 }
150
151 if ( ui->MethodImplementationPrototype->text().isEmpty() )
152 {
153 QMessageBox::warning (
154 0, "Schema editor",
155 QString ( "Please Provide a prototype for the method implementation !" ) );
156 return;
157 }
158
159 std::string MethodLanguage = ui->MethodImplementationLanguage->text().toStdString();
160 std::string MethodPrototype = ui->MethodImplementationPrototype->text().toStdString();
161 std::string MethodDescription = ui->MethodImplementationDescription->toPlainText()
162 .toStdString();
163
165 m_method,
166 MethodLanguage,
167 MethodPrototype,
168 MethodDescription );
169 emit RebuildModel();
170 close();
171}
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 89 of file SchemaMethodImplementationEditor.cpp.

90{
91 bool changed = false;
92 std::string MethodLanguage = ui->MethodImplementationLanguage->text().toStdString();
93 std::string MethodPrototype = ui->MethodImplementationPrototype->text().toStdString();
94
95 std::string MethodDescription = ui->MethodImplementationDescription->toPlainText()
96 .toStdString();
97
98 if ( MethodLanguage != m_implementation->get_language() )
99 {
101 m_method,
103 MethodLanguage );
104 changed = true;
105 }
106
107 if ( MethodPrototype != m_implementation->get_prototype() )
108 {
110 m_method,
112 MethodPrototype );
113 changed = true;
114 }
115
116 if ( MethodDescription != m_implementation->get_body() )
117 {
119 m_method,
121 MethodDescription );
122 changed = true;
123 }
124
125 if ( changed )
126 {
127 emit RebuildModel();
128 }
129
130 close();
131}
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: