37 Kernel->set_active_schema(File);
45 for (OksClass::Map::const_iterator i =
Kernel->classes().begin(); i !=
Kernel->classes().end(); ++i) {
46 ClassList.push_back(i->second);
53 std::vector<OksClass*> ClassList;
55 for (OksClass::Map::const_iterator i =
Kernel->classes().begin(); i !=
Kernel->classes().end(); ++i) {
56 ClassList.push_back(i->second);
59 for (
OksClass* ClassInfo : ClassList) {
60 ClassListString.append(QString::fromStdString(ClassInfo->get_name()));
67 auto file =
Kernel->get_active_schema();
69 return file->get_full_file_name();
84 auto ParentSchema =
Kernel->find_schema_file(schemaFile);
85 if (ParentSchema !=
nullptr) {
86 ParentSchema->add_include_file(IncludeFile);
87 Kernel->load_schema(IncludeFile, ParentSchema);
94 auto ParentSchema =
Kernel->find_schema_file(schemaFile);
95 if (ParentSchema !=
nullptr) {
96 ParentSchema->remove_include_file(IncludeFile);
103 for (OksFile::Map::const_iterator i =
Kernel->schema_files().begin(); i !=
Kernel->schema_files().end(); ++i) {
104 SchemaFiles.push_back(*(i->first));
111 for (
auto [name, file] :
Kernel->schema_files()) {
112 SchemaFiles.push_back(file);
116std::vector<OksClass*>
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 );
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());
153 if (parentschema !=
nullptr) {
154 for (
auto file : parentschema->get_include_files()) {
155 included_files.insert(file);
176 if (file !=
nullptr) {
177 return file->is_updated();
185 return Kernel->find_class(ClassName);
191 return Kernel->load_schema(SchemaName);
197 Kernel->save_all_schema();
203 std::string modified{
"" };
204 for (
auto [name, file] :
Kernel->schema_files()) {
205 if (file->is_updated()) {
206 modified += file->get_full_file_name() +
"\n\n";
212std::vector<std::string>
215 std::vector<std::string> modified;
216 for (
auto [name, file] :
Kernel->schema_files()) {
217 if (file->is_updated()) {
218 modified.push_back(file->get_full_file_name());
227 std::string saved{
"" };
228 for (
auto [name, file] :
Kernel->schema_files()) {
229 if (file->is_updated()) {
230 Kernel->save_schema(file);
231 saved += file->get_full_file_name() +
"\n\n";
241 Kernel->save_schema(file);
247 Kernel->close_all_schema();
253 Kernel->new_schema(SchemaName);
259 std::vector<OksClass*> ClassList;
262 for (
OksClass* ClassInfo : ClassList) {
263 const std::list<OksRelationship*>* RelationshipList = ClassInfo->direct_relationships();
265 if (RelationshipList !=
nullptr) {
267 if (RelationshipInfo->get_class_type()->get_name() == SchemaClass->
get_name()) {
283 if (RelationshipLowCc ==
"zero") {
284 RelationshipLowCc =
"0";
285 }
else if (RelationshipLowCc ==
"one") {
286 RelationshipLowCc =
"1";
287 }
else if (RelationshipLowCc ==
"many") {
288 RelationshipLowCc =
"n";
291 if (RelationshipHighCc ==
"zero") {
292 RelationshipHighCc =
"0";
293 }
else if (RelationshipHighCc ==
"one") {
294 RelationshipHighCc =
"1";
295 }
else if (RelationshipHighCc ==
"many") {
296 RelationshipHighCc =
"n";
299 return QString(RelationshipLowCc +
':' + RelationshipHighCc);
306 return (ActiveSchemaFile !=
nullptr);
333 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
343 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
353 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
363 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
373 QMessageBox::warning(0,
"Schema editor", QString(
"Error"));
379 std::string ClassName,
380 std::string ClassDescription,
386 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
396 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
403 std::string ClassType)
408 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
415 std::string Description)
420 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
432 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
444 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
454 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
464 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
474 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
481 std::string Description,
491 new AddRelationship(Class, Name, Description, Type, Composite, Exclusive, Dependent, LowCc, HighCc));
493 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
501 std::string Description,
511 Class, Relationship, Name, Description, Type, Composite, Exclusive, Dependent, LowCc, HighCc));
513 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
521 std::string Language)
526 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
534 std::string Prototype)
539 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
552 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
559 std::string Language,
560 std::string Prototype,
566 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
573 std::string Language,
574 std::string Prototype,
580 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
590 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
600 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
610 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
618 std::string description)
623 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
633 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
640 std::string NewDescription)
645 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
655 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
665 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
677 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
687 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
697 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
704 std::string NewValues)
709 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
719 std::string init_values,
720 std::string description,
728 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
739 std::string init_values,
740 std::string description,
746 Class, Attribute, name, type, is_mv,
range, init_values, description, is_null, format));
748 QMessageBox::warning(0,
"Schema editor", QString(
"Error : \n\n %1").arg(Ex.
what()));
AddAttributeCommand(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)
AddMethodCommand(dunedaq::oks::OksClass *Class, std::string name, std::string description)
AddMethodImplementationComand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string Language, std::string Prototype, std::string Body)
AddRelationship(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)
AddSuperClassCommand(dunedaq::oks::OksClass *Class, std::string SuperClass)
CreateClassCommand(std::string ClassName, std::string ClassDescription, bool Abstract)
void PushSetIsCompositeRelationshipCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, bool Value)
void PushRemoveSuperClassCommand(dunedaq::oks::OksClass *Class, std::string SuperClass)
void PushSetAttributeDescriptionCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, std::string NewDescription)
void PushSetAttributeIsNullCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, bool NewIsNull)
std::string GetActiveSchema() const
void GetClassListString(QStringList &ClassListString) const
void GetIncludedList(const std::string &FileName, std::set< std::string > &IncludedFiles)
std::string SaveModifiedSchema() const
static KernelWrapper & GetInstance()
void PushSetAttributeRangeCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, std::string NewRange)
void GetClassList(std::vector< dunedaq::oks::OksClass * > &ClassList) const
QUndoStack * GetUndoStack()
Stack Functions.
dunedaq::oks::OksFile * LoadSchema(const std::string &SchemaName) const
dunedaq::oks::OksKernel * GetKernel()
QString GetCardinalityStringRelationship(dunedaq::oks::OksRelationship *SchemaRelationship) const
void PushSetMethodImplementationLanguage(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, dunedaq::oks::OksMethodImplementation *Implementation, std::string Language)
Method implementation commands.
void PushSetHighCcRelationshipCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, dunedaq::oks::OksRelationship::CardinalityConstraint NewCardinality)
void PushSetAttributeFormatCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, dunedaq::oks::OksAttribute::Format NewFormat)
void SetActiveSchema(const std::string &ActiveSchema)
void PushSetAbstractClassCommand(dunedaq::oks::OksClass *Class, bool Value)
dunedaq::oks::OksClass * FindClass(std::string ClassName) const
void PushSetIsDependentRelationshipCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, bool Value)
void RemoveInclude(std::string schemaFile, std::string IncludeFile) const
void SaveSchema(const std::string &file) const
void PushAddSuperClassCommand(dunedaq::oks::OksClass *Class, std::string SuperClass)
void PushSetMethodImplementationPrototype(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, dunedaq::oks::OksMethodImplementation *Implementation, std::string Prototype)
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)
void CloseAllSchema() const
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 PushAddMethodImplementationComand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string Language, std::string Prototype, std::string Body)
std::vector< std::string > get_modified_schema_files() const
bool GetInheritanceMode() const
void PushSetIsExclusiveRelationshipCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, bool Value)
void PushSetDescriptionClassCommand(dunedaq::oks::OksClass *Class, std::string Description)
std::string ModifiedSchemaFiles() const
void PushSetAttributeMultiCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, bool NewIsMulti)
bool AnyClassReferenceThis(dunedaq::oks::OksClass *SchemaClass)
void PushSetAttributeInitialValuesCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, std::string NewValues)
void PushSetDescriptionMethodCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string description)
KernelWrapper(QObject *parent=nullptr)
void SetInheritanceMode(bool Mode)
Editor Functions.
void PushSetClassTypeRelationshipCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, std::string ClassType)
dunedaq::oks::OksKernel * Kernel
void PushRemoveMethodImplementationComand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string Language, std::string Prototype, std::string Body)
void CreateNewSchema(const std::string &SchemaName) const
void SaveAllSchema() const
void PushSetNameMethodCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string name)
Method commands.
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 PushSetAttributeTypeCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, std::string NewType)
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 PushRemoveClassCommand(dunedaq::oks::OksClass *Class, std::string ClassName, std::string ClassDescription, bool Abstract)
void PushSetLowCcRelationshipCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, dunedaq::oks::OksRelationship::CardinalityConstraint NewCardinality)
bool IsFileWritable(const std::string &FileName) const
void AddInclude(std::string schemaFile, std::string IncludeFile) const
void PushSetDescriptionRelationshipCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, std::string Description)
void PushAddMethodCommand(dunedaq::oks::OksClass *Class, std::string name, std::string description)
void get_all_includes(const std::string &FileName, std::set< std::string > &IncludedFiles)
void PushRemoveMethodCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string name, std::string description)
void PushCreateClassCommand(std::string ClassName, std::string ClassDescription, bool Abstract)
void PushSetNameRelationshipCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, std::string Name)
Relationship commands.
void PushSetAttributeNameCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, std::string NewName)
Attribute commands.
QUndoStack * CommandStack
std::vector< dunedaq::oks::OksClass * > get_schema_classes(std::string &filename)
void PushSetMethodImplementationBody(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, dunedaq::oks::OksMethodImplementation *Implementation, std::string Body)
bool is_file_modified(const std::string &FileName) const
void GetSchemaFiles(std::vector< std::string > &SchemaFiles)
void get_direct_includes(const std::string &FileName, std::set< std::string > &IncludedFiles)
RemoveAttributeCommand(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)
RemoveClassCommand(dunedaq::oks::OksClass *Class, std::string ClassName, std::string ClassDescription, bool Abstract)
RemoveMethodCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string name, std::string description)
RemoveMethodImplementationComand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string Language, std::string Prototype, std::string Body)
RemoveRelationship(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)
RemoveSuperClassCommand(dunedaq::oks::OksClass *Class, std::string SuperClass)
SetAbstractClassCommand(dunedaq::oks::OksClass *Class, bool Value)
SetAttributeDescriptionCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, std::string NewDescription)
SetAttributeInitialValuesCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, std::string NewValues)
SetAttributeIsNullCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, bool NewIsNull)
SetAttributeMultiCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, bool NewIsMulti)
SetAttributeNameCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, std::string NewName)
SetAttributeRangeCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, std::string NewRange)
SetAttributeTypeCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksAttribute *Attribute, std::string NewType)
SetClassTypeRelationshipCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, std::string ClassType)
SetDescriptionClassCommand(dunedaq::oks::OksClass *Class, std::string Description)
SetDescriptionMethodCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string description)
SetDescriptionRelationshipCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, std::string Description)
SetHighCcRelationshipCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, dunedaq::oks::OksRelationship::CardinalityConstraint NewCardinality)
SetIsCompositeRelationshipCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, bool Value)
SetIsDependentRelationshipCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, bool Value)
SetIsExclusiveRelationshipCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, bool Value)
SetLowCcRelationshipCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, dunedaq::oks::OksRelationship::CardinalityConstraint NewCardinality)
SetMethodImplementationBody(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, dunedaq::oks::OksMethodImplementation *Implementation, std::string Body)
SetMethodImplementationLanguage(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, dunedaq::oks::OksMethodImplementation *Implementation, std::string Language)
SetMethodImplementationPrototype(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, dunedaq::oks::OksMethodImplementation *Implementation, std::string Prototype)
SetNameMethodCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksMethod *Method, std::string name)
SetNameRelationshipCommand(dunedaq::oks::OksClass *Class, dunedaq::oks::OksRelationship *Relationship, std::string Name)
const std::string & get_name() const noexcept
Provides interface to the OKS XML schema and data files.
bool is_read_only() const
Return read-only status of OKS file.
Provides interface to the OKS kernel.
OKS method implementation class.
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.
virtual const char * what() const noexcept
DAC value out of range
Message.