DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
oks_diff_schema.cxx
Go to the documentation of this file.
1//
2// DUNE DAQ modification notice:
3// This file has been modified from the original ATLAS oks_utils source for the DUNE DAQ project.
4// Fork baseline commit: c2e7dfc7 (2022-03-30).
5// Renamed since fork: yes (from src/bin/oks_diff_schema.cpp to apps/oks_diff_schema.cxx).
6//
7
34
35
36#include <fstream>
37
38#include "oks/attribute.hpp"
39#include "oks/relationship.hpp"
40#include "oks/method.hpp"
41#include "oks/kernel.hpp"
42#include "oks/class.hpp"
43
44using namespace dunedaq;
45using namespace dunedaq::oks;
46
49char * schemaFile1 = 0;
50char * schemaFile2 = 0;
51
52
53static void
55{
56 const OksClass::FList * clist = c->all_sub_classes();
57
58 if(clist && !clist->empty()) {
59 for(OksClass::FList::const_iterator i = clist->begin(); i != clist->end(); ++i)
60 std::cout << " " << (*i)->get_name() << std::endl;
61 }
62 else
63 std::cout << " no subclasses\n";
64}
65
66enum {
72};
73
74static void printUsage(std::ostream& s) {
75 s << "Usage: oks_diff_schema [-a] [-r] [-m] [-sb] [-all] [-h | --help] [-v] schema_file1 schema_file2\n"
76 "Options:\n"
77 " -a print details of attribute differences\n"
78 " -r print details of relationship differences\n"
79 " -m print details of method differences\n"
80 " -sb print all sub classes\n"
81 " -all the same as -a -r -m -sb\n"
82 " -v print version\n"
83 " -h | --help print this text\n"
84 "\n"
85 "Description:\n"
86 " Print out differences between two schema files.\n"
87 "\n"
88 "Return Status:\n"
89 " 0 - there are no differences between two schema files\n"
90 " " << __BadCommandLine__ << " - bad command line\n"
91 " " << __CannotReadFile__ << " - cannot load database file(s)\n"
92 " " << __ThereAreNoClasses__ << " - loaded file has no any class\n"
93 " 1.." << __StartOfBadStatus__ << " - number of differences (is limited by the max possible value)\n";
94}
95
96
97static void
98attributesTest(bool printAttributeDifferences, OksClass *c1, OksClass *c2)
99{
100 const std::list<OksAttribute *> * alist = c1->direct_attributes();
101 OksAttribute *a1, *a2;
102
103 if(alist) {
104 for(std::list<OksAttribute *>::const_iterator ai = alist->begin(); ai != alist->end(); ++ai) {
105 OksAttribute *a1 = *ai;
106 const std::string& attributeName = a1->get_name();
107
108 if( !(a2 = c2->find_attribute(attributeName)) ) {
109 std::cout << " " << classDiffsCount << '.' << ++localDiffsCount
110 << " There is no attribute \"" << attributeName << "\" defined in the \"" << schemaFile2 << "\" database file.\n";
111
112 continue;
113 }
114
115 if(!(*a1 == *a2)) {
116 std::cout << " " << classDiffsCount << '.' << ++localDiffsCount
117 << " The ATTRIBUTE \"" << attributeName << "\" differed";
118
119 if(!printAttributeDifferences)
120 std::cout << ".\n";
121 else {
122 int localAttrCount = 0;
123
124 const char * szTheAttribute = " The Attribute ";
125 const char * szMultiValues = "multi-values";
126 const char * szSingleValues = "single-value";
127 const char * szItCan = "\" it can ";
128 const char * szNot = "not ";
129 const char * szBeNull = "be null\n";
130
131 std::cout << ":\n";
132
133 if(a1->get_type() != a2->get_type())
134 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
135 << szTheAttribute << "Types differed: \n"
136 << " in the FILE \"" << schemaFile1 << "\" it is: \"" << a1->get_type() << "\"\n"
137 << " in the FILE \"" << schemaFile2 << "\" it is: \"" << a2->get_type() << "\"\n";
138
139 if(a1->get_range() != a2->get_range())
140 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
141 << szTheAttribute << "Ranges differed: \n"
142 << " in the FILE \"" << schemaFile1 << "\" it is: \"" << a1->get_range() << "\"\n"
143 << " in the FILE \"" << schemaFile2 << "\" it is: \"" << a2->get_range() << "\"\n";
144
146 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
147 << szTheAttribute << "Cardinality differed: \n"
148 << " in the FILE \"" << schemaFile1 << "\" it is: \"" << (a1->get_is_multi_values() ? szMultiValues : szSingleValues) << "\"\n"
149 << " in the FILE \"" << schemaFile2 << "\" it is: \"" << (a2->get_is_multi_values() ? szMultiValues : szSingleValues) << "\"\n";
150
151 if(a1->get_init_value() != a2->get_init_value())
152 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
153 << szTheAttribute << "Initial Values differed: \n"
154 << " in the FILE \"" << schemaFile1 << "\" it is: \"" << a1->get_init_value() << "\"\n"
155 << " in the FILE \"" << schemaFile2 << "\" it is: \"" << a2->get_init_value() << "\"\n";
156
157 if(a1->get_description() != a2->get_description())
158 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
159 << szTheAttribute << "Descriptions differed: \n"
160 << " in the FILE \"" << schemaFile1 << "\" it is: \"" << a1->get_description() << "\"\n"
161 << " in the FILE \"" << schemaFile2 << "\" it is: \"" << a2->get_description() << "\"\n";
162
163 if(a1->get_is_no_null() != a2->get_is_no_null())
164 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
165 << szTheAttribute << "Constraints differed: \n"
166 << " in the FILE \"" << schemaFile1 << szItCan << (a1->get_is_no_null() ? szNot : "") << szBeNull
167 << " in the FILE \"" << schemaFile2 << szItCan << (a2->get_is_no_null() ? szNot : "") << szBeNull;
168 }
169 }
170 }
171 }
172
173 alist = c2->direct_attributes();
174
175 if(alist) {
176 for(std::list<OksAttribute *>::const_iterator ai = alist->begin(); ai != alist->end(); ++ai) {
177 OksAttribute *a2 = *ai;
178 const std::string & attributeName = a2->get_name();
179 if( !(a1 = c1->find_attribute(attributeName)) ) {
180 std::cout << " " << classDiffsCount << '.' << ++localDiffsCount
181 << " There is no attribute \"" << attributeName << "\" defined in the \"" << schemaFile1 << "\" database file.\n";
182 continue;
183 }
184 }
185 }
186}
187
188
189static void
190relationshipsTest(bool printRelationshipDifferences, OksClass *c1, OksClass *c2)
191{
192 const char *szRELATIONSHIP = "RELATIONSHIP ";
193
194 const std::list<OksRelationship *> * rlist = c1->direct_relationships();
195 OksRelationship *r1, *r2;
196
197 if(rlist) {
198 for(std::list<OksRelationship *>::const_iterator ri = rlist->begin(); ri != rlist->end(); ++ri) {
199 OksRelationship *r1 = *ri;
200 const std::string & relationshipName = r1->get_name();
201
202 if( !(r2 = c2->find_relationship(relationshipName)) ) {
203 std::cout << " " << classDiffsCount << '.' << ++localDiffsCount
204 << " There is no " << szRELATIONSHIP << "\"" << relationshipName << "\" defined in the \"" << schemaFile2 << "\" database file.\n" ;
205
206 continue;
207 }
208
209 if(!(*r1 == *r2)) {
210 std::cout << " " << classDiffsCount << '.' << ++localDiffsCount
211 << " The " << szRELATIONSHIP << "\"" << relationshipName << "\" differed";
212 if(!printRelationshipDifferences)
213 std::cout << ".\n";
214 else {
215 int localAttrCount = 0;
216
217 const char * szTheRelationship = " The Relationship ";
218 const char * szReference = " reference\n";
219 const char * szZero = "Zero";
220 const char * szOne = "One";
221 const char * szMany = "Many";
222 const char * szComposite = "composite";
223 const char * szWeak = "weak";
224 const char * szExclusive = "exclusive";
225 const char * szShared = "shared";
226 const char * szDependent = "dependent";
227 const char * szIndependent = "independent";
228
229
230 std::cout << ":\n";
231
232 if(r1->get_type() != r2->get_type())
233 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
234 << szTheRelationship << "Class Types differed: \n"
235 << " in the FILE \"" << schemaFile1 << "\" it is: \"" << r1->get_type() << "\"\n"
236 << " in the FILE \"" << schemaFile2 << "\" it is: \"" << r2->get_type() << "\"\n";
237
238 if(r1->get_description() != r2->get_description())
239 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
240 << szTheRelationship << "Descriptions differed: \n"
241 << " in the FILE \"" << schemaFile1 << "\" it is: \"" << r1->get_description() << "\"\n"
242 << " in the FILE \"" << schemaFile2 << "\" it is: \"" << r2->get_description() << "\"\n";
243
245 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
246 << szTheRelationship << "Low Cardinality Constraint differed: \n"
247 << " in the FILE \"" << schemaFile1 << "\" it is: \"" << (r1->get_low_cardinality_constraint() == OksRelationship::Zero ? szZero : (r1->get_low_cardinality_constraint() == OksRelationship::One ? szOne : szMany)) << "\"\n"
248 << " in the FILE \"" << schemaFile2 << "\" it is: \"" << (r2->get_low_cardinality_constraint() == OksRelationship::Zero ? szZero : (r2->get_low_cardinality_constraint() == OksRelationship::One ? szOne : szMany)) << "\"\n";
249
251 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
252 << szTheRelationship << "High Cardinality Constraint differed: \n"
253 << " in the FILE \"" << schemaFile1 << "\" it is: \"" << (r1->get_high_cardinality_constraint() == OksRelationship::Zero ? szZero : (r1->get_high_cardinality_constraint() == OksRelationship::One ? szOne : szMany)) << "\"\n"
254 << " in the FILE \"" << schemaFile2 << "\" it is: \"" << (r2->get_high_cardinality_constraint() == OksRelationship::Zero ? szZero : (r2->get_high_cardinality_constraint() == OksRelationship::One ? szOne : szMany)) << "\"\n";
255
256 if(r1->get_is_composite() != r2->get_is_composite())
257 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
258 << szTheRelationship << "Composite Types differed: \n"
259 << " in the FILE \"" << schemaFile1 << "\" it is " << (r1->get_is_composite() ? szComposite : szWeak) << szReference
260 << " in the FILE \"" << schemaFile2 << "\" it is " << (r2->get_is_composite() ? szComposite : szWeak) << szReference;
261
262 if(r1->get_is_exclusive() != r2->get_is_exclusive())
263 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
264 << szTheRelationship << "Composite Exclusive Types differed: \n"
265 << " in the FILE \"" << schemaFile1 << "\" it is " << (r1->get_is_exclusive() ? szExclusive : szShared) << szReference
266 << " in the FILE \"" << schemaFile2 << "\" it is " << (r2->get_is_exclusive() ? szExclusive : szShared) << szReference;
267
268 if(r1->get_is_dependent() != r2->get_is_dependent())
269 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
270 << szTheRelationship << "Composite Dependent Types differed: \n"
271 << " in the FILE \"" << schemaFile1 << "\" it is " << (r1->get_is_dependent() ? szDependent : szIndependent) << szReference
272 << " in the FILE \"" << schemaFile2 << "\" it is " << (r2->get_is_dependent() ? szDependent : szIndependent) << szReference;
273 }
274 }
275 }
276 }
277
278
279 rlist = c2->direct_relationships();
280
281 if(rlist) {
282 for(std::list<OksRelationship *>::const_iterator ri = rlist->begin(); ri != rlist->end(); ++ri) {
283 OksRelationship *r2 = *ri;
284 const std::string & relationshipName = r2->get_name();
285
286 if( !(r1 = c1->find_relationship(relationshipName)) ) {
287 std::cout << " " << classDiffsCount << '.' << ++localDiffsCount
288 << " There is no " << szRELATIONSHIP << "\"" << relationshipName << "\" defined in the \"" << schemaFile1 << "\" database file.\n";
289
290 continue;
291 }
292 }
293 }
294}
295
296
297static void
298methodsTest(bool printMethodDifferences, OksClass *c1, OksClass *c2)
299{
300 const std::list<OksMethod *> * mlist = c1->direct_methods();
301 OksMethod *m1, *m2;
302
303 if(mlist) {
304 for(std::list<OksMethod *>::const_iterator mi = mlist->begin(); mi != mlist->end(); ++mi) {
305 OksMethod *m1 = *mi;
306 const std::string & methodName = m1->get_name();
307
308 if( !(m2 = c2->find_method(methodName)) ) {
309 std::cout << " " << classDiffsCount << '.' << ++localDiffsCount
310 << " There is no METHOD \"" << methodName << "\" defined in the \"" << schemaFile2 << "\" database file.\n";
311
312 continue;
313 }
314
315 if(!(*m1 == *m2)) {
316 std::cout << " " << classDiffsCount << '.' << ++localDiffsCount
317 << " The METHOD \"" << methodName << "\" differed";
318
319 if(!printMethodDifferences)
320 std::cout << ".\n";
321 else {
322 int localAttrCount = 0;
323 const char * szTheMethod = " The Method ";
324
325 std::cout << ":\n";
326
327 if(m1->get_description() != m2->get_description())
328 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
329 << szTheMethod << "Description differed: \n"
330 << " in the FILE \"" << schemaFile1 << "\" it is: \"" << m1->get_description() << "\"\n"
331 << " in the FILE \"" << schemaFile2 << "\" it is: \"" << m2->get_description() << "\"\n";
332
333
334 const std::list<OksMethodImplementation *> * m1i = m1->implementations();
335 const std::list<OksMethodImplementation *> * m2i = m2->implementations();
336
337 if(m1i || m2i) {
338 if(m2i == 0) {
339 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
340 << szTheMethod << "Implementations differed: \n"
341 << " in the FILE \"" << schemaFile1 << "\" it has implementations\n"
342 << " in the FILE \"" << schemaFile2 << "\" it has no implementations\n";
343 }
344 else if(m1i == 0) {
345 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
346 << szTheMethod << "Implementations differed: \n"
347 << " in the FILE \"" << schemaFile1 << "\" it has no implementations\n"
348 << " in the FILE \"" << schemaFile2 << "\" it has implementations\n";
349 }
350 else if(m1i->size() != m2i->size()) {
351 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
352 << szTheMethod << "Implementations differed: \n"
353 << " in the FILE \"" << schemaFile1 << "\" it has " << m1i->size() << " implementations\n"
354 << " in the FILE \"" << schemaFile2 << "\" it has " << m2i->size() << " implementations\n";
355 }
356 else {
357 std::list<OksMethodImplementation *>::const_iterator m1it = m1i->begin();
358 std::list<OksMethodImplementation *>::const_iterator m2it = m2i->begin();
359 unsigned int icount = 0;
360 for(;m1it != m1i->end(); ++m1it, ++m2it) {
361 icount++;
362 OksMethodImplementation * i1 = *m1it;
363 OksMethodImplementation * i2 = *m2it;
364
365 if(i1->get_language() != i2->get_language()) {
366 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
367 << szTheMethod << "Implementations " << icount << " differed: \n"
368 << " in the FILE \"" << schemaFile1 << "\" it's language is \"" << i1->get_language() << "\"\n"
369 << " in the FILE \"" << schemaFile2 << "\" it's language is \"" << i2->get_language() << "\"\n";
370
371 }
372
373 if(i1->get_prototype() != i2->get_prototype()) {
374 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
375 << szTheMethod << "Implementations " << icount << " differed: \n"
376 << " in the FILE \"" << schemaFile1 << "\" it's prototype is \"" << i1->get_prototype() << "\"\n"
377 << " in the FILE \"" << schemaFile2 << "\" it's prototype is \"" << i2->get_prototype() << "\"\n";
378
379 }
380
381 if(i1->get_body() != i2->get_body()) {
382 std::cout << " " << classDiffsCount << '.' << localDiffsCount << '.' << ++localAttrCount
383 << szTheMethod << "Implementations " << icount << " differed: \n"
384 << " in the FILE \"" << schemaFile1 << "\" it's body is \"" << i1->get_body() << "\"\n"
385 << " in the FILE \"" << schemaFile2 << "\" it's body is \"" << i2->get_body() << "\"\n";
386
387 }
388 }
389 }
390 }
391 }
392 }
393 }
394 }
395
396
397 mlist = c2->direct_methods();
398
399 if(mlist) {
400 for(std::list<OksMethod *>::const_iterator mi = mlist->begin(); mi != mlist->end(); ++mi) {
401 OksMethod *m2 = *mi;
402 const std::string & methodName = m2->get_name();
403 if( !(m1 = c1->find_method(methodName)) ) {
404 std::cout << " " << classDiffsCount << '.' << ++localDiffsCount
405 << " There is no METHOD \"" << methodName << "\" defined in the \"" << schemaFile1 << "\" database file.\n";
406
407 continue;
408 }
409 }
410 }
411}
412
413
414int main(int argc, char **argv)
415{
416 bool printAttributeDifferences = false;
417 bool printRelationshipDifferences = false;
418 bool printMethodDifferences = false;
419 bool printSubClasses = false;
420
421 if(argc == 1) {
422 printUsage(std::cerr);
423 return __BadCommandLine__;
424 }
425
426 for(int i = 1; i < argc; i++) {
427 if(!strcmp(argv[i], "-a"))
428 printAttributeDifferences = true;
429 else if(!strcmp(argv[i], "-r"))
430 printRelationshipDifferences = true;
431 else if(!strcmp(argv[i], "-m"))
432 printMethodDifferences = true;
433 else if(!strcmp(argv[i], "-sb"))
434 printSubClasses = true;
435 else if(!strcmp(argv[i], "-all")) {
436 printAttributeDifferences = true;
437 printRelationshipDifferences = true;
438 printMethodDifferences = true;
439 printSubClasses = true;
440 }
441 else if(!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
442 printUsage(std::cout);
443 return __Success__;
444 }
445 else if(!strcmp(argv[i], "-v")) {
446 std::cout << "OKS kernel version " << OksKernel::GetVersion() << std::endl;
447 return __Success__;
448 }
449 else if(argc == (i + 2) && argv[i][0] != '-' && argv[i+1][0] != '-') {
450 schemaFile1 = argv[i++];
451 schemaFile2 = argv[i++];
452 }
453 else {
454 std::cerr << "Unknown parameter: \"" << argv[i] << "\"\n\n";
455
456 printUsage(std::cerr);
457 return __BadCommandLine__;
458 }
459 }
460
461
462 OksKernel kernel1;
463 OksKernel kernel2;
464
465 try {
466
467 const char *szNoClasses = " No classes were found in \"";
468 const char *szExiting = ", exiting ...\n";
469
470 kernel1.load_file(schemaFile1);
471 kernel2.load_file(schemaFile2);
472
473 const OksClass::Map& classes1 = kernel1.classes();
474 const OksClass::Map& classes2 = kernel2.classes();
475
476 if(classes1.empty()) {
477 std::cerr << "ERROR:" << szNoClasses << schemaFile1 << "\" database file" << szExiting;
479 }
480
481 if(classes2.empty()) {
482 std::cerr << "ERROR:" << szNoClasses << schemaFile2 << "\" database file" << szExiting;
484 }
485
486 OksClass::Map::const_iterator class_iterator1 = classes1.begin();
487 OksClass::Map::const_iterator class_iterator2 = classes2.begin();
488
489 std::cout << std::endl;
490
491
492 classDiffsCount = 0;
493
494 OksClass *c1, *c2;
495
496 for(;class_iterator1 != classes1.end();++class_iterator1) {
497 c1 = class_iterator1->second;
498 const std::string& className = c1->get_name();
499
500 if(!(c2 = kernel2.find_class(className))) {
501 std::cout << "\n DIFFERENCE " << ++classDiffsCount << ". There is no class \"" << className << "\" in the \"" << schemaFile2 << "\" database file.\n";
502
503 continue;
504 }
505
506 std::cout << "TESTING IN CLASSES \"" << className << "\"... ";
507 std::cout.flush();
508
509
510 //
511 // Operators '==' and '!=' have completly different implementation:
512 // - operator== is optimised for performance and
513 // checks addresses of classes and their names only
514 // - operator!= checks all class properties
515 //
516
517 if((*c1 != *c2) == false) {
518 std::cout << " no differences were found\n";
519 continue;
520 }
521
522 std::cout << std::endl << " DIFFERENCE " << ++classDiffsCount << '.'
523 << " The CLASSES \"" << className << "\" differed:\n";
524
525 localDiffsCount = 0;
526
527 attributesTest(printAttributeDifferences, c1, c2);
528 relationshipsTest(printRelationshipDifferences, c1, c2);
529 methodsTest(printMethodDifferences, c1, c2);
530
531 if(c1->get_description() != c2->get_description()) {
532 std::cout << " " << classDiffsCount << '.' << ++localDiffsCount
533 << " The Class Descriptions differed: \n"
534 << " in the FILE \"" << schemaFile1 << "\" it is: \"" << c1->get_description() << "\"\n"
535 << " in the FILE \"" << schemaFile2 << "\" it is: \"" << c2->get_description() << "\"\n";
536 }
537
538 if(c1->get_is_abstract() != c2->get_is_abstract()) {
539 std::cout << " " << classDiffsCount << '.' << ++localDiffsCount
540 << " The Class Abstraction differed: \n"
541 << " in the FILE \"" << schemaFile1 << "\" it is: \"" << (c1->get_is_abstract() ? "abstract" : "not abstract") << "\"\n"
542 << " in the FILE \"" << schemaFile2 << "\" it is: \"" << (c2->get_is_abstract() ? "abstract" : "not abstract") << "\"\n";
543 }
544
545
546 { /* DIRECT SUPERCLASSES TEST */
547
548 const std::list<std::string *> * slist = c1->direct_super_classes();
549 const std::string *spn;
550
551 if(slist) {
552 for(std::list<std::string *>::const_iterator spi = slist->begin(); spi != slist->end(); ++spi) {
553 spn = *spi;
554 if( !c2->find_super_class(*spn) ) {
555 std::cout << " " << classDiffsCount << '.' << ++localDiffsCount
556 << " There is no SUPERCLASS \"" << *spn << "\" defined in the \"" << schemaFile2 << "\" database file.\n";
557
558 continue;
559 }
560 }
561 }
562
563 slist = c2->direct_super_classes();
564
565 if(slist) {
566 for(std::list<std::string *>::const_iterator spi = slist->begin(); spi != slist->end(); ++spi) {
567 spn = *spi;
568 if( !c1->find_super_class(*spn) ) {
569 std::cout << " " << classDiffsCount << '.' << ++localDiffsCount
570 << " There is no SUPERCLASS \"" << *spn << "\" defined in the \"" << schemaFile1 << "\" database file.\n";
571
572 continue;
573 }
574 }
575 }
576 } /* END OF DIRECT SUPERCLASSES TEST */
577
578
579 if(printSubClasses) {
580 std::cout << " ALL SUBCLASS(ES) of the CLASS \"" << className << "\"\n";
581 std::cout << " in the FILE \"" << schemaFile1 << "\"\n"; ReportSubClasses(c1);
582 std::cout << " in the FILE \"" << schemaFile2 << "\"\n"; ReportSubClasses(c2);
583 }
584 }
585
586 for(;class_iterator2 != classes2.end();++class_iterator2) {
587 if(!kernel1.find_class(class_iterator2->second->get_name())) {
588 std::cout << "\n DIFFERENCE " << ++classDiffsCount << ". There is no class \"" << class_iterator2->second->get_name() << "\" in the \"" << schemaFile1 << "\" database file.\n";
589 }
590 }
591
592 std::cout << "\nFound " << classDiffsCount << " differences, exiting...\n";
593 }
594
595 catch (oks::exception & ex) {
596 std::cerr << "Caught oks exception:\n" << ex << std::endl;
597 return __CannotReadFile__;
598 }
599
600 catch (std::exception & e) {
601 std::cerr << "Caught standard C++ exception: " << e.what() << std::endl;
602 return __CannotReadFile__;
603 }
604
606}
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_range() const noexcept
Get attribute range.
const std::string & get_name() const noexcept
out stream operator
const std::string & get_init_value() const noexcept
const std::string & get_description() const noexcept
bool get_is_no_null() const noexcept
The OKS class.
Definition class.hpp:205
bool get_is_abstract() const noexcept
Definition class.hpp:389
OksClass * find_super_class(const std::string &) const noexcept
Definition class.cpp:747
OksMethod * find_method(const std::string &name) const noexcept
Find method (search in this and base classes).
Definition class.cpp:1346
OksRelationship * find_relationship(const std::string &name) const noexcept
Find relationship (search in this and base classes).
Definition class.cpp:1189
std::list< OksClass *, boost::fast_pool_allocator< OksClass * > > FList
Definition class.hpp:240
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
const std::list< OksRelationship * > * direct_relationships() const noexcept
Definition class.hpp:595
const std::string & get_description() const noexcept
Definition class.hpp:373
const std::list< OksMethod * > * direct_methods() const noexcept
Definition class.hpp:707
std::map< const char *, OksClass *, SortStr > Map
Definition class.hpp:238
const std::list< OksAttribute * > * direct_attributes() const noexcept
Definition class.hpp:485
const std::list< std::string * > * direct_super_classes() const noexcept
Definition class.hpp:418
Provides interface to the OKS kernel.
Definition kernel.hpp:582
OksFile * load_file(const std::string &name, bool bind=true)
Load OKS database file.
Definition kernel.cpp:1793
const OksClass::Map & classes() const
Get classes.
Definition kernel.hpp:1772
static const char * GetVersion()
Get OKS version. The method returns string containing CVS tag and date of OKS build.
Definition kernel.cpp:302
OksClass * find_class(const std::string &class_name) const
Find class by name (C++ string).
Definition kernel.hpp:1819
OKS method implementation class.
Definition method.hpp:40
const std::string & get_body() const noexcept
Definition method.hpp:104
const std::string & get_language() const noexcept
Definition method.hpp:68
const std::string & get_prototype() const noexcept
Definition method.hpp:87
OKS method class.
Definition method.hpp:158
const std::string & get_description() const noexcept
Definition method.hpp:219
const std::list< OksMethodImplementation * > * implementations() const noexcept
Definition method.hpp:235
const std::string & get_name() const noexcept
Definition method.hpp:201
bool get_is_exclusive() const noexcept
bool get_is_composite() const noexcept
bool get_is_dependent() const noexcept
const std::string & get_name() const noexcept
CardinalityConstraint get_high_cardinality_constraint() const noexcept
Get relationship high cardinality constraint.
const std::string & get_description() const noexcept
CardinalityConstraint get_low_cardinality_constraint() const noexcept
Get relationship low cardinality constraint.
const std::string & get_type() const noexcept
Including Qt Headers.
Definition module.cpp:16
static void relationshipsTest(bool printRelationshipDifferences, OksClass *c1, OksClass *c2)
char * schemaFile1
static void ReportSubClasses(OksClass *c)
int main(int argc, char **argv)
char * schemaFile2
static void methodsTest(bool printMethodDifferences, OksClass *c1, OksClass *c2)
int classDiffsCount
@ __CannotReadFile__
@ __BadCommandLine__
@ __ThereAreNoClasses__
@ __StartOfBadStatus__
@ __Success__
static void attributesTest(bool printAttributeDifferences, OksClass *c1, OksClass *c2)
static void printUsage(std::ostream &s)
int localDiffsCount