comparison CodeGeneration/ParseOrthancSDK.py @ 38:f8e664baa9dd

improved statistics in ParseOrthancSDK.py
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 03 Jul 2024 12:10:43 +0200
parents 15dc698243ac
children
comparison
equal deleted inserted replaced
37:14af12f73fb5 38:f8e664baa9dd
430 path = node.location.file.name 430 path = node.location.file.name
431 if os.path.split(path) [-1] != 'OrthancCPlugin.h': 431 if os.path.split(path) [-1] != 'OrthancCPlugin.h':
432 continue 432 continue
433 433
434 if (node.kind == clang.cindex.CursorKind.FUNCTION_DECL and 434 if (node.kind == clang.cindex.CursorKind.FUNCTION_DECL and
435 node.spelling.startswith('OrthancPlugin') and 435 node.spelling.startswith('OrthancPlugin')):
436 not node.spelling in SPECIAL_FUNCTIONS): 436
437 if node.spelling in SPECIAL_FUNCTIONS:
438 countAllFunctions += 1
439 continue
440
437 args = list(filter(lambda x: x.kind == clang.cindex.CursorKind.PARM_DECL, 441 args = list(filter(lambda x: x.kind == clang.cindex.CursorKind.PARM_DECL,
438 node.get_children())) 442 node.get_children()))
439 443
440 # Check that the first argument is the Orthanc context 444 # Check that the first argument is the Orthanc context
441 if (len(args) == 0 or 445 if (len(args) == 0 or
548 552
549 with open(TARGET, 'w') as f: 553 with open(TARGET, 'w') as f:
550 f.write(json.dumps(codeModel, sort_keys = True, indent = 4)) 554 f.write(json.dumps(codeModel, sort_keys = True, indent = 4))
551 555
552 print('\nTotal functions in the SDK: %d' % countAllFunctions) 556 print('\nTotal functions in the SDK: %d' % countAllFunctions)
553 print('Total wrapped functions: %d' % countWrappedFunctions) 557 print('Total wrapped functions (including destructors): %d' % countWrappedFunctions)
554 print('Coverage: %.0f%%' % (float(countWrappedFunctions) / 558 print('Coverage: %.0f%%' % (float(countWrappedFunctions) /
555 float(countAllFunctions) * 100.0)) 559 float(countAllFunctions) * 100.0))