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