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

#include <SchemaKernelWrapper.hpp>

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

Signals

void ClassCreated (QString ClassName)
void ClassRemoved (QString ClassName)
void ClassUpdated (QString ClassName)
void RebuildAttributeModel ()
void active_updated ()

Public Member Functions

dunedaq::oks::OksKernelGetKernel ()
void SetActiveSchema (const std::string &ActiveSchema)
void GetClassList (std::vector< dunedaq::oks::OksClass * > &ClassList) const
void GetClassListString (QStringList &ClassListString) const
void GetSchemaFiles (std::vector< std::string > &SchemaFiles)
void GetSchemaFiles (std::vector< dunedaq::oks::OksFile * > &SchemaFiles)
std::vector< dunedaq::oks::OksClass * > get_schema_classes (std::string &filename)
void GetIncludedList (const std::string &FileName, std::set< std::string > &IncludedFiles)
void get_direct_includes (const std::string &FileName, std::set< std::string > &IncludedFiles)
void get_all_includes (const std::string &FileName, std::set< std::string > &IncludedFiles)
bool IsFileWritable (const std::string &FileName) const
bool is_file_modified (const std::string &FileName) const
bool IsActive () const
dunedaq::oks::OksClassFindClass (std::string ClassName) const
dunedaq::oks::OksFileLoadSchema (const std::string &SchemaName) const
void SaveAllSchema () const
void SaveSchema (const std::string &file) const
std::vector< std::string > get_modified_schema_files () const
std::string ModifiedSchemaFiles () const
std::string SaveModifiedSchema () const
std::string GetActiveSchema () const
void AddInclude (std::string schemaFile, std::string IncludeFile) const
void RemoveInclude (std::string schemaFile, std::string IncludeFile) const
void CloseAllSchema () const
void CreateNewSchema (const std::string &SchemaName) const
bool AnyClassReferenceThis (dunedaq::oks::OksClass *SchemaClass)
QString GetCardinalityStringRelationship (dunedaq::oks::OksRelationship *SchemaRelationship) const
void SetInheritanceMode (bool Mode)
 Editor Functions.
bool GetInheritanceMode () const
QUndoStack * GetUndoStack ()
 Stack Functions.
void PushSetAbstractClassCommand (dunedaq::oks::OksClass *Class, bool Value)
void PushSetDescriptionClassCommand (dunedaq::oks::OksClass *Class, std::string Description)
void PushAddSuperClassCommand (dunedaq::oks::OksClass *Class, std::string SuperClass)
void PushRemoveSuperClassCommand (dunedaq::oks::OksClass *Class, std::string SuperClass)
void PushCreateClassCommand (std::string ClassName, std::string ClassDescription, bool Abstract)
void PushRemoveClassCommand (dunedaq::oks::OksClass *Class, std::string ClassName, std::string ClassDescription, bool Abstract)
void PushSetNameRelationshipCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, std::string Name)
 Relationship commands.
void PushSetClassTypeRelationshipCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, std::string ClassType)
void PushSetDescriptionRelationshipCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, std::string Description)
void PushSetLowCcRelationshipCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, dunedaq::oks::OksRelationship::CardinalityConstraint NewCardinality)
void PushSetHighCcRelationshipCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, dunedaq::oks::OksRelationship::CardinalityConstraint NewCardinality)
void PushSetIsCompositeRelationshipCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, bool Value)
void PushSetIsDependentRelationshipCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, bool Value)
void PushSetIsExclusiveRelationshipCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, bool Value)
void PushAddRelationship (dunedaq::oks::OksClass *Class, std::string Name, std::string Description, std::string Type, bool Composite, bool Exclusive, bool Dependent, dunedaq::oks::OksRelationship::CardinalityConstraint LowCc, dunedaq::oks::OksRelationship::CardinalityConstraint HighCc)
void PushRemoveRelationship (dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, std::string Name, std::string Description, std::string Type, bool Composite, bool Exclusive, bool Dependent, dunedaq::oks::OksRelationship::CardinalityConstraint LowCc, dunedaq::oks::OksRelationship::CardinalityConstraint HighCc)
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)
void PushAddMethodImplementationComand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string Language, std::string Prototype, std::string Body)
void PushRemoveMethodImplementationComand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string Language, std::string Prototype, std::string Body)
void PushSetNameMethodCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string name)
 Method commands.
void PushSetDescriptionMethodCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string description)
void PushAddMethodCommand (dunedaq::oks::OksClass *Class, std::string name, std::string description)
void PushRemoveMethodCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string name, std::string description)
void PushSetAttributeNameCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, std::string NewName)
 Attribute commands.
void PushSetAttributeDescriptionCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, std::string NewDescription)
void PushSetAttributeTypeCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, std::string NewType)
void PushSetAttributeRangeCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, std::string NewRange)
void PushSetAttributeFormatCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, dunedaq::oks::OksAttribute::Format NewFormat)
void PushSetAttributeMultiCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, bool NewIsMulti)
void PushSetAttributeIsNullCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, bool NewIsNull)
void PushSetAttributeInitialValuesCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, std::string NewValues)
void PushAddAttributeCommand (dunedaq::oks::OksClass *Class, std::string name, std::string type, bool is_mv, std::string range, std::string init_values, std::string description, bool is_null, dunedaq::oks::OksAttribute::Format format=dunedaq::oks::OksAttribute::Format::Dec)
void PushRemoveAttributeCommand (dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, std::string name, std::string type, bool is_mv, std::string range, std::string init_values, std::string description, bool is_null, dunedaq::oks::OksAttribute::Format format=dunedaq::oks::OksAttribute::Format::Dec)

Static Public Member Functions

static KernelWrapperGetInstance ()

Private Member Functions

 KernelWrapper (QObject *parent=nullptr)

Private Attributes

dunedaq::oks::OksKernelKernel
QUndoStack * CommandStack
bool InheritanceMode

Friends

class SchemaMainWindow
class SchemaClassEditor
class SchemaAttributeEditor
class SchemaMethodEditor
class SchemaRelationshipEditor

Detailed Description

Definition at line 26 of file SchemaKernelWrapper.hpp.

Constructor & Destructor Documentation

◆ KernelWrapper()

dbse::KernelWrapper::KernelWrapper ( QObject * parent = nullptr)
private

Definition at line 869 of file SchemaKernelWrapper.cpp.

870 : QObject ( parent ),
871 Kernel ( new OksKernel() ),
872 CommandStack ( new QUndoStack() ),
873 InheritanceMode ( false )
874{
875}
dunedaq::oks::OksKernel * Kernel

Member Function Documentation

◆ active_updated

void dbse::KernelWrapper::active_updated ( )
signal

◆ AddInclude()

void dbse::KernelWrapper::AddInclude ( std::string schemaFile,
std::string IncludeFile ) const

Definition at line 82 of file SchemaKernelWrapper.cpp.

83{
84 auto ParentSchema = Kernel->find_schema_file( schemaFile );
85 if ( ParentSchema != nullptr) {
86 ParentSchema->add_include_file( IncludeFile );
87 Kernel->load_schema( IncludeFile, ParentSchema );
88 }
89}

◆ AnyClassReferenceThis()

bool dbse::KernelWrapper::AnyClassReferenceThis ( dunedaq::oks::OksClass * SchemaClass)

Definition at line 247 of file SchemaKernelWrapper.cpp.

248{
249 std::vector<OksClass *> ClassList;
250 GetClassList ( ClassList );
251
252 for ( OksClass * ClassInfo : ClassList )
253 {
254 const std::list<OksRelationship *> * RelationshipList = ClassInfo->direct_relationships();
255
256 if ( RelationshipList != nullptr )
257 {
258 for ( OksRelationship * RelationshipInfo : *RelationshipList )
259 {
260 if ( RelationshipInfo->get_class_type()->get_name() == SchemaClass->get_name() )
261 {
262 return true;
263 }
264 }
265 }
266 }
267
268 return false;
269}
void GetClassList(std::vector< dunedaq::oks::OksClass * > &ClassList) const
const std::string & get_name() const noexcept
Definition class.hpp:368

◆ ClassCreated

void dbse::KernelWrapper::ClassCreated ( QString ClassName)
signal

◆ ClassRemoved

void dbse::KernelWrapper::ClassRemoved ( QString ClassName)
signal

◆ ClassUpdated

void dbse::KernelWrapper::ClassUpdated ( QString ClassName)
signal

◆ CloseAllSchema()

void dbse::KernelWrapper::CloseAllSchema ( ) const

Definition at line 237 of file SchemaKernelWrapper.cpp.

238{
239 Kernel->close_all_schema();
240}

◆ CreateNewSchema()

void dbse::KernelWrapper::CreateNewSchema ( const std::string & SchemaName) const

Definition at line 242 of file SchemaKernelWrapper.cpp.

243{
244 Kernel->new_schema ( SchemaName );
245}

◆ FindClass()

OksClass * dbse::KernelWrapper::FindClass ( std::string ClassName) const

Definition at line 181 of file SchemaKernelWrapper.cpp.

182{
183 return Kernel->find_class ( ClassName );
184}

◆ get_all_includes()

void dbse::KernelWrapper::get_all_includes ( const std::string & FileName,
std::set< std::string > & IncludedFiles )

Definition at line 136 of file SchemaKernelWrapper.cpp.

138{
139 auto parentschema = Kernel->find_schema_file( filename );
140 if ( parentschema != nullptr) {
141 std::set<OksFile*> includes;
142 parentschema->get_all_include_files(Kernel, includes);
143 for (auto file : includes) {
144 included_files.insert(file->get_full_file_name());
145 }
146 }
147}

◆ get_direct_includes()

void dbse::KernelWrapper::get_direct_includes ( const std::string & FileName,
std::set< std::string > & IncludedFiles )

Definition at line 149 of file SchemaKernelWrapper.cpp.

151{
152 auto parentschema = Kernel->find_schema_file( filename );
153 if ( parentschema != nullptr) {
154 for (auto file : parentschema->get_include_files()) {
155 included_files.insert(file);
156 }
157 }
158}

◆ get_modified_schema_files()

std::vector< std::string > dbse::KernelWrapper::get_modified_schema_files ( ) const

Definition at line 207 of file SchemaKernelWrapper.cpp.

208{
209 std::vector<std::string> modified;
210 for (auto [name, file] : Kernel->schema_files()) {
211 if (file->is_updated()) {
212 modified.push_back(file->get_full_file_name());
213 }
214 }
215 return modified;
216}

◆ get_schema_classes()

std::vector< OksClass * > dbse::KernelWrapper::get_schema_classes ( std::string & filename)

Definition at line 117 of file SchemaKernelWrapper.cpp.

118{
119 auto file = Kernel->find_schema_file ( filename );
120 std::vector<OksClass*> list;
121 auto klist = Kernel->create_list_of_schema_classes(file);
122 if (klist != nullptr) {
123 for (auto cls: *klist) {
124 list.push_back(cls/*->get_name()*/);
125 }
126 delete klist;
127 }
128 return list;
129}

◆ GetActiveSchema()

std::string dbse::KernelWrapper::GetActiveSchema ( ) const

Definition at line 65 of file SchemaKernelWrapper.cpp.

66{
67 auto file = Kernel->get_active_schema();
68 if ( file) {
69 return file->get_full_file_name();
70 }
71 else {
72 return "";
73 }
74}

◆ GetCardinalityStringRelationship()

QString dbse::KernelWrapper::GetCardinalityStringRelationship ( dunedaq::oks::OksRelationship * SchemaRelationship) const

Definition at line 271 of file SchemaKernelWrapper.cpp.

273{
274 QString RelationshipLowCc (
276 QString RelationshipHighCc (
278
279 if ( RelationshipLowCc == "zero" )
280 {
281 RelationshipLowCc = "0";
282 }
283 else if ( RelationshipLowCc == "one" )
284 {
285 RelationshipLowCc = "1";
286 }
287 else if ( RelationshipLowCc == "many" )
288 {
289 RelationshipLowCc = "n";
290 }
291
292 if ( RelationshipHighCc == "zero" )
293 {
294 RelationshipHighCc = "0";
295 }
296 else if ( RelationshipHighCc == "one" )
297 {
298 RelationshipHighCc = "1";
299 }
300 else if ( RelationshipHighCc == "many" )
301 {
302 RelationshipHighCc = "n";
303 }
304
305 return QString ( RelationshipLowCc + ':' + RelationshipHighCc );
306}
CardinalityConstraint get_high_cardinality_constraint() const noexcept
Get relationship high cardinality constraint.
static const char * card2str(CardinalityConstraint) noexcept
CardinalityConstraint get_low_cardinality_constraint() const noexcept
Get relationship low cardinality constraint.

◆ GetClassList()

void dbse::KernelWrapper::GetClassList ( std::vector< dunedaq::oks::OksClass * > & ClassList) const

Definition at line 40 of file SchemaKernelWrapper.cpp.

41{
42 for ( OksClass::Map::const_iterator i = Kernel->classes().begin();
43 i != Kernel->classes().end(); ++i )
44 {
45 ClassList.push_back ( i->second );
46 }
47}

◆ GetClassListString()

void dbse::KernelWrapper::GetClassListString ( QStringList & ClassListString) const

Definition at line 49 of file SchemaKernelWrapper.cpp.

50{
51 std::vector<OksClass *> ClassList;
52
53 for ( OksClass::Map::const_iterator i = Kernel->classes().begin();
54 i != Kernel->classes().end(); ++i )
55 {
56 ClassList.push_back ( i->second );
57 }
58
59 for ( OksClass * ClassInfo : ClassList )
60 {
61 ClassListString.append ( QString::fromStdString ( ClassInfo->get_name() ) );
62 }
63}

◆ GetIncludedList()

void dbse::KernelWrapper::GetIncludedList ( const std::string & FileName,
std::set< std::string > & IncludedFiles )

Definition at line 131 of file SchemaKernelWrapper.cpp.

133{
134 Kernel->get_includes ( filename, included_files );
135}

◆ GetInheritanceMode()

bool dbse::KernelWrapper::GetInheritanceMode ( ) const

Definition at line 319 of file SchemaKernelWrapper.cpp.

320{
321 return InheritanceMode;
322}

◆ GetInstance()

dbse::KernelWrapper & dbse::KernelWrapper::GetInstance ( )
static

Definition at line 18 of file SchemaKernelWrapper.cpp.

19{
20 static KernelWrapper KernelManager;
21 return KernelManager;
22}
KernelWrapper(QObject *parent=nullptr)

◆ GetKernel()

OksKernel * dbse::KernelWrapper::GetKernel ( )

Definition at line 24 of file SchemaKernelWrapper.cpp.

25{
26 return Kernel;
27}

◆ GetSchemaFiles() [1/2]

void dbse::KernelWrapper::GetSchemaFiles ( std::vector< dunedaq::oks::OksFile * > & SchemaFiles)

Definition at line 108 of file SchemaKernelWrapper.cpp.

109{
110 for (auto [name, file]: Kernel->schema_files())
111 {
112 SchemaFiles.push_back ( file );
113 }
114}

◆ GetSchemaFiles() [2/2]

void dbse::KernelWrapper::GetSchemaFiles ( std::vector< std::string > & SchemaFiles)

Definition at line 99 of file SchemaKernelWrapper.cpp.

100{
101 for ( OksFile::Map::const_iterator i = Kernel->schema_files().begin();
102 i != Kernel->schema_files().end(); ++i )
103 {
104 SchemaFiles.push_back ( * ( i->first ) );
105 }
106}

◆ GetUndoStack()

QUndoStack * dbse::KernelWrapper::GetUndoStack ( )

Stack Functions.

Definition at line 324 of file SchemaKernelWrapper.cpp.

325{
326 return CommandStack;
327}

◆ is_file_modified()

bool dbse::KernelWrapper::is_file_modified ( const std::string & FileName) const

Definition at line 172 of file SchemaKernelWrapper.cpp.

173{
174 OksFile* file = Kernel->find_schema_file ( FileName );
175 if (file != nullptr) {
176 return file->is_updated();
177 }
178 return false;
179}

◆ IsActive()

bool dbse::KernelWrapper::IsActive ( ) const

Definition at line 308 of file SchemaKernelWrapper.cpp.

309{
310 OksFile * ActiveSchemaFile = Kernel->get_active_schema();
311 return ( ActiveSchemaFile != nullptr );
312}

◆ IsFileWritable()

bool dbse::KernelWrapper::IsFileWritable ( const std::string & FileName) const

Definition at line 160 of file SchemaKernelWrapper.cpp.

161{
162 OksFile * File = Kernel->find_schema_file ( FileName );
163
164 if ( File )
165 {
166 return ( !File->is_read_only() );
167 }
168
169 return false;
170}
bool is_read_only() const
Return read-only status of OKS file.
Definition file.hpp:637

◆ LoadSchema()

OksFile * dbse::KernelWrapper::LoadSchema ( const std::string & SchemaName) const

Definition at line 186 of file SchemaKernelWrapper.cpp.

187{
188 return Kernel->load_schema ( SchemaName );
189}

◆ ModifiedSchemaFiles()

std::string dbse::KernelWrapper::ModifiedSchemaFiles ( ) const

Definition at line 196 of file SchemaKernelWrapper.cpp.

197{
198 std::string modified{""};
199 for (auto [name, file] : Kernel->schema_files()) {
200 if (file->is_updated()) {
201 modified += file->get_full_file_name() + "\n\n";
202 }
203 }
204 return modified;
205}

◆ PushAddAttributeCommand()

void dbse::KernelWrapper::PushAddAttributeCommand ( dunedaq::oks::OksClass * Class,
std::string name,
std::string type,
bool is_mv,
std::string range,
std::string init_values,
std::string description,
bool is_null,
dunedaq::oks::OksAttribute::Format format = dunedaq::oks::OksAttribute::Format::Dec )

Definition at line 830 of file SchemaKernelWrapper.cpp.

835{
836 try
837 {
838 CommandStack->push (
839 new AddAttributeCommand ( Class, name, type, is_mv, range, init_values, description,
840 is_null, format ) );
841 }
842 catch ( oks::exception & Ex )
843 {
844 QMessageBox::warning ( 0, "Schema editor",
845 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
846 }
847}
DAC value out of range
Message.
Definition DACNode.hpp:32

◆ PushAddMethodCommand()

void dbse::KernelWrapper::PushAddMethodCommand ( dunedaq::oks::OksClass * Class,
std::string name,
std::string description )

Definition at line 682 of file SchemaKernelWrapper.cpp.

684{
685 try
686 {
687 CommandStack->push ( new AddMethodCommand ( Class, name, description ) );
688 }
689 catch ( oks::exception & Ex )
690 {
691 QMessageBox::warning ( 0, "Schema editor",
692 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
693 }
694}

◆ PushAddMethodImplementationComand()

void dbse::KernelWrapper::PushAddMethodImplementationComand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksMethod * Method,
std::string Language,
std::string Prototype,
std::string Body )

Definition at line 620 of file SchemaKernelWrapper.cpp.

624{
625 try
626 {
627 CommandStack->push ( new AddMethodImplementationComand ( Class, Method, Language, Prototype,
628 Body ) );
629 }
630 catch ( oks::exception & Ex )
631 {
632 QMessageBox::warning ( 0, "Schema editor",
633 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
634 }
635}

◆ PushAddRelationship()

void dbse::KernelWrapper::PushAddRelationship ( dunedaq::oks::OksClass * Class,
std::string Name,
std::string Description,
std::string Type,
bool Composite,
bool Exclusive,
bool Dependent,
dunedaq::oks::OksRelationship::CardinalityConstraint LowCc,
dunedaq::oks::OksRelationship::CardinalityConstraint HighCc )

Definition at line 534 of file SchemaKernelWrapper.cpp.

539{
540 try
541 {
542 CommandStack->push (
543 new AddRelationship ( Class, Name, Description, Type, Composite, Exclusive, Dependent,
544 LowCc, HighCc ) );
545 }
546 catch ( oks::exception & Ex )
547 {
548 QMessageBox::warning ( 0, "Schema editor",
549 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
550 }
551}

◆ PushAddSuperClassCommand()

void dbse::KernelWrapper::PushAddSuperClassCommand ( dunedaq::oks::OksClass * Class,
std::string SuperClass )

Definition at line 356 of file SchemaKernelWrapper.cpp.

358{
359 try
360 {
361 CommandStack->push ( new AddSuperClassCommand ( Class, SuperClass ) );
362 }
363 catch ( oks::exception & Ex )
364 {
365 QMessageBox::warning ( 0, "Schema editor",
366 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
367 }
368}

◆ PushCreateClassCommand()

void dbse::KernelWrapper::PushCreateClassCommand ( std::string ClassName,
std::string ClassDescription,
bool Abstract )

Definition at line 384 of file SchemaKernelWrapper.cpp.

387{
388 try
389 {
390 CommandStack->push ( new CreateClassCommand ( ClassName, ClassDescription, Abstract ) );
391 }
392 catch ( ... )
393 {
394 QMessageBox::warning ( 0, "Schema editor", QString ( "Error" ) );
395 }
396}

◆ PushRemoveAttributeCommand()

void dbse::KernelWrapper::PushRemoveAttributeCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksAttribute * Attribute,
std::string name,
std::string type,
bool is_mv,
std::string range,
std::string init_values,
std::string description,
bool is_null,
dunedaq::oks::OksAttribute::Format format = dunedaq::oks::OksAttribute::Format::Dec )

Definition at line 849 of file SchemaKernelWrapper.cpp.

855{
856 try
857 {
858 CommandStack->push (
859 new RemoveAttributeCommand ( Class, Attribute, name, type, is_mv, range, init_values,
860 description, is_null, format ) );
861 }
862 catch ( oks::exception & Ex )
863 {
864 QMessageBox::warning ( 0, "Schema editor",
865 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
866 }
867}

◆ PushRemoveClassCommand()

void dbse::KernelWrapper::PushRemoveClassCommand ( dunedaq::oks::OksClass * Class,
std::string ClassName,
std::string ClassDescription,
bool Abstract )

Definition at line 398 of file SchemaKernelWrapper.cpp.

400{
401 try
402 {
403 CommandStack->push ( new RemoveClassCommand ( Class, ClassName, ClassDescription,
404 Abstract ) );
405 }
406 catch ( oks::exception & Ex )
407 {
408 QMessageBox::warning ( 0, "Schema editor",
409 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
410 }
411}

◆ PushRemoveMethodCommand()

void dbse::KernelWrapper::PushRemoveMethodCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksMethod * Method,
std::string name,
std::string description )

Definition at line 696 of file SchemaKernelWrapper.cpp.

698{
699 try
700 {
701 CommandStack->push ( new RemoveMethodCommand ( Class, Method, name, description ) );
702 }
703 catch ( oks::exception & Ex )
704 {
705 QMessageBox::warning ( 0, "Schema editor",
706 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
707 }
708}

◆ PushRemoveMethodImplementationComand()

void dbse::KernelWrapper::PushRemoveMethodImplementationComand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksMethod * Method,
std::string Language,
std::string Prototype,
std::string Body )

Definition at line 637 of file SchemaKernelWrapper.cpp.

642{
643 try
644 {
645 CommandStack->push ( new RemoveMethodImplementationComand ( Class, Method, Language, Prototype,
646 Body ) );
647 }
648 catch ( oks::exception & Ex )
649 {
650 QMessageBox::warning ( 0, "Schema editor",
651 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
652 }
653}

◆ PushRemoveRelationship()

void dbse::KernelWrapper::PushRemoveRelationship ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksRelationship * Relationship,
std::string Name,
std::string Description,
std::string Type,
bool Composite,
bool Exclusive,
bool Dependent,
dunedaq::oks::OksRelationship::CardinalityConstraint LowCc,
dunedaq::oks::OksRelationship::CardinalityConstraint HighCc )

Definition at line 553 of file SchemaKernelWrapper.cpp.

560{
561 try
562 {
563 CommandStack->push (
564 new RemoveRelationship ( Class, Relationship, Name, Description, Type, Composite,
565 Exclusive, Dependent, LowCc, HighCc ) );
566 }
567 catch ( oks::exception & Ex )
568 {
569 QMessageBox::warning ( 0, "Schema editor",
570 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
571 }
572}

◆ PushRemoveSuperClassCommand()

void dbse::KernelWrapper::PushRemoveSuperClassCommand ( dunedaq::oks::OksClass * Class,
std::string SuperClass )

Definition at line 370 of file SchemaKernelWrapper.cpp.

372{
373 try
374 {
375 CommandStack->push ( new RemoveSuperClassCommand ( Class, SuperClass ) );
376 }
377 catch ( oks::exception & Ex )
378 {
379 QMessageBox::warning ( 0, "Schema editor",
380 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
381 }
382}

◆ PushSetAbstractClassCommand()

void dbse::KernelWrapper::PushSetAbstractClassCommand ( dunedaq::oks::OksClass * Class,
bool Value )

Commands Functions Class commands

Definition at line 329 of file SchemaKernelWrapper.cpp.

330{
331 try
332 {
333 CommandStack->push ( new SetAbstractClassCommand ( Class, Value ) );
334 }
335 catch ( oks::exception & Ex )
336 {
337 QMessageBox::warning ( 0, "Schema editor",
338 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
339 }
340}

◆ PushSetAttributeDescriptionCommand()

void dbse::KernelWrapper::PushSetAttributeDescriptionCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksAttribute * Attribute,
std::string NewDescription )

Definition at line 725 of file SchemaKernelWrapper.cpp.

728{
729 try
730 {
731 CommandStack->push ( new SetAttributeDescriptionCommand ( Class, Attribute, NewDescription ) );
732 }
733 catch ( oks::exception & Ex )
734 {
735 QMessageBox::warning ( 0, "Schema editor",
736 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
737 }
738}

◆ PushSetAttributeFormatCommand()

void dbse::KernelWrapper::PushSetAttributeFormatCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksAttribute * Attribute,
dunedaq::oks::OksAttribute::Format NewFormat )

Definition at line 770 of file SchemaKernelWrapper.cpp.

773{
774 try
775 {
776 CommandStack->push ( new SetAttributeFormatCommand ( Class, Attribute, NewFormat ) );
777 }
778 catch ( oks::exception & Ex )
779 {
780 QMessageBox::warning ( 0, "Schema editor",
781 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
782 }
783}

◆ PushSetAttributeInitialValuesCommand()

void dbse::KernelWrapper::PushSetAttributeInitialValuesCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksAttribute * Attribute,
std::string NewValues )

Definition at line 815 of file SchemaKernelWrapper.cpp.

818{
819 try
820 {
821 CommandStack->push ( new SetAttributeInitialValuesCommand ( Class, Attribute, NewValues ) );
822 }
823 catch ( oks::exception & Ex )
824 {
825 QMessageBox::warning ( 0, "Schema editor",
826 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
827 }
828}

◆ PushSetAttributeIsNullCommand()

void dbse::KernelWrapper::PushSetAttributeIsNullCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksAttribute * Attribute,
bool NewIsNull )

Definition at line 800 of file SchemaKernelWrapper.cpp.

803{
804 try
805 {
806 CommandStack->push ( new SetAttributeIsNullCommand ( Class, Attribute, NewIsNull ) );
807 }
808 catch ( oks::exception & Ex )
809 {
810 QMessageBox::warning ( 0, "Schema editor",
811 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
812 }
813}

◆ PushSetAttributeMultiCommand()

void dbse::KernelWrapper::PushSetAttributeMultiCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksAttribute * Attribute,
bool NewIsMulti )

Definition at line 785 of file SchemaKernelWrapper.cpp.

788{
789 try
790 {
791 CommandStack->push ( new SetAttributeMultiCommand ( Class, Attribute, NewIsMulti ) );
792 }
793 catch ( oks::exception & Ex )
794 {
795 QMessageBox::warning ( 0, "Schema editor",
796 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
797 }
798}

◆ PushSetAttributeNameCommand()

void dbse::KernelWrapper::PushSetAttributeNameCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksAttribute * Attribute,
std::string NewName )

Attribute commands.

Definition at line 710 of file SchemaKernelWrapper.cpp.

713{
714 try
715 {
716 CommandStack->push ( new SetAttributeNameCommand ( Class, Attribute, NewName ) );
717 }
718 catch ( oks::exception & Ex )
719 {
720 QMessageBox::warning ( 0, "Schema editor",
721 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
722 }
723}

◆ PushSetAttributeRangeCommand()

void dbse::KernelWrapper::PushSetAttributeRangeCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksAttribute * Attribute,
std::string NewRange )

Definition at line 755 of file SchemaKernelWrapper.cpp.

758{
759 try
760 {
761 CommandStack->push ( new SetAttributeRangeCommand ( Class, Attribute, NewRange ) );
762 }
763 catch ( oks::exception & Ex )
764 {
765 QMessageBox::warning ( 0, "Schema editor",
766 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
767 }
768}

◆ PushSetAttributeTypeCommand()

void dbse::KernelWrapper::PushSetAttributeTypeCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksAttribute * Attribute,
std::string NewType )

Definition at line 740 of file SchemaKernelWrapper.cpp.

743{
744 try
745 {
746 CommandStack->push ( new SetAttributeTypeCommand ( Class, Attribute, NewType ) );
747 }
748 catch ( oks::exception & Ex )
749 {
750 QMessageBox::warning ( 0, "Schema editor",
751 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
752 }
753}

◆ PushSetClassTypeRelationshipCommand()

void dbse::KernelWrapper::PushSetClassTypeRelationshipCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksRelationship * Relationship,
std::string ClassType )

Definition at line 428 of file SchemaKernelWrapper.cpp.

431{
432 try
433 {
434 CommandStack->push ( new SetClassTypeRelationshipCommand ( Class, Relationship, ClassType ) );
435 }
436 catch ( oks::exception & Ex )
437 {
438 QMessageBox::warning ( 0, "Schema editor",
439 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
440 }
441}

◆ PushSetDescriptionClassCommand()

void dbse::KernelWrapper::PushSetDescriptionClassCommand ( dunedaq::oks::OksClass * Class,
std::string Description )

Definition at line 342 of file SchemaKernelWrapper.cpp.

344{
345 try
346 {
347 CommandStack->push ( new SetDescriptionClassCommand ( Class, Description ) );
348 }
349 catch ( oks::exception & Ex )
350 {
351 QMessageBox::warning ( 0, "Schema editor",
352 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
353 }
354}

◆ PushSetDescriptionMethodCommand()

void dbse::KernelWrapper::PushSetDescriptionMethodCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksMethod * Method,
std::string description )

Definition at line 668 of file SchemaKernelWrapper.cpp.

670{
671 try
672 {
673 CommandStack->push ( new SetDescriptionMethodCommand ( Class, Method, description ) );
674 }
675 catch ( oks::exception & Ex )
676 {
677 QMessageBox::warning ( 0, "Schema editor",
678 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
679 }
680}

◆ PushSetDescriptionRelationshipCommand()

void dbse::KernelWrapper::PushSetDescriptionRelationshipCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksRelationship * Relationship,
std::string Description )

Definition at line 443 of file SchemaKernelWrapper.cpp.

447{
448 try
449 {
450 CommandStack->push ( new SetDescriptionRelationshipCommand ( Class, Relationship, Description ) );
451 }
452 catch ( oks::exception & Ex )
453 {
454 QMessageBox::warning ( 0, "Schema editor",
455 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
456 }
457}

◆ PushSetHighCcRelationshipCommand()

void dbse::KernelWrapper::PushSetHighCcRelationshipCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksRelationship * Relationship,
dunedaq::oks::OksRelationship::CardinalityConstraint NewCardinality )

Definition at line 473 of file SchemaKernelWrapper.cpp.

475{
476 try
477 {
478 CommandStack->push ( new SetHighCcRelationshipCommand ( Class, Relationship, NewCardinality ) );
479 }
480 catch ( oks::exception & Ex )
481 {
482 QMessageBox::warning ( 0, "Schema editor",
483 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
484 }
485}

◆ PushSetIsCompositeRelationshipCommand()

void dbse::KernelWrapper::PushSetIsCompositeRelationshipCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksRelationship * Relationship,
bool Value )

Definition at line 487 of file SchemaKernelWrapper.cpp.

490{
491 try
492 {
493 CommandStack->push ( new SetIsCompositeRelationshipCommand ( Class, Relationship, Value ) );
494 }
495 catch ( oks::exception & Ex )
496 {
497 QMessageBox::warning ( 0, "Schema editor",
498 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
499 }
500}

◆ PushSetIsDependentRelationshipCommand()

void dbse::KernelWrapper::PushSetIsDependentRelationshipCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksRelationship * Relationship,
bool Value )

Definition at line 502 of file SchemaKernelWrapper.cpp.

506{
507 try
508 {
509 CommandStack->push ( new SetIsDependentRelationshipCommand ( Class, Relationship, Value ) );
510 }
511 catch ( oks::exception & Ex )
512 {
513 QMessageBox::warning ( 0, "Schema editor",
514 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
515 }
516}

◆ PushSetIsExclusiveRelationshipCommand()

void dbse::KernelWrapper::PushSetIsExclusiveRelationshipCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksRelationship * Relationship,
bool Value )

Definition at line 518 of file SchemaKernelWrapper.cpp.

522{
523 try
524 {
525 CommandStack->push ( new SetIsExclusiveRelationshipCommand ( Class, Relationship, Value ) );
526 }
527 catch ( oks::exception & Ex )
528 {
529 QMessageBox::warning ( 0, "Schema editor",
530 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
531 }
532}

◆ PushSetLowCcRelationshipCommand()

void dbse::KernelWrapper::PushSetLowCcRelationshipCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksRelationship * Relationship,
dunedaq::oks::OksRelationship::CardinalityConstraint NewCardinality )

Definition at line 459 of file SchemaKernelWrapper.cpp.

461{
462 try
463 {
464 CommandStack->push ( new SetLowCcRelationshipCommand ( Class, Relationship, NewCardinality ) );
465 }
466 catch ( oks::exception & Ex )
467 {
468 QMessageBox::warning ( 0, "Schema editor",
469 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
470 }
471}

◆ PushSetMethodImplementationBody()

void dbse::KernelWrapper::PushSetMethodImplementationBody ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksMethod * Method,
dunedaq::oks::OksMethodImplementation * Implementation,
std::string Body )

Definition at line 604 of file SchemaKernelWrapper.cpp.

608{
609 try
610 {
611 CommandStack->push ( new SetMethodImplementationBody ( Class, Method, Implementation, Body ) );
612 }
613 catch ( oks::exception & Ex )
614 {
615 QMessageBox::warning ( 0, "Schema editor",
616 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
617 }
618}

◆ PushSetMethodImplementationLanguage()

void dbse::KernelWrapper::PushSetMethodImplementationLanguage ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksMethod * Method,
dunedaq::oks::OksMethodImplementation * Implementation,
std::string Language )

Method implementation commands.

Definition at line 574 of file SchemaKernelWrapper.cpp.

578{
579 try
580 {
581 CommandStack->push ( new SetMethodImplementationLanguage ( Class, Method, Implementation, Language ) );
582 }
583 catch ( oks::exception & Ex )
584 {
585 QMessageBox::warning ( 0, "Schema editor",
586 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
587 }
588}

◆ PushSetMethodImplementationPrototype()

void dbse::KernelWrapper::PushSetMethodImplementationPrototype ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksMethod * Method,
dunedaq::oks::OksMethodImplementation * Implementation,
std::string Prototype )

Definition at line 590 of file SchemaKernelWrapper.cpp.

592{
593 try
594 {
595 CommandStack->push ( new SetMethodImplementationPrototype ( Class, Method, Implementation, Prototype ) );
596 }
597 catch ( oks::exception & Ex )
598 {
599 QMessageBox::warning ( 0, "Schema editor",
600 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
601 }
602}

◆ PushSetNameMethodCommand()

void dbse::KernelWrapper::PushSetNameMethodCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksMethod * Method,
std::string name )

Method commands.

Definition at line 655 of file SchemaKernelWrapper.cpp.

656{
657 try
658 {
659 CommandStack->push ( new SetNameMethodCommand ( Class, Method, name ) );
660 }
661 catch ( oks::exception & Ex )
662 {
663 QMessageBox::warning ( 0, "Schema editor",
664 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
665 }
666}

◆ PushSetNameRelationshipCommand()

void dbse::KernelWrapper::PushSetNameRelationshipCommand ( dunedaq::oks::OksClass * Class,
dunedaq::oks::OksRelationship * Relationship,
std::string Name )

Relationship commands.

Definition at line 413 of file SchemaKernelWrapper.cpp.

416{
417 try
418 {
419 CommandStack->push ( new SetNameRelationshipCommand ( Class, Relationship, Name ) );
420 }
421 catch ( oks::exception & Ex )
422 {
423 QMessageBox::warning ( 0, "Schema editor",
424 QString ( "Error : \n\n %1" ).arg ( Ex.what() ) );
425 }
426}

◆ RebuildAttributeModel

void dbse::KernelWrapper::RebuildAttributeModel ( )
signal

◆ RemoveInclude()

void dbse::KernelWrapper::RemoveInclude ( std::string schemaFile,
std::string IncludeFile ) const

Definition at line 91 of file SchemaKernelWrapper.cpp.

92{
93 auto ParentSchema = Kernel->find_schema_file( schemaFile );
94 if (ParentSchema != nullptr) {
95 ParentSchema->remove_include_file( IncludeFile );
96 }
97}

◆ SaveAllSchema()

void dbse::KernelWrapper::SaveAllSchema ( ) const

Definition at line 191 of file SchemaKernelWrapper.cpp.

192{
193 Kernel->save_all_schema();
194}

◆ SaveModifiedSchema()

std::string dbse::KernelWrapper::SaveModifiedSchema ( ) const

Definition at line 218 of file SchemaKernelWrapper.cpp.

219{
220 std::string saved{""};
221 for (auto [name, file] : Kernel->schema_files()) {
222 if (file->is_updated()) {
223 Kernel->save_schema(file);
224 saved += file->get_full_file_name() + "\n\n";
225 }
226 }
227 return saved;
228}

◆ SaveSchema()

void dbse::KernelWrapper::SaveSchema ( const std::string & file) const

Definition at line 230 of file SchemaKernelWrapper.cpp.

231{
232 OksFile * file = Kernel->find_schema_file ( schema_file );
233 Kernel->save_schema(file);
234}

◆ SetActiveSchema()

void dbse::KernelWrapper::SetActiveSchema ( const std::string & ActiveSchema)

Definition at line 29 of file SchemaKernelWrapper.cpp.

30{
31 OksFile * File = Kernel->find_schema_file ( ActiveSchema );
32
33 if ( File && IsFileWritable( ActiveSchema ))
34 {
35 Kernel->set_active_schema ( File );
36 emit active_updated();
37 }
38}
bool IsFileWritable(const std::string &FileName) const

◆ SetInheritanceMode()

void dbse::KernelWrapper::SetInheritanceMode ( bool Mode)

Editor Functions.

Definition at line 314 of file SchemaKernelWrapper.cpp.

315{
316 InheritanceMode = Mode;
317}

◆ SchemaAttributeEditor

friend class SchemaAttributeEditor
friend

Definition at line 30 of file SchemaKernelWrapper.hpp.

◆ SchemaClassEditor

friend class SchemaClassEditor
friend

Definition at line 29 of file SchemaKernelWrapper.hpp.

◆ SchemaMainWindow

friend class SchemaMainWindow
friend

Definition at line 28 of file SchemaKernelWrapper.hpp.

◆ SchemaMethodEditor

friend class SchemaMethodEditor
friend

Definition at line 31 of file SchemaKernelWrapper.hpp.

◆ SchemaRelationshipEditor

friend class SchemaRelationshipEditor
friend

Definition at line 32 of file SchemaKernelWrapper.hpp.

Member Data Documentation

◆ CommandStack

QUndoStack* dbse::KernelWrapper::CommandStack
private

Definition at line 149 of file SchemaKernelWrapper.hpp.

◆ InheritanceMode

bool dbse::KernelWrapper::InheritanceMode
private

Definition at line 150 of file SchemaKernelWrapper.hpp.

◆ Kernel

dunedaq::oks::OksKernel* dbse::KernelWrapper::Kernel
private

Definition at line 148 of file SchemaKernelWrapper.hpp.


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