DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
class.cpp
Go to the documentation of this file.
1// DUNE DAQ modification notice:
2// This file has been modified from the original ATLAS oks source for the DUNE DAQ project.
3// Fork baseline commit: oks-08-03-04 (2022-04-14).
4// Renamed since fork: no.
5
6#define _OksBuildDll_
7
8#include "oks/class.hpp"
9#include "oks/xml.hpp"
10#include "oks/relationship.hpp"
11#include "oks/method.hpp"
12#include "oks/kernel.hpp"
13#include "oks/object.hpp"
14#include "oks/index.hpp"
15#include "oks/profiler.hpp"
16#include "oks/cstring.hpp"
17
18#include "ers/ers.hpp"
19#include "logging/Logging.hpp"
20
21#include <stdlib.h>
22
23#include <string>
24#include <algorithm>
25#include <stdexcept>
26
27namespace dunedaq {
28namespace oks {
29
30const char OksClass::class_xml_tag[] = "class";
31const char OksClass::name_xml_attr[] = "name";
32const char OksClass::description_xml_attr[] = "description";
33const char OksClass::is_abstract_xml_attr[] = "is-abstract";
34const char OksClass::superclass_xml_attr[] = "superclass";
35
36
40
41 std::string
42 CannotFindSuperClass::fill(const OksClass& c, const std::string& name) noexcept
43 {
44 return std::string("cannot find superclass \'") + name + "\' of class \'" + c.get_name() + '\'';
45 }
46
47 std::string
48 AttributeConversionFailed::fill(const OksAttribute& a, const OksObject * o, const std::string& reason) noexcept
49 {
50 std::ostringstream s;
51 s << "failed to convert \'" << a.get_name() << "\" value of object " << o << " because:\n" + reason;
52 return s.str();
53 }
54
55 std::string
56 CannotRegisterClass::fill(const OksClass& c, const std::string& what, const std::string& reason) noexcept
57 {
58 return std::string("cannot register class \'") + c.get_name() + "\' " + what + "because:\n" + reason;
59 }
60
61 std::string
62 CannotDestroyClass::fill(const OksClass& c, const std::string& reason) noexcept
63 {
64 return std::string("cannot destroy class \'") + c.get_name() + "\' because:\n" + reason;
65 }
66
67 std::string
68 ObjectOperationFailed::fill(const OksClass& c, const std::string& oid, const char * op, const std::string& reason) noexcept
69 {
70 return std::string("cannot ") + op + " object \'" + oid + "\' in class \'" + c.get_name() + "\' because:\n" + reason;
71 }
72
73 std::string
74 SetOperationFailed::fill(const char * op, const std::string& reason) noexcept
75 {
76 return std::string("method \'") + op + "()\' failed because:\n" + reason;
77 }
78
79
80OksClass::OksClass(const std::string& nm, OksKernel * k, bool t) :
81 p_name (nm),
83 p_attributes (0),
85 p_methods (0),
86 p_abstract (false),
87 p_transient (t),
88 p_to_be_deleted (false),
93 p_all_methods (0),
95 p_kernel (k),
97 p_data_info (0),
98 p_objects (0),
99 p_indices (0)
100{
102
103 if(p_transient == false && p_kernel)
104 {
105 oks::validate_not_empty(p_name, "class name");
106
107 std::unique_lock lock(p_kernel->p_kernel_mutex);
108 p_kernel->k_add(this);
109 }
110}
111
112
113OksClass::OksClass(const std::string& nm, const std::string& d, bool a, OksKernel * k, bool t) :
114 p_name (nm),
115 p_description (d),
116 p_super_classes (0),
117 p_attributes (0),
118 p_relationships (0),
119 p_methods (0),
120 p_abstract (a),
121 p_transient (t),
122 p_to_be_deleted (false),
127 p_all_methods (0),
129 p_kernel (k),
130 p_instance_size (0),
131 p_data_info (0),
132 p_objects (0),
133 p_indices (0)
134{
136
137 if(p_transient == false && p_kernel)
138 {
139 oks::validate_not_empty(p_name, "class name");
140
141 std::unique_lock lock(p_kernel->p_kernel_mutex);
142 p_kernel->k_add(this);
143 }
144}
145
146
147OksClass::OksClass (OksKernel * kernel, const std::string& name, const std::string& description, bool is_abstract) :
148 p_name (name),
149 p_description (description),
150 p_super_classes (0),
151 p_attributes (0),
152 p_relationships (0),
153 p_methods (0),
154 p_abstract (is_abstract),
155 p_transient (false),
156 p_to_be_deleted (false),
161 p_all_methods (0),
163 p_file (kernel->p_active_schema),
164 p_kernel (kernel),
165 p_instance_size (0),
166 p_data_info (0),
167 p_objects (0),
168 p_indices (0)
169{
171 p_kernel->p_classes[p_name.c_str()] = this;
172}
173
174
175void
177{
178 // obtain write mutex, if non-transient class is registered in the oks kernel
179
180 if(!c->p_transient && c->p_kernel) {
181 std::unique_lock lock(c->p_kernel->p_kernel_mutex);
182
183 try {
184 c->p_file->lock();
185 c->p_file->set_updated();
186 }
187 catch(oks::exception& ex) {
188 throw oks::CannotDestroyClass(*c, ex);
189 }
190
191 delete c;
192 }
193
194 // destroy class without get write mutex
195
196 else {
197 delete c;
198 }
199}
200
201template<class T>
202 void
204 {
205 if (list)
206 {
207 for (const auto &x : *list)
208 delete x;
209
210 delete list;
211 }
212 }
213
214template<class T>
215 void
217 {
218 if (map)
219 {
220 for (const auto &x : *map)
221 delete x.second;
222
223 delete map;
224 }
225 }
226
228{
230
231 TLOG_DEBUG(2) << "destruct " << (p_transient ? "TRANSIENT" : "NORMAL") << " class \'" << get_name() << '\'' ;
232
233 // ~OksIndex() removes 'SELF' from OksClass and deletes 'indices' when there is no an index in it
234 while (p_indices)
235 delete (*(p_indices->begin())).second;
236
239
240 if (!p_transient && p_kernel)
241 {
242 p_kernel->k_remove(this);
243
245 for (const auto &c : *p_all_super_classes)
246 {
247 if (p_kernel->is_dangling(c) || c->p_to_be_deleted)
248 continue;
249
250 c->create_sub_classes();
251
253 (*OksClass::change_notify_fn)(c, ChangeSubClassesList, (const void*) &p_name);
254 }
255
257 for (const auto &c : *p_all_sub_classes)
258 {
259 if (p_kernel->is_dangling(c) || c->p_to_be_deleted)
260 continue;
261
262 try
263 {
264 c->registrate_class_change(ChangeSuperClassesList, (const void*) &p_name, false);
265 }
266 catch (oks::exception &ex)
267 {
268 std::cerr << "internal OKS error: registrate_class_change() failed during \'" << get_name() << "\' class destruction\ncaused by: " << ex.what() << std::endl;
269 }
270 }
271 }
272
277
278 if (!p_transient)
279 {
280 delete p_all_super_classes;
281 delete p_all_sub_classes;
282 delete p_all_attributes;
283 delete p_all_relationships;
284 delete p_all_methods;
286 }
287}
288
289
290void
291OksClass::set_file(OksFile * f, bool update_owner)
292{
293 if(p_file != f) {
294 try {
295 if(update_owner) {
296 p_file->lock();
297 p_file->set_updated();
298 }
299
300 f->lock();
301 f->set_updated();
302
303 p_file = f;
304 }
305 catch(oks::exception& ex) {
306 throw oks::CanNotSetFile(this, 0, *f, ex);
307 }
308 }
309}
310
311
312bool
314{
315 if(this == &c) return true;
316
317 if(
318 (p_name != c.p_name) ||
319 (p_description != c.p_description) ||
320 (p_abstract != c.p_abstract)
321 ) return false;
322
323
324 int l1 = (p_attributes == 0) ? 0 : p_attributes->size();
325 int l2 = (c.p_attributes == 0) ? 0 : c.p_attributes->size();
326
327 if(l1 != l2) return false;
328
329 if(l1 > 0) {
330 std::list<OksAttribute *>::const_iterator i1 = p_attributes->begin();
331 std::list<OksAttribute *>::const_iterator i2 = c.p_attributes->begin();
332
333 for(;i1 != p_attributes->end();++i1, ++i2)
334 if( !(*(*i1) == *(*i2)) ) return false;
335 }
336
337 l1 = (p_relationships == 0) ? 0 : p_relationships->size();
338 l2 = (c.p_relationships == 0) ? 0 : c.p_relationships->size();
339
340 if(l1 != l2) return false;
341
342 if(l1 > 0) {
343 std::list<OksRelationship *>::const_iterator i1 = p_relationships->begin();
344 std::list<OksRelationship *>::const_iterator i2 = c.p_relationships->begin();
345
346 for(;i1 != p_relationships->end();++i1, ++i2)
347 if( !(*(*i1) == *(*i2)) ) return false;
348 }
349
350 l1 = (p_super_classes == 0) ? 0 : p_super_classes->size();
351 l2 = (c.p_super_classes == 0) ? 0 : c.p_super_classes->size();
352
353 if(l1 != l2) return false;
354
355 if(l1 > 0) {
356 std::list<std::string *>::const_iterator i1 = p_super_classes->begin();
357 std::list<std::string *>::const_iterator i2 = c.p_super_classes->begin();
358
359 for(;i1 != p_super_classes->end();++i1, ++i2)
360 if( !(*(*i1) == *(*i2)) ) return false;
361 }
362
363 return true;
364}
365
366bool
368{
369 if(this == &c) return false;
370
371 if(compare_without_methods(c) == false) return true;
372
373 int l1 = (p_methods == 0) ? 0 : p_methods->size();
374 int l2 = (c.p_methods == 0) ? 0 : c.p_methods->size();
375
376 if(l1 != l2) return true;
377
378 if(l1 > 0) {
379 std::list<OksMethod *>::const_iterator i1 = p_methods->begin();
380 std::list<OksMethod *>::const_iterator i2 = c.p_methods->begin();
381
382 for(;i1 != p_methods->end();++i1, ++i2)
383 if( !(*(*i1) == *(*i2)) ) return true;
384 }
385
386 return false;
387}
388
389
390std::ostream&
391operator<<(std::ostream& s, const OksClass& c)
392{
394
395 s << "Class name: \"" << c.p_name << "\"\n"
396 " has description: \"" << c.p_description << "\"\n"
397 << (c.p_abstract == true ? " is abstract\n" : " is not abstract\n");
398
399 if(c.p_super_classes) {
400 s << "The class has superclasses:\n";
401 for(std::list<std::string *>::const_iterator i = c.p_super_classes->begin(); i != c.p_super_classes->end(); ++i) {
402 s << " - " << *(*i) << std::endl;
403 }
404 }
405 else
406 s << "The class has no superclasses\n";
407
408
409 if(c.p_attributes) {
410 s << "The attributes are:\n";
411 for(std::list<OksAttribute *>::const_iterator i = c.p_attributes->begin(); i != c.p_attributes->end(); ++i) {
412 s << *(*i);
413 }
414 }
415 else
416 s << "There are no attributes\n";
417
418
419 if(c.p_relationships) {
420 s << "The relationships are:\n";
421 for(std::list<OksRelationship *>::const_iterator i = c.p_relationships->begin(); i != c.p_relationships->end(); ++i) {
422 s << *(*i);
423 }
424 }
425 else
426 s << "There are no relationships\n";
427
428
429 if(c.p_methods) {
430 s << "The methods are:\n";
431 for(std::list<OksMethod *>::const_iterator i = c.p_methods->begin(); i != c.p_methods->end(); ++i) {
432 s << *(*i);
433 }
434 }
435 else
436 s << "There are no methods\n";
437
438
439 if(c.p_objects) {
440 OksObject::SMap sorted;
441
442 s << "The objects are:\n";
443
444 for(OksObject::Map::iterator i = c.p_objects->begin(); i != c.p_objects->end(); ++i) {
445 sorted[i->first] = i->second;
446 }
447
448 for(OksObject::SMap::iterator i = sorted.begin(); i != sorted.end(); ++i) {
449 s << *(i->second);
450 }
451 }
452 else
453 s << "There are no objects\n";
454
455
456 s << "End of Class \"" << c.p_name << "\"\n";
457
458 return s;
459}
460
461
462void
464{
465 try {
466 s.put_raw(' ');
467 s.put_start_tag(class_xml_tag, sizeof(class_xml_tag)-1);
468 s.put_attribute(name_xml_attr, sizeof(name_xml_attr)-1, p_name.c_str());
469
470 // store non-empty description only
471 if (!p_description.empty())
472 s.put_attribute(description_xml_attr, sizeof(description_xml_attr)-1, p_description.c_str());
473
474 // store abstract attribute only when the class is abstract
475 if (p_abstract)
477
478 s.put_raw('>');
479 s.put_raw('\n');
480
481 if (p_super_classes)
482 for(const auto& i : *p_super_classes) {
483 s.put_raw(' ');
484 s.put_raw(' ');
485 s.put_start_tag(superclass_xml_attr, sizeof(superclass_xml_attr)-1);
486 s.put_attribute(name_xml_attr, sizeof(name_xml_attr)-1, i->c_str());
487 s.put_end_tag();
488 }
489
490 if (p_attributes)
491 for (const auto &i : *p_attributes)
492 i->save(s);
493
494 if (p_relationships)
495 for (const auto &i : *p_relationships)
496 i->save(s);
497
498 if (p_methods)
499 for (const auto &i : *p_methods)
500 i->save(s);
501
502 s.put_raw(' ');
503 s.put_last_tag(class_xml_tag, sizeof(class_xml_tag)-1);
504 s.put_raw('\n');
505 }
506
507 catch (oks::exception & e) {
508 throw oks::FailedSave("oks-class", p_name, e);
509 }
510
511 catch (std::exception & e) {
512 throw oks::FailedSave("oks-class", p_name, e.what());
513 }
514
515}
516
517
519 p_super_classes (0),
520 p_attributes (0),
521 p_relationships (0),
522 p_methods (0),
523 p_abstract (false),
524 p_transient (false),
525 p_to_be_deleted (false),
530 p_all_methods (0),
532 p_kernel (k),
533 p_instance_size (0),
534 p_data_info (0),
535 p_objects (0),
536 p_indices (0)
537{
538
539 // read 'relationship' tag header
540
541 {
542 try {
543 const char * tag_start = s.get_tag_start();
544
545 if(strcmp(tag_start, class_xml_tag)) {
546 if(!strcmp(tag_start, "/oks-schema")) {
547 goto end_of_stream; // re-throw of exception takes too much time; go to is better
548 }
549 s.throw_unexpected_tag(tag_start, class_xml_tag);
550 }
551 }
552 catch (oks::exception & e) {
553 throw oks::FailedRead("oks-class tag", e);
554 }
555 catch (std::exception & e) {
556 throw oks::FailedRead("oks-class tag", e.what());
557 }
558 }
559
560 // read class attributes
561
562 try {
563 while(true) {
564 OksXmlAttribute attr(s);
565
566 // check for close of tag
567
568 if(oks::cmp_str1(attr.name(), ">")) { break; }
569
570 // check for known oks-class' attributes
571
572 else if(oks::cmp_str4(attr.name(), name_xml_attr)) p_name.assign(attr.value(), attr.value_len());
573 else if(oks::cmp_str11(attr.name(), description_xml_attr)) p_description.assign(attr.value(), attr.value_len());
575 else {
576 s.throw_unexpected_tag(attr.name(), "oks-class\' attribute");
577 }
578 }
579 }
580 catch (oks::exception & e) {
581 throw oks::FailedRead("oks-class description", e);
582 }
583 catch (std::exception & e) {
584 throw oks::FailedRead("oks-class description", e.what());
585 }
586
587
588 try {
589 oks::validate_not_empty(p_name, "class name");
590 }
591 catch(std::exception& ex) {
592 throw oks::FailedRead("oks class", oks::BadFileData(ex.what(), s.get_line_no(), s.get_line_pos()));
593 }
594
595
596 // read class body
597
598 while(true) {
599
600 try {
601
602 const char * tag_start = s.get_tag_start();
603
604 // check for closing tag and exit loop
605
606 if(oks::cmp_str6(tag_start, "/class")) { break; }
607
608
609 // create superclass
610
611 else if(oks::cmp_str10(tag_start, superclass_xml_attr)) {
612 unsigned long scl_pos = s.get_line_no();
613 try {
614 OksXmlAttribute attr(s);
615
616 if(!p_super_classes) p_super_classes = new std::list<std::string *>();
617 std::string * scl = new std::string(attr.value(), attr.value_len());
618 if(has_direct_super_class(*scl))
619 {
620 std::ostringstream text;
621 text << "second inclusion of super-class \"" + *scl + "\" at line " << scl_pos;
622 delete scl;
623 throw std::runtime_error(text.str().c_str());
624 }
625 p_super_classes->push_back(scl);
626
627 OksXmlAttribute attr2(s);
628 }
629 catch (oks::exception & e) {
630 throw oks::FailedRead(std::string("a superclass-name of class \"") + p_name + '\"', e);
631 }
632 catch (std::exception & e) {
633 throw oks::FailedRead(std::string("a superclass-name of class \"") + p_name + '\"', e.what());
634 }
635 }
636
637
638 // create attribute from stream and check attribute status
639
640 else if(oks::cmp_str9(tag_start, "attribute")) {
641 unsigned long attr_pos = s.get_line_no();
642 try {
643 if(!p_attributes) p_attributes = new std::list<OksAttribute *>();
644 OksAttribute * a = new OksAttribute(s, this);
645 if(find_direct_attribute(a->get_name()) != nullptr)
646 {
647 std::ostringstream text;
648 text << "redefinition of attribute with name \"" + a->get_name() + "\" at line " << attr_pos;
649 delete a;
650 throw std::runtime_error(text.str().c_str());
651 }
652 p_attributes->push_back(a);
653 }
654 catch (oks::exception & e) {
655 throw oks::FailedRead(std::string("an attribute of class \"") + p_name + '\"', e);
656 }
657 catch (std::exception & e) {
658 throw oks::FailedRead(std::string("an attribute of class \"") + p_name + '\"', e.what());
659 }
660 }
661
662
663 // create relationship from stream and check relationship status
664
665 else if(oks::cmp_str12(tag_start, "relationship")) {
666 unsigned long rel_pos = s.get_line_no();
667 try {
668 if(!p_relationships) p_relationships= new std::list<OksRelationship *>();
669 OksRelationship * r = new OksRelationship(s,this);
670 if(find_direct_relationship(r->get_name()) != nullptr)
671 {
672 std::ostringstream text;
673 text << "redefinition of relationship with name \"" + r->get_name() + "\" at line " << rel_pos;
674 delete r;
675 throw std::runtime_error(text.str().c_str());
676 }
677 p_relationships->push_back(r);
678 }
679 catch (oks::exception & e) {
680 throw oks::FailedRead(std::string("a relationship of class \"") + p_name + '\"', e);
681 }
682 catch (std::exception & e) {
683 throw oks::FailedRead(std::string("a relationship of class \"") + p_name + '\"', e.what());
684 }
685 }
686
687
688 // create method from stream and check method status
689
690 else if(oks::cmp_str6(tag_start, "method")) {
691 unsigned long method_pos = s.get_line_no();
692 try {
693 if(!p_methods) p_methods = new std::list<OksMethod *>();
694 OksMethod * m = new OksMethod(s,this);
695 if(find_direct_method(m->get_name()) != nullptr)
696 {
697 std::ostringstream text;
698 text << "redefinition of method with name \"" + m->get_name() + "\" at line " << method_pos;
699 delete m;
700 throw std::runtime_error(text.str().c_str());
701 }
702 p_methods->push_back(m);
703 }
704 catch (oks::exception & e) {
705 throw oks::FailedRead(std::string("a method of class \"") + p_name + '\"', e);
706 }
707 catch (std::exception & e) {
708 throw oks::FailedRead(std::string("a method of class \"") + p_name + '\"', e.what());
709 }
710 }
711
712
713 // report error if red something differnt from above
714 // and set bad status of constructor (suppose 'name' can't be empty)
715
716 else {
717 s.throw_unexpected_tag(tag_start);
718 }
719
720 }
721 catch (oks::FailedRead & e) {
722 throw; // re-throw attribute, relationship or method exception
723 }
724 catch (oks::exception & e) {
725 throw oks::FailedRead(std::string("a tag of class \"") + p_name + '\"', e);
726 }
727 catch (std::exception & e) {
728 throw oks::FailedRead(std::string("a tag of class \"") + p_name + '\"', e.what());
729 }
730
731 }
732
733 return;
734
735
736end_of_stream:
737
738 throw oks::EndOfXmlStream("oks-schema");
739}
740
741
742/******************************************************************************/
743/****************************** OKS SUPERCLASSES ******************************/
744/******************************************************************************/
745
746OksClass *
747OksClass::find_super_class(const std::string& nm) const noexcept
748{
750 for(FList::const_iterator i = p_all_super_classes->begin(); i != p_all_super_classes->end(); ++i) {
751 if((*i)->get_name() == nm) return *i;
752 }
753 }
754
755 return 0;
756}
757
758bool
759OksClass::has_direct_super_class(const std::string& nm) const noexcept
760{
761 if(p_super_classes) {
762 for(std::list<std::string *>::const_iterator i = p_super_classes->begin(); i != p_super_classes->end(); ++i)
763 if(nm == *(*i)) return true;
764 }
765
766 return false;
767}
768
769
770void
771OksClass::lock_file(const char * fname)
772{
773 if(p_kernel) {
774 try {
775 p_file->lock();
776 }
777 catch(oks::exception& ex) {
778 throw oks::SetOperationFailed(fname, ex);
779 }
780 }
781}
782
783
784void
785OksClass::set_description(const std::string& s)
786{
787 if(p_description != s) {
788 lock_file("OksClass::set_description");
789
790 p_description = s;
791
792 if(p_kernel) {
793 p_file->set_updated();
795 (*OksClass::change_notify_fn)(this, ChangeDescription, 0);
796 }
797 }
798 }
799}
800
801
802void
804{
805 if(p_abstract != b) {
806 lock_file("OksClass::set_is_abstract");
807
808 p_abstract = b;
809
810 if(p_kernel) {
811 p_file->set_updated();
813 (*OksClass::change_notify_fn)(this, ChangeIsAbstaract, 0);
814 }
815 }
816 }
817}
818
819
820 // Function to report problem with arguments of swap(...) methods
821
822static void
823check_and_report_empty_parameter(const char * fname, bool b1, bool b2)
824{
825 if(b1) {
826 throw oks::SetOperationFailed(fname, "First parameter is (null)");
827 }
828
829 if(b2) {
830 throw oks::SetOperationFailed(fname, "Second parameter is (null)");
831 }
832}
833
834
835 // Function to report problem with found items of swap(...) methods
836
837static void
838check_and_report_found_items(const char * fname, const char * item_type,
839 const std::string& item1_name, const std::string& item2_name,
840 const std::string& class_name, bool b1, bool b2)
841{
842 struct {
843 bool b;
844 const std::string * name;
845 } info[] = {
846 {b1, &item1_name},
847 {b2, &item2_name}
848 };
849
850 for(int i = 0; i < 2; ++i) {
851 if(info[i].b) {
852 std::string text("cannot find direct ");
853 text += item_type;
854 text += " \"";
855 text += *info[i].name;
856 text += "\" in class \"";
857 text += class_name;
858 text += '\"';
859 throw oks::SetOperationFailed(fname, text);
860 }
861 }
862}
863
864static std::string
865add_super_class_error(const std::string& c1, const std::string& c2)
866{
867 return (std::string("cannot add superclass \"") + c1 + "\" to class \"" + c2 + '\"');
868}
869
870
871void
872OksClass::k_add_super_class(const std::string& nm)
873{
874 if(!p_super_classes) {
875 p_super_classes = new std::list<std::string *>();
876 }
877
878 p_super_classes->push_back((new std::string(nm)));
879}
880
881
882void
883OksClass::add_super_class(const std::string& nm)
884{
885 if(!p_super_classes) {
886 p_super_classes = new std::list<std::string *>();
887 }
888 else {
889 if( has_direct_super_class(nm) ) {
890 std::string text(add_super_class_error(nm, p_name));
891 text += " because class \"" + p_name + "\" already has such superclass.";
892 throw oks::SetOperationFailed("OksClass::add_super_class", text);
893 }
894 }
895
896 if(nm == p_name) {
897 std::string text(add_super_class_error(nm, p_name));
898 text += " because names of classes are the same.";
899 throw oks::SetOperationFailed("OksClass::add_super_class", text);
900 }
901
902 if(p_kernel) {
903 OksClass * nmc = p_kernel->find_class(nm);
904 if(nmc) {
906 std::string text(add_super_class_error(nm, p_name));
907 text += " because class \"" + nm + "\" is already direct superclass of \"" + p_name + "\".";
908 throw oks::SetOperationFailed("OksClass::add_super_class", text);
909 }
910 else if(nmc->find_super_class(p_name)) {
911 std::string text(add_super_class_error(nm, p_name));
912 text += " because class \"" + nm + "\" is already non-direct superclass of \"" + p_name + "\".";
913 throw oks::SetOperationFailed("OksClass::add_super_class", text);
914 }
915 }
916 }
917
918 lock_file("OksClass::add_super_class");
919
920 p_super_classes->push_back((new std::string(nm)));
921
923}
924
925static std::string
926remove_super_class_error(const std::string& c1, const std::string& c2)
927{
928 return (std::string("cannot remove superclass \"") + c1 + "\" from class \"" + c2 + '\"');
929}
930
931void
932OksClass::remove_super_class(const std::string& nm)
933{
934 if( !p_super_classes ) {
935 std::string text(remove_super_class_error(nm, p_name));
936 text += " because class \"" + p_name + "\" has no superclasses at all.";
937 throw oks::SetOperationFailed("OksClass::remove_super_class", text);
938 }
939
940
941 for(std::list<std::string *>::iterator i = p_super_classes->begin(); i != p_super_classes->end(); ++i) {
942 std::string * si(*i);
943 if(nm == *si) {
944 lock_file("OksClass::remove_super_class");
945
946 p_super_classes->erase(i);
947 delete si;
948
949 if(p_super_classes->empty()) {
950 delete p_super_classes;
951 p_super_classes = 0;
952 }
953
955
956 return;
957 }
958 }
959
960 std::string text(remove_super_class_error(nm, p_name));
961 text += " because class \"" + p_name + "\" has no superclass with this name.";
962 throw oks::SetOperationFailed("OksClass::remove_super_class", text);
963}
964
965
966void
967OksClass::swap_super_classes(const std::string& c1, const std::string& c2)
968{
969 const char * fname = "OksClass::swap_super_classes()";
970
971
972 // if classs are equal, return success
973
974 if(c1 == c2) return;
975
976
977 // check that an class name is not empty
978
979 check_and_report_empty_parameter(fname, c1.empty(), c2.empty());
980
981
982 // find requested classes in the directed classs list
983
984 std::list<std::string *>::iterator i1 = p_super_classes->end();
985 std::list<std::string *>::iterator i2 = p_super_classes->end();
986
987 for(std::list<std::string *>::iterator i = p_super_classes->begin(); i != p_super_classes->end(); ++i) {
988 if(*(*i) == c1) i1 = i;
989 else if(*(*i) == c2) i2 = i;
990 }
991
992 // check that the classes were found
993
995 "OksClass::swap_super_classes", "superclass", c1, c2, p_name,
996 (i1 == p_super_classes->end()), (i2 == p_super_classes->end())
997 );
998
999
1000 // replace the classs and make notification
1001
1002 lock_file("OksClass::swap_super_classes");
1003
1004 std::string * s1 = *i1;
1005 std::string * s2 = *i2;
1006
1007 *i1 = s2;
1008 *i2 = s1;
1009
1011}
1012
1013
1014/******************************************************************************/
1015/******************************* OKS ATTRIBUTES *******************************/
1016/******************************************************************************/
1017
1019OksClass::find_direct_attribute(const std::string& _name) const noexcept
1020{
1021 if(p_attributes) {
1022 for(std::list<OksAttribute *>::const_iterator i = p_attributes->begin(); i != p_attributes->end(); ++i)
1023 if(_name == (*i)->get_name()) return *i;
1024 }
1025
1026 return 0;
1027}
1028
1029
1031OksClass::find_attribute(const std::string& _name) const noexcept
1032{
1033 if(p_all_attributes) {
1034 for(std::list<OksAttribute *>::const_iterator i = p_all_attributes->begin(); i != p_all_attributes->end(); ++i)
1035 if(_name == (*i)->get_name()) return *i;
1036
1037 return 0;
1038 }
1039 else
1040 return find_direct_attribute(_name);
1041}
1042
1043
1044void
1046{
1047 if(!p_attributes) {
1048 p_attributes = new std::list<OksAttribute *>();
1049 }
1050
1051 p_attributes->push_back(attribute);
1052 attribute->p_class = this;
1053}
1054
1055
1056void
1058{
1059 const char * fname = "OksClass::add(OksAttribute *)";
1060
1061 if(!p_attributes) {
1062 p_attributes = new std::list<OksAttribute *>();
1063 }
1064 else {
1065 if(find_direct_attribute(attribute->get_name()) != 0) {
1066 std::ostringstream text;
1067 text << "cannot add attribute \"" << attribute->get_name() << "\" to class \"" << p_name << "\"\n"
1068 "because the class already has attribute with this name.\n";
1069 throw oks::SetOperationFailed(fname, text.str());
1070 }
1071 }
1072
1073 lock_file("OksClass::add[OksAttribute]");
1074
1075 p_attributes->push_back(attribute);
1076 attribute->p_class = this;
1077
1078 registrate_class_change(ChangeAttributesList, (const void *)attribute);
1079}
1080
1081
1082void
1084{
1085 const char * fname = "OksClass::swap(const OksAttribute *, const OksAttribute *)";
1086
1087
1088 // if attributes are equal, return success
1089
1090 if(a1 == a2) return;
1091
1092
1093 // check that an attributes is not (null)
1094
1095 check_and_report_empty_parameter(fname, (a1 == 0), (a2 == 0));
1096
1097
1098 // find requested attributes in the directed attributes list
1099
1100 std::list<OksAttribute *>::iterator i1 = p_attributes->end();
1101 std::list<OksAttribute *>::iterator i2 = p_attributes->end();
1102
1103 for(std::list<OksAttribute *>::iterator i = p_attributes->begin(); i != p_attributes->end(); ++i) {
1104 if((*i) == a1) i1 = i;
1105 else if((*i) == a2) i2 = i;
1106 }
1107
1108 // check that the attributes were found
1109
1111 fname, "attribute", a1->get_name(), a2->get_name(), p_name,
1112 (i1 == p_attributes->end()), (i2 == p_attributes->end())
1113 );
1114
1115
1116 // check that the file can be locked
1117
1118 lock_file("OksClass::swap[OksAttribute]");
1119
1120
1121 // replace the attributes and make notification
1122
1123 *i1 = const_cast<OksAttribute *>(a2);
1124 *i2 = const_cast<OksAttribute *>(a1);
1125
1127}
1128
1129void
1131{
1132 const char * fname = "OksClass::remove(OksAttribute *)";
1133
1134 if(!p_attributes) {
1135 std::ostringstream text;
1136 text << "cannot remove attribute \"" << attribute->get_name() << "\" from class \"" << p_name << "\"\n"
1137 "because the class has no attributes.\n";
1138 throw oks::SetOperationFailed(fname, text.str());
1139 }
1140
1141 for(std::list<OksAttribute *>::iterator i = p_attributes->begin(); i != p_attributes->end(); ++i) {
1142 if(attribute == *i) {
1143 lock_file("OksClass::remove[OksAttribute]");
1144
1145 p_attributes->erase(i);
1146 delete const_cast<OksAttribute *>(attribute);
1147
1148 if(p_attributes->empty()) {
1149 delete p_attributes;
1150 p_attributes = 0;
1151 }
1152
1154
1155 return;
1156 }
1157 }
1158
1159 std::ostringstream text;
1160 text << "cannot remove attribute \"" << attribute->get_name() << "\" from class \"" << p_name << "\"\n"
1161 "because the class has no such attribute with this name.\n";
1162 throw oks::SetOperationFailed(fname, text.str());
1163}
1164
1165
1166OksClass *
1167OksClass::source_class(const OksAttribute *a) const noexcept
1168{
1169 return a->p_class;
1170}
1171
1172
1173/******************************************************************************/
1174/***************************** OKS RELATIONSHIPS *****************************/
1175/******************************************************************************/
1176
1178OksClass::find_direct_relationship(const std::string& _name) const noexcept
1179{
1180 if(p_relationships) {
1181 for(std::list<OksRelationship *>::const_iterator i = p_relationships->begin(); i != p_relationships->end(); ++i)
1182 if(_name == (*i)->get_name()) return *i;
1183 }
1184
1185 return 0;
1186}
1187
1189OksClass::find_relationship(const std::string& _name) const noexcept
1190{
1192 for(std::list<OksRelationship *>::const_iterator i = p_all_relationships->begin(); i != p_all_relationships->end(); ++i)
1193 if(_name == (*i)->get_name()) return *i;
1194
1195 return 0;
1196 }
1197 else
1198 return find_direct_relationship(_name);
1199}
1200
1201void
1203{
1204 if(!p_relationships) {
1205 p_relationships = new std::list<OksRelationship *>();
1206 }
1207
1208 p_relationships->push_back(relationship);
1209 relationship->p_class = this;
1210}
1211
1212void
1214{
1215 const char * fname = "OksClass::add(OksRelationship *)";
1216
1217 if(!p_relationships) {
1218 p_relationships = new std::list<OksRelationship *>();
1219 }
1220 else {
1221 if(find_direct_relationship(relationship->get_name())) {
1222 std::ostringstream text;
1223 text << "cannot add relationship \"" << relationship->get_name() << "\" to class \"" << p_name << "\"\n"
1224 "because the class already has relationship with this name.\n";
1225 throw oks::SetOperationFailed(fname, text.str());
1226 }
1227 }
1228
1229 lock_file("OksClass::add[OksRelationship]");
1230
1231 p_relationships->push_back(relationship);
1232 relationship->p_class = this;
1233
1234 registrate_class_change(ChangeRelationshipsList, (const void *)relationship);
1235}
1236
1237void
1238OksClass::remove(const OksRelationship * relationship, bool call_delete)
1239{
1240 const char * fname = "OksClass::remove(OksRelationship *)";
1241
1242 if(!p_relationships) {
1243 std::ostringstream text;
1244 text << "cannot remove relationship \"" << relationship->get_name() << "\" from class \"" << p_name << "\"\n"
1245 "because the class has no relationships.\n";
1246 throw oks::SetOperationFailed(fname, text.str());
1247 }
1248
1249 for(std::list<OksRelationship *>::iterator i = p_relationships->begin(); i != p_relationships->end(); ++i) {
1250 if(relationship == *i) {
1251 lock_file("OksClass::remove[OksRelationship]");
1252
1253 p_relationships->erase(i);
1254 if(call_delete) {
1255 delete const_cast<OksRelationship *>(relationship);
1256 }
1257
1258 if(p_relationships->empty()) {
1259 delete p_relationships;
1260 p_relationships = 0;
1261 }
1262
1264
1265 return;
1266 }
1267 }
1268
1269 std::ostringstream text;
1270 text << "cannot remove relationship \"" << relationship->get_name() << "\" from class \"" << p_name << "\"\n"
1271 "because the class has no such relationship with this name.\n";
1272 throw oks::SetOperationFailed(fname, text.str());
1273}
1274
1275
1276void
1278{
1279 const char * fname = "OksClass::swap(const OksRelationship *, const OksRelationship *)";
1280
1281
1282 // if relationships are equal, return success
1283
1284 if(r1 == r2) return;
1285
1286
1287 // check that an relationships is not (null)
1288
1289 check_and_report_empty_parameter(fname, (r1 == 0), (r2 == 0));
1290
1291
1292 // find requested relationships in the directed relationships list
1293
1294 std::list<OksRelationship *>::iterator i1 = p_relationships->end();
1295 std::list<OksRelationship *>::iterator i2 = p_relationships->end();
1296
1297 for(std::list<OksRelationship *>::iterator i = p_relationships->begin(); i != p_relationships->end(); ++i) {
1298 if((*i) == r1) i1 = i;
1299 else if((*i) == r2) i2 = i;
1300 }
1301
1302 // check that the relationships were found
1303
1305 fname, "relationship", r1->get_name(), r2->get_name(), p_name,
1306 (i1 == p_relationships->end()), (i2 == p_relationships->end())
1307 );
1308
1309 // check that the file can be locked
1310
1311 lock_file("OksClass::swap[OksRelationship]");
1312
1313 // replace the relationships and make notification
1314
1315 *i1 = const_cast<OksRelationship *>(r2);
1316 *i2 = const_cast<OksRelationship *>(r1);
1317
1319}
1320
1321
1322OksClass*
1324{
1325 return r->p_class;
1326}
1327
1328
1329/******************************************************************************/
1330/******************************** OKS METHODS ********************************/
1331/******************************************************************************/
1332
1333
1334OksMethod *
1335OksClass::find_direct_method(const std::string& _name) const noexcept
1336{
1337 if(p_methods) {
1338 for(std::list<OksMethod *>::const_iterator i = p_methods->begin(); i != p_methods->end(); ++i)
1339 if(_name == (*i)->get_name()) return *i;
1340 }
1341
1342 return 0;
1343}
1344
1345OksMethod *
1346OksClass::find_method(const std::string& _name) const noexcept
1347{
1348 if(p_all_methods) {
1349 for(std::list<OksMethod *>::const_iterator i = p_all_methods->begin(); i != p_all_methods->end(); ++i)
1350 if(_name == (*i)->get_name()) return *i;
1351
1352 return 0;
1353 }
1354 else
1355 return find_direct_method(_name);
1356}
1357
1358void
1360{
1361 const char * fname = "OksClass::add(OksMethod *)";
1362
1363 if(!p_methods) {
1364 p_methods = new std::list<OksMethod *>();
1365 }
1366 else {
1367 if(find_direct_method(method->get_name())) {
1368 std::ostringstream text;
1369 text << "cannot add method \"" << method->get_name() << "\" to class \"" << p_name << "\"\n"
1370 "because the class already has method with this name.\n";
1371 throw oks::SetOperationFailed(fname, text.str());
1372 }
1373 }
1374
1375 // check that the file can be locked
1376
1377 lock_file("OksClass::add[OksMethod]");
1378
1379 p_methods->push_back(method);
1380 method->p_class = this;
1381
1382 registrate_class_change(ChangeMethodsList, (const void *)method);
1383}
1384
1385void
1387{
1388 const char * fname = "OksClass::remove(OksMethod *)";
1389
1390 if(!p_methods) {
1391 std::ostringstream text;
1392 text << "cannot remove method \"" << method->get_name() << "\" from class \"" << p_name << "\"\n"
1393 "because the class has no methods.\n";
1394 throw oks::SetOperationFailed(fname, text.str());
1395 }
1396
1397 for(std::list<OksMethod *>::iterator i = p_methods->begin(); i != p_methods->end(); ++i) {
1398 if(method == *i) {
1399 lock_file("OksClass::remove[OksMethod]");
1400
1401 p_methods->erase(i);
1402 delete const_cast<OksMethod *>(method);
1403
1404 if(p_methods->empty()) {
1405 delete p_methods;
1406 p_methods = 0;
1407 }
1408
1410
1411 return;
1412 }
1413 }
1414
1415 std::ostringstream text;
1416 text << "cannot remove method \"" << method->get_name() << "\" from class \"" << p_name << "\"\n"
1417 "because the class has no such method with this name.\n";
1418 throw oks::SetOperationFailed(fname, text.str());
1419}
1420
1421void
1422OksClass::swap(const OksMethod * m1, const OksMethod * m2)
1423{
1424 const char * fname = "OksClass::swap(const OksMethod *, const OksMethod *)";
1425
1426
1427 // if methods are equal, return success
1428
1429 if(m1 == m2) return;
1430
1431
1432 // check that an methods is not (null)
1433
1434 check_and_report_empty_parameter(fname, (m1 == 0), (m2 == 0));
1435
1436
1437 // find requested methods in the directed methods list
1438
1439 std::list<OksMethod *>::iterator i1 = p_methods->end();
1440 std::list<OksMethod *>::iterator i2 = p_methods->end();
1441
1442 for(std::list<OksMethod *>::iterator i = p_methods->begin(); i != p_methods->end(); ++i) {
1443 if((*i) == m1) i1 = i;
1444 else if((*i) == m2) i2 = i;
1445 }
1446
1447 // check that the methods were found
1448
1450 fname, "method", m1->get_name(), m2->get_name(), p_name,
1451 (i1 == p_methods->end()), (i2 == p_methods->end())
1452 );
1453
1454 // check that the file can be locked
1455
1456 lock_file("OksClass::swap[OksMethod]");
1457
1458 // replace the methods and make notification
1459
1460 *i1 = const_cast<OksMethod *>(m2);
1461 *i2 = const_cast<OksMethod *>(m1);
1462
1464}
1465
1466
1467OksClass*
1468OksClass::source_class(const OksMethod *m) const noexcept
1469{
1470 return m->p_class;
1471}
1472
1473
1474/******************************************************************************/
1475/******************************** OKS OBJECTS ********************************/
1476/******************************************************************************/
1477
1478size_t
1480{
1481 return (!p_objects ? 0 : p_objects->size());
1482}
1483
1484
1485 //
1486 // Creates list of class instances and instances of
1487 // all subclasses
1488 //
1489
1490std::list<OksObject *> *
1492{
1493 std::list<OksObject *> * olist = 0;
1494
1495 // add instances of class
1496
1497 if(p_objects && !p_objects->empty()) {
1498 olist = new std::list<OksObject *>();
1499
1500 for(OksObject::Map::const_iterator i = p_objects->begin(); i != p_objects->end(); ++i)
1501 olist->push_back((*i).second);
1502 }
1503
1504 // build iterator over subclasses
1505
1506 if(p_all_sub_classes) {
1507 for(FList::const_iterator j = p_all_sub_classes->begin(); j != p_all_sub_classes->end(); ++j) {
1508 OksClass *sc = *j;
1509
1510 // add instances of subclass
1511
1512 if(sc->p_objects && !sc->p_objects->empty()) {
1513 if(!olist) olist = new std::list<OksObject *>();
1514
1515 for(OksObject::Map::const_iterator i = sc->p_objects->begin(); i != sc->p_objects->end(); ++i)
1516 olist->push_back((*i).second);
1517 }
1518 }
1519 }
1520
1521 return olist;
1522}
1523
1524
1525OksObject*
1526OksClass::get_object(const std::string& id) const noexcept
1527{
1528 std::shared_lock lock(p_mutex); // protect p_objects
1529
1530 if(p_objects) {
1531 OksObject::Map::const_iterator i = p_objects->find(&id);
1532 if(i != p_objects->end()) return i->second;
1533 }
1534
1535 return nullptr;
1536}
1537
1538
1539/******************************************************************************/
1540/****************************** PRIVATE METHODS ******************************/
1541/******************************************************************************/
1542
1543void
1545{
1546 std::unique_lock lock(p_mutex); // protect p_objects
1547
1548 if(!p_objects->insert(std::pair<const std::string *,OksObject *>(&object->uid.object_id,object) ).second) {
1549 throw oks::ObjectOperationFailed(*this, object->uid.object_id, "add", "object already exists");
1550 }
1551}
1552
1553void
1555{
1556 std::unique_lock lock(p_mutex); // protect p_objects
1557
1558 if(!p_objects) {
1559 throw oks::ObjectOperationFailed(*this, object->uid.object_id, "remove", "OKS Kernel is not inited");
1560 }
1561
1562 OksObject::Map::iterator i = p_objects->find(&object->uid.object_id);
1563
1564 if(i != p_objects->end()) p_objects->erase(i);
1565 else {
1566 throw oks::ObjectOperationFailed(*this, object->uid.object_id, "remove", "object does not exist");
1567 }
1568}
1569
1571{
1572 for(OksClass::FList::const_iterator i = clist.begin(); i != clist.end(); ++i) {
1573 if(*i == c) return;
1574 }
1575 clist.push_back(c);
1576}
1577
1578
1579void
1581{
1582 if(p_super_classes) {
1583 for(std::list<std::string *>::const_iterator i = p_super_classes->begin(); i != p_super_classes->end(); ++i) {
1584 if(OksClass * c = p_kernel->find_class(**i)) {
1585 c->add_super_classes(clist);
1586 add_if_not_found(*clist, c);
1587 }
1588 else {
1589 throw oks::CannotFindSuperClass(*this, **i);
1590 }
1591 }
1592 }
1593}
1594
1595
1596void
1598{
1600 else p_all_super_classes->clear();
1601
1603
1604#ifndef ERS_NO_DEBUG
1605 if(ers::debug_level() >= 5) {
1606 std::ostringstream text;
1607 text << "found " << p_all_super_classes->size() << " superclass(es) in class \'" << get_name() << "\':\n";
1608 if(p_all_super_classes->size()) {
1609 for(FList::iterator i = p_all_super_classes->begin(); i != p_all_super_classes->end(); ++i) {
1610 text << " - class \'" << (*i)->get_name() << "\'\n";
1611 }
1612 }
1613
1614 TLOG_DEBUG(5) << text.str();
1615 }
1616#endif
1617}
1618
1619
1620void
1622{
1624 else p_all_sub_classes->clear();
1625
1626 if(!p_kernel->p_classes.empty()) {
1627 for(Map::iterator i = p_kernel->p_classes.begin(); i != p_kernel->p_classes.end(); ++i) {
1628 OksClass *c = i->second;
1629
1630 if(const FList* scl = c->p_all_super_classes) {
1631 for(FList::const_iterator j = scl->begin(); j != scl->end(); ++j) {
1632 if(*j == this) { p_all_sub_classes->push_back(c); break; }
1633 }
1634 }
1635 }
1636 }
1637}
1638
1639
1640inline const char *
1642{
1643 return (v ? "multi-value" : "single-value");
1644}
1645
1646 // skip differency between enum and string
1647
1648inline bool
1650{
1651 static const std::string __enum_str__("enum");
1652 static const std::string __string_str__("string");
1653
1654 const std::string& s1 = a1->get_type();
1655 const std::string& s2 = a2->get_type();
1656
1657 return (
1658 !((s1 == s2) || ((s1 == __enum_str__ && s2 == __string_str__) || (s1 == __string_str__ && s2 == __enum_str__)))
1659 );
1660}
1661
1662void
1664{
1665 if(p_attributes)
1666 for(const auto& x : *p_attributes)
1667 x->set_init_data();
1668
1669 if(!p_all_attributes) p_all_attributes = new std::list<OksAttribute *>();
1670 else p_all_attributes->clear();
1671
1673 for(FList::iterator i = p_all_super_classes->begin(); i != p_all_super_classes->end(); ++i) {
1674 OksClass * c(*i);
1675 if(c->p_attributes) {
1676 for(std::list<OksAttribute *>::iterator i2 = c->p_attributes->begin(); i2 != c->p_attributes->end(); ++i2) {
1677 OksAttribute * a(*i2);
1680 if( a1 == 0 && a2 == 0 ) {
1681 p_all_attributes->push_back(a);
1682 }
1683 else if( !p_kernel->p_silence ) {
1684 if(a1) {
1685 TLOG_DEBUG(1) << "in class \'" << get_name() << "\' direct attribute \'" << a1->get_name() <<
1686 "\' overrides one coming from superclass \'" << a->p_class->get_name() << '\'';
1687 if(are_types_different(a1, a)) {
1688 Oks::warning_msg("OksClass::create_attributes()")
1689 << " found attribute \'" << a->get_name() << "\' types conflict in class \'" << get_name() << "\':\n"
1690 << " type of attribute in superclass \'" << a->p_class->get_name() << "\' is \'" << a->get_type() << "\'\n"
1691 << " type of attribute in class \'" << get_name() << "\' is \'" << a1->get_type() << "\'\n";
1692 }
1693
1694 if(a1->get_is_multi_values() != a->get_is_multi_values()) {
1695 Oks::warning_msg("OksClass::create_attributes()")
1696 << " found attribute \'" << a->get_name() << "\' types conflict in class \'" << get_name() << "\':\n"
1697 << " attribute in superclass \'" << a->p_class->get_name() << "\' is " << bool2value_type(a->get_is_multi_values()) << "\n"
1698 << " attribute in class \'" << get_name() << "\' is \'" << bool2value_type(a1->get_is_multi_values()) << "\'\n";
1699 }
1700 }
1701 else if(a2) {
1702 TLOG_DEBUG(1) << "in class \'" << get_name() << "\' attribute \'" << a2->get_name() <<
1703 "\' from superclass \'" << a2->p_class->get_name() << "\' overrides one coming from superclass \'" << a->p_class->get_name() << '\'';
1704 if(are_types_different(a2, a)) {
1705 Oks::warning_msg("OksClass::create_attributes()")
1706 << " found attribute \'" << a->get_name() << "\' types conflict in class \'" << get_name() << "\':\n"
1707 << " type of attribute in superclass \'" << a->p_class->get_name() << "\' is \'" << a->get_type() << "\'\n"
1708 << " type of attribute in superclass \'" << a2->p_class->get_name() << "\' is \'" << a2->get_type() << "\'\n";
1709 }
1710
1711 if(a2->get_is_multi_values() != a->get_is_multi_values()) {
1712 Oks::warning_msg("OksClass::create_attributes()")
1713 << " found attribute \'" << a->get_name() << "\' types conflict in class \'" << get_name() << "\':\n"
1714 << " attribute in superclass \'" << a->p_class->get_name() << "\' is " << bool2value_type(a->get_is_multi_values()) << "\n"
1715 << " attribute in superclass \'" << get_name() << "\' is \'" << bool2value_type(a2->get_is_multi_values()) << "\'\n";
1716 }
1717 }
1718 }
1719 }
1720 }
1721 }
1722 }
1723
1724 if(p_attributes) {
1725 for(std::list<OksAttribute *>::iterator i = p_attributes->begin(); i != p_attributes->end(); ++i) {
1726 p_all_attributes->push_back(*i);
1727 }
1728 }
1729}
1730
1731
1732
1733inline const char *
1735{
1736 return (cc == OksRelationship::One ? "one object" : "many objects");
1737}
1738
1739void
1741{
1742 if(!p_all_relationships ) p_all_relationships = new std::list<OksRelationship *>();
1743 else p_all_relationships->clear();
1744
1746 for(FList::iterator i = p_all_super_classes->begin(); i != p_all_super_classes->end(); ++i) {
1747 OksClass * c(*i);
1748 if(c->p_relationships) {
1749 for(std::list<OksRelationship *>::iterator i2 = c->p_relationships->begin(); i2 != c->p_relationships->end(); ++i2) {
1750 OksRelationship * r = *i2;
1751 OksRelationship * r1 = find_direct_relationship(r->get_name());
1752 OksRelationship * r2 = find_relationship(r->get_name());
1753
1754 if(!r->p_class_type) { r->p_class_type = p_kernel->find_class(r->p_rclass); }
1755
1756 if( r1 == 0 && r2 == 0) {
1757 p_all_relationships->push_back(r);
1758 }
1759 else {
1760 if(r1) {
1761 TLOG_DEBUG(1) << "in class \'" << get_name() << "\' direct relationship \'" << r1->get_name() <<
1762 "\' overrides one coming from superclass \'" << r->p_class->get_name() << '\'';
1763 if(r1->get_high_cardinality_constraint() != r->get_high_cardinality_constraint()) {
1764 Oks::warning_msg("OksClass::create_relationships()")
1765 << " found relationship \'" << r->get_name() << "\' cardinality conflict in class \'" << get_name() << "\':\n"
1766 << " relationship in superclass \'" << r->p_class->get_name() << "\' allows " << card2string(r->get_high_cardinality_constraint()) << "\n"
1767 << " relationship in class \'" << get_name() << "\' allows " << card2string(r1->get_high_cardinality_constraint()) << std::endl;
1768 }
1769 }
1770 else if(r2) {
1771 TLOG_DEBUG(1) << "in class \'" << get_name() << "\' relationship \'" << r2->get_name() <<
1772 "\' from superclass \'" << r2->p_class->get_name() << "\' overrides one coming from superclass \'" << r->p_class->get_name() << '\'';
1773 if(r2->get_high_cardinality_constraint() != r->get_high_cardinality_constraint()) {
1774 Oks::warning_msg("OksClass::create_relationships()")
1775 << " found relationship \'" << r->get_name() << "\' cardinality conflict in class \'" << get_name() << "\':\n"
1776 << " relationship in superclass \'" << r->p_class->get_name() << "\' allows " << card2string(r->get_high_cardinality_constraint()) << "\n"
1777 << " relationship in superclass \'" << r2->p_class->get_name() << "\' allows " << card2string(r2->get_high_cardinality_constraint()) << std::endl;
1778 }
1779 }
1780 }
1781 }
1782 }
1783 }
1784 }
1785
1786 if(p_relationships) {
1787 for(std::list<OksRelationship *>::iterator i = p_relationships->begin(); i != p_relationships->end(); ++i) {
1788 OksRelationship * r = *i;
1789
1790 if(!r->p_class_type) {
1791 r->p_class_type = p_kernel->find_class(r->p_rclass);
1792 }
1793
1794 p_all_relationships->push_back(r);
1795 }
1796 }
1797}
1798
1799
1800void
1802{
1803 if(!p_all_methods) p_all_methods = new std::list<OksMethod *>();
1804 else p_all_methods->clear();
1805
1807 for(FList::iterator i = p_all_super_classes->begin(); i != p_all_super_classes->end(); ++i) {
1808 std::list<OksMethod *>::iterator i2;
1809 if((*i)->p_methods) {
1810 for(i2 = (*i)->p_methods->begin(); i2 != (*i)->p_methods->end(); ++i2) {
1811 if(
1812 find_direct_method((*i2)->get_name()) == 0 &&
1813 find_method((*i2)->get_name()) == 0
1814 ) {
1815 p_all_methods->push_back(*i2);
1816 }
1817 }
1818 }
1819 }
1820 }
1821
1822 if(p_methods) {
1823 for(std::list<OksMethod *>::iterator i = p_methods->begin(); i != p_methods->end(); ++i) {
1824 p_all_methods->push_back(*i);
1825 }
1826 }
1827}
1828
1829
1830 // Updates the values of the instances of the class and all their subclasses
1831 // in case of a change of the attribute's type or multi values cardinality
1832
1833void
1835{
1837
1838 FList::iterator i;
1839 if(p_all_sub_classes) i = p_all_sub_classes->begin();
1840
1841 OksClass * c(this);
1842
1843 do {
1844 if(c->p_objects && !c->p_objects->empty()) {
1845 for(OksObject::Map::const_iterator i2 = c->p_objects->begin(); i2 != c->p_objects->end(); ++i2) {
1846 OksObject *o(i2->second);
1847 OksData newData;
1848 OksData *oldData = &o->data[((*(c->p_data_info))[a->p_name])->offset];
1849
1850 try {
1851 oldData->cvt(&newData, a);
1852 oldData->Clear();
1853 memcpy(static_cast<void *>(oldData), static_cast<void *>(&newData), sizeof(OksData));
1854 newData.Clear2(); // Do not free !
1855 }
1856 catch(oks::AttributeReadError & ex) {
1857 std::ostringstream text;
1858 text << "attribute \'" << a->get_name() << "\' change converting object " << o << ' ';
1859 throw oks::CannotRegisterClass(*this, text.str(), ex);
1860 }
1861 }
1862 }
1863 } while(p_all_sub_classes && i != p_all_sub_classes->end() && (c = *(i++)));
1864}
1865
1866
1867 // Updates the values of the instances of the class and all their subclasses
1868 // in case of a change of the relationship's class type or a cardinality
1869
1870void
1872{
1874
1875 FList::iterator i;
1876 if(p_all_sub_classes) i = p_all_sub_classes->begin();
1877
1878 OksClass * c(this);
1879
1880 do {
1881 if(c->p_objects && !c->p_objects->empty()) {
1882 for(OksObject::Map::const_iterator i2 = c->p_objects->begin(); i2 != c->p_objects->end(); ++i2) {
1883 OksObject *o(i2->second);
1884 OksData newData;
1885 OksData *oldData = &o->data[((*(c->p_data_info))[r->p_name])->offset];
1886
1887 oldData->ConvertTo(&newData, r);
1888 oldData->Clear();
1889 memcpy(static_cast<void *>(oldData), static_cast<void *>(&newData), sizeof(OksData));
1890 newData.Clear2(); // Do not free !
1891 }
1892 }
1893 } while(p_all_sub_classes && i != p_all_sub_classes->end() && (c = *(i++)));
1894}
1895
1896
1897void
1899{
1901
1902 OksDataInfo::Map * dInfo = new OksDataInfo::Map();
1903
1904 size_t dInfoLength = 0;
1905 bool thereAreChanges = false;
1906
1907 if(!p_all_attributes->empty()) {
1908 for(std::list<OksAttribute *>::iterator i = p_all_attributes->begin(); i != p_all_attributes->end(); ++i) {
1909 OksAttribute *a = *i;
1910 if(!thereAreChanges) {
1911 OksDataInfo::Map::const_iterator x = p_data_info->find(a->get_name());
1912 if( x == p_data_info->end() || x->second->attribute == nullptr || x->second->offset != dInfoLength || !(*(x->second->attribute) == *a) ) {
1913 thereAreChanges = true;
1914 }
1915 }
1916
1917 (*dInfo)[a->get_name()] = new OksDataInfo(dInfoLength++, a);
1918 }
1919 }
1920
1921 if(!p_all_relationships->empty()) {
1922 for(std::list<OksRelationship *>::iterator i = p_all_relationships->begin(); i != p_all_relationships->end(); ++i) {
1923 OksRelationship *r = *i;
1924 if(!thereAreChanges) {
1925 OksDataInfo::Map::const_iterator x = p_data_info->find(r->get_name());
1926 if( x == p_data_info->end() || x->second->relationship == nullptr || x->second->offset != dInfoLength || !(*(x->second->relationship) == *r) ) {
1927 thereAreChanges = true;
1928 }
1929 }
1930
1931 (*dInfo)[r->get_name()] = new OksDataInfo(dInfoLength++, r);
1932 }
1933 }
1934
1935 if(thereAreChanges == true) {
1936 if(p_objects && !p_objects->empty()) {
1937 for(OksObject::Map::const_iterator i = p_objects->begin(); i != p_objects->end(); ++i) {
1938 OksObject *o = (*i).second;
1939 OksData * data = new OksData[dInfoLength];
1940 size_t count = 0;
1941
1942 if(!p_all_attributes->empty()) {
1943 for(std::list<OksAttribute *>::iterator i2 = p_all_attributes->begin(); i2 != p_all_attributes->end(); ++i2) {
1944 OksAttribute * a = *i2;
1945
1946 OksDataInfo::Map::const_iterator x = p_data_info->find(a->get_name());
1947
1948 if(x != p_data_info->end() && x->second->attribute) {
1949 OksData *oldData(&o->data[x->second->offset]);
1950
1951 if(*(x->second->attribute) == *a) {
1952 memcpy(static_cast<void *>(&data[count++]), static_cast<void *>(oldData), sizeof(OksData));
1953 oldData->type = OksData::unknown_type;
1954 }
1955 else {
1956 try {
1957 oldData->cvt(&data[count++], a);
1958 }
1959 catch(oks::AttributeReadError & ex) {
1960 throw oks::AttributeConversionFailed(*a, o, ex);
1961 }
1962 }
1963 }
1964 }
1965 }
1966
1967 if(!p_all_relationships->empty()) {
1968 for(std::list<OksRelationship *>::iterator i2 = p_all_relationships->begin(); i2 != p_all_relationships->end(); ++i2) {
1969 OksRelationship *r = *i2;
1970
1971 OksDataInfo::Map::const_iterator x = p_data_info->find(r->get_name());
1972
1973 if(x != p_data_info->end() && x->second->relationship) {
1974 OksData *oldData = &o->data[x->second->offset];
1975
1976 if(*(x->second->relationship) == *r) {
1977 memcpy(static_cast<void *>(&data[count++]), static_cast<void *>(oldData), sizeof(OksData));
1978 oldData->type = OksData::unknown_type;
1979 }
1980 else
1981 oldData->ConvertTo(&data[count++], r);
1982 }
1983 }
1984 }
1985
1986 int n = p_instance_size;
1987 while(n--) o->data[n].Clear();
1988 delete o->data;
1989
1990 o->data = data;
1991 }
1992 }
1993 }
1994
1995 if(!p_data_info->empty()) {
1996 for(OksDataInfo::Map::iterator i = p_data_info->begin(); i != p_data_info->end(); ++i) {
1997 delete i->second;
1998 }
1999 }
2000
2001 delete p_data_info;
2002
2003 p_data_info = dInfo;
2004 p_instance_size = dInfoLength;
2005}
2006
2007
2008void
2009OksClass::registrate_class(bool skip_registered)
2010{
2012
2013 {
2015 if(!p_objects) {
2016 p_objects = new OksObject::Map( (p_abstract == false) ? 1024 : 1 );
2017 }
2018 }
2019
2020 if(!p_data_info->empty() && skip_registered) {
2021 TLOG_DEBUG(4) << "skip already registered " << get_name();
2022 return;
2023 }
2024
2025 try {
2030
2032 }
2033 catch(oks::exception& ex) {
2034 throw oks::CannotRegisterClass(*this, "", ex);
2035 }
2036}
2037
2038
2039void
2040OksClass::registrate_class_change(ChangeType changeType, const void *parameter, bool update_file)
2041{
2042 if(!p_kernel) return;
2043
2045
2046 try {
2047 if(update_file) p_file->set_updated();
2048
2049 FList superclasses;
2050
2051 if(changeType == ChangeSuperClassesList && !p_all_super_classes->empty())
2052 for(FList::iterator i2 = p_all_super_classes->begin(); i2 != p_all_super_classes->end(); ++i2) {
2053 superclasses.push_back(*i2);
2054 }
2055
2056 FList::iterator i;
2057 if(p_all_sub_classes) i = p_all_sub_classes->begin();
2058
2059 OksClass *c = this;
2060
2061 do {
2062 switch(changeType) {
2064 c->create_super_classes();
2065 c->create_attributes();
2066 c->create_relationships();
2067 c->create_methods();
2068 break;
2069
2071 c->create_attributes();
2072 break;
2073
2075 c->create_relationships();
2076 break;
2077
2078 case ChangeMethodsList:
2079 c->create_methods();
2080 break;
2081
2082 default:
2083 continue;
2084 }
2085
2086 if(changeType != ChangeMethodsList) c->registrate_instances();
2087 } while(p_all_sub_classes && i != p_all_sub_classes->end() && (c = *(i++)));
2088
2089
2090 if(changeType == ChangeSuperClassesList) {
2091 if(!p_all_super_classes->empty())
2092 for(FList::iterator i2 = p_all_super_classes->begin(); i2 != p_all_super_classes->end(); ++i2)
2093 if(find(superclasses.begin(), superclasses.end(), *i2) == superclasses.end()) {
2094 superclasses.push_back(*i2);
2095 }
2096
2097 for(FList::const_iterator i2 = superclasses.begin(); i2 != superclasses.end(); ++i2) {
2098 c = *i2;
2099
2100 if(p_kernel->is_dangling(c) || c->p_to_be_deleted) continue;
2101
2102 c->create_sub_classes();
2103
2105 (*OksClass::change_notify_fn)(c, ChangeSubClassesList, 0);
2106 }
2107 superclasses.clear();
2108 }
2109
2111 if(p_all_sub_classes) i = p_all_sub_classes->begin();
2112 c = this;
2113
2114 do (*OksClass::change_notify_fn)(c, changeType, parameter);
2115 while(p_all_sub_classes && i != p_all_sub_classes->end() && (c = *(i++)));
2116 }
2117 }
2118 catch(oks::exception& ex) {
2119 throw oks::CannotRegisterClass(*this, "change ", ex);
2120 }
2121}
2122
2123bool
2124OksClass::check_relationships(std::ostringstream & out, bool print_file_name) const noexcept
2125{
2126 bool found_problems = false;
2127
2128 if(const std::list<OksRelationship *> * rels = direct_relationships())
2129 {
2130 for(auto & x : *rels)
2131 {
2132 if(x->get_class_type() == nullptr)
2133 {
2134 if(found_problems == false)
2135 {
2136 found_problems = true;
2137 out << " * there are problems with class \"" << get_name() << '\"';
2138 if(print_file_name)
2139 {
2140 out << " from file \"" << get_file()->get_full_file_name() << '\"';
2141 }
2142 out << ":\n";
2143 }
2144
2145 out << " - class type \"" << x->get_type() << "\" of relationship \"" << x->get_name() << "\" is not loaded\n";
2146 }
2147 }
2148 }
2149
2150 return found_problems;
2151}
2152
2153} // namespace oks
2154} // namespace dunedaq
static std::string fill(const OksAttribute &a, const OksObject *o, const std::string &reason) noexcept
Definition class.cpp:48
Failed move item to file.
Definition kernel.hpp:281
static std::string fill(const OksClass &c, const std::string &reason) noexcept
Definition class.cpp:62
static std::string fill(const OksClass &c, const std::string &name) noexcept
Definition class.cpp:42
static std::string fill(const OksClass &c, const std::string &what, const std::string &reason) noexcept
Definition class.cpp:56
static std::string fill(const OksClass &c, const std::string &oid, const char *op, const std::string &reason) noexcept
Definition class.cpp:68
OKS attribute class.
bool get_is_multi_values() const noexcept
const std::string & get_type() const noexcept
Get attribute string type.
const std::string & get_name() const noexcept
out stream operator
The OKS class.
Definition class.hpp:205
OksKernel * p_kernel
Definition class.hpp:958
friend class OksMethod
Definition class.hpp:210
OksRelationship * find_direct_relationship(const std::string &name) const noexcept
Find direct relationship.
Definition class.cpp:1178
std::list< std::string * > * p_super_classes
Definition class.hpp:940
size_t number_of_objects() const noexcept
Definition class.cpp:1479
void set_file(OksFile *f, bool update_owner=true)
Move class to different file.
Definition class.cpp:291
bool check_relationships(std::ostringstream &out, bool print_file_name) const noexcept
Definition class.cpp:2124
OksObject::Map * p_objects
Definition class.hpp:963
static const char superclass_xml_attr[]
Definition class.hpp:1017
OksClass * find_super_class(const std::string &) const noexcept
Definition class.cpp:747
OksAttribute * find_direct_attribute(const std::string &name) const noexcept
Find direct attribute.
Definition class.cpp:1019
void(* NotifyFN)(OksClass *)
Definition class.hpp:928
void add_super_class(const std::string &name)
Definition class.cpp:883
void(* ChangeNotifyFN)(OksClass *, ChangeType, const void *)
Definition class.hpp:933
friend class OksAttribute
Definition class.hpp:208
static void destroy_list(T list)
Definition class.cpp:203
OksMethod * find_method(const std::string &name) const noexcept
Find method (search in this and base classes).
Definition class.cpp:1346
std::list< OksMethod * > * p_methods
Definition class.hpp:943
void registrate_class(bool skip_registered)
Definition class.cpp:2009
FList * p_all_sub_classes
Definition class.hpp:949
std::list< OksRelationship * > * p_relationships
Definition class.hpp:942
static NotifyFN create_notify_fn
Definition class.hpp:971
static void destroy_map(T map)
Definition class.cpp:216
std::list< OksAttribute * > * p_attributes
Definition class.hpp:941
void add_super_classes(FList *) const
Definition class.cpp:1580
std::string p_description
Definition class.hpp:939
std::list< OksRelationship * > * p_all_relationships
Definition class.hpp:951
static const char class_xml_tag[]
Definition class.hpp:1013
bool operator!=(const OksClass &) const
The not equal operator.
Definition class.cpp:367
OksRelationship * find_relationship(const std::string &name) const noexcept
Find relationship (search in this and base classes).
Definition class.cpp:1189
friend class OksRelationship
Definition class.hpp:209
static const char description_xml_attr[]
Definition class.hpp:1015
std::list< OksMethod * > * p_all_methods
Definition class.hpp:952
void swap(const OksAttribute *a1, const OksAttribute *a2)
Swap order of two attributes.
Definition class.cpp:1083
void registrate_class_change(ChangeType, const void *, bool=true)
Definition class.cpp:2040
friend class OksKernel
Definition class.hpp:207
std::list< OksClass *, boost::fast_pool_allocator< OksClass * > > FList
Definition class.hpp:240
void add(OksAttribute *a)
Add attribute.
Definition class.cpp:1057
void swap_super_classes(const std::string &c1, const std::string &c2)
Swap order of two superclasses.
Definition class.cpp:967
std::vector< OksClass * > * p_inheritance_hierarchy
Definition class.hpp:954
void registrate_relationship_change(OksRelationship *)
Definition class.cpp:1871
void save(OksXmlOutputStream &) const
Definition class.cpp:463
void set_is_abstract(bool abstract)
Set class abstract property.
Definition class.cpp:803
OksIndex::Map * p_indices
Definition class.hpp:964
static NotifyFN delete_notify_fn
Definition class.hpp:973
static const char is_abstract_xml_attr[]
Definition class.hpp:1016
void remove_super_class(const std::string &name)
Definition class.cpp:932
const std::string & get_name() const noexcept
Definition class.hpp:368
OksAttribute * find_attribute(const std::string &name) const noexcept
Find attribute (search in this and base classes).
Definition class.cpp:1031
std::string p_name
Definition class.hpp:938
const std::list< OksRelationship * > * direct_relationships() const noexcept
Definition class.hpp:595
void remove(const OksAttribute *a)
Remove attribute.
Definition class.cpp:1130
static ChangeNotifyFN change_notify_fn
Definition class.hpp:972
void set_description(const std::string &description)
Set class description.
Definition class.cpp:785
std::shared_mutex p_mutex
Definition class.hpp:966
OksClass * source_class(const OksAttribute *a) const noexcept
Get class owning given attribute.
Definition class.cpp:1167
static const char name_xml_attr[]
Definition class.hpp:1014
bool compare_without_methods(const OksClass &c) const noexcept
Definition class.cpp:313
OksClass(const std::string &name, OksKernel *kernel, bool transient=false)
Create OKS class.
Definition class.cpp:80
friend class OksObject
Definition class.hpp:206
OksObject * get_object(const std::string &id) const noexcept
Get object by ID.
Definition class.cpp:1526
void k_add(OksAttribute *a)
Kernel method to add attribute.
Definition class.cpp:1045
std::list< OksAttribute * > * p_all_attributes
Definition class.hpp:950
void registrate_attribute_change(OksAttribute *)
Definition class.cpp:1834
std::list< OksObject * > * create_list_of_all_objects() const noexcept
Get all objects of the class (including derived).
Definition class.cpp:1491
OksDataInfo::Map * p_data_info
Definition class.hpp:962
void lock_file(const char *)
Definition class.cpp:771
OksFile * get_file() const noexcept
Definition class.hpp:343
void k_add_super_class(const std::string &name)
Definition class.cpp:872
static void destroy(OksClass *c)
Destroy OKS class.
Definition class.cpp:176
OksMethod * find_direct_method(const std::string &name) const noexcept
Find direct method.
Definition class.cpp:1335
ChangeType
Information about class property changes.
Definition class.hpp:894
bool has_direct_super_class(const std::string &) const noexcept
Definition class.cpp:759
FList * p_all_super_classes
Definition class.hpp:948
Provides interface to the OKS XML schema and data files.
Definition file.hpp:345
OKS method class.
Definition method.hpp:158
const std::string & get_name() const noexcept
Definition method.hpp:201
OksObject describes instance of OksClass.
Definition object.hpp:841
std::map< const std::string *, OksObject *, SortById > SMap
Definition object.hpp:865
std::unordered_map< const std::string *, OksObject *, oks::hash_str, oks::equal_str > Map
Definition object.hpp:870
const std::string & get_name() const noexcept
CardinalityConstraint get_high_cardinality_constraint() const noexcept
Get relationship high cardinality constraint.
static std::ostream & warning_msg(const char *)
Definition kernel.cpp:568
static std::string fill(const char *op, const std::string &reason) noexcept
Definition class.cpp:74
virtual const char * what() const noexcept
double offset
#define OSK_PROFILING(FID, K)
Definition defs.hpp:102
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112
const char * bool2str(bool b) noexcept
Definition xml.hpp:28
bool str2bool(const char *s) noexcept
Definition xml.hpp:31
bool cmp_str1(const char *s1, const char s2[2])
Definition cstring.hpp:14
static void check_and_report_empty_parameter(const char *fname, bool b1, bool b2)
Definition class.cpp:823
bool cmp_str4(const char *s1, const char s2[5])
Definition cstring.hpp:34
bool cmp_str6(const char *s1, const char s2[7])
Definition cstring.hpp:50
bool are_types_different(const OksAttribute *a1, const OksAttribute *a2)
Definition class.cpp:1649
static void check_and_report_found_items(const char *fname, const char *item_type, const std::string &item1_name, const std::string &item2_name, const std::string &class_name, bool b1, bool b2)
Definition class.cpp:838
bool cmp_str10(const char *s1, const char s2[11])
Definition cstring.hpp:78
const char * bool2value_type(bool v)
Definition class.cpp:1641
bool cmp_str9(const char *s1, const char s2[10])
Definition cstring.hpp:74
static std::string add_super_class_error(const std::string &c1, const std::string &c2)
Definition class.cpp:865
const char * card2string(OksRelationship::CardinalityConstraint cc)
Definition class.cpp:1734
void validate_not_empty(const std::string &value, const char *name)
std::ostream & operator<<(std::ostream &s, const oks::exception &ex)
void add_if_not_found(OksClass::FList &clist, OksClass *c)
Definition class.cpp:1570
bool cmp_str11(const char *s1, const char s2[12])
Definition cstring.hpp:82
bool cmp_str12(const char *s1, const char s2[13])
Definition cstring.hpp:86
static std::string remove_super_class_error(const std::string &c1, const std::string &c2)
Definition class.cpp:926
Including Qt Headers.
Definition module.cpp:16
FELIX Initialization std::string initerror FELIX queue timed out
default char v[0]
int debug_level()
Definition ers.hpp:77
Definition ral.hpp:35
Struct OKS data information.
Definition object.hpp:347
std::map< std::string, OksDataInfo * > Map
Declare map of pointers to OksDataInfo (unsorted by name).
Definition object.hpp:351
the structure to pass common parameters to various read() methods of OksData and OksObject class
Definition object.hpp:454
void cvt(OksData *to, const OksAttribute *attr) const
Convert data to new type.
enum dunedaq::oks::OksData::Type type
void ConvertTo(OksData *, const OksRelationship *) const
size_t value_len() const
Definition xml.hpp:309
Factory couldn t find
Definition Issues.hpp:24