changeset 204:65ad095c25d8

report statistics in GenerateOrthancSDK.py
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 03 Jul 2024 12:21:32 +0200
parents 28531e615104
children 234681297600
files CodeAnalysis/GenerateOrthancSDK.py
diffstat 1 files changed, 24 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/CodeAnalysis/GenerateOrthancSDK.py	Wed Jul 03 12:03:09 2024 +0200
+++ b/CodeAnalysis/GenerateOrthancSDK.py	Wed Jul 03 12:21:32 2024 +0200
@@ -380,6 +380,8 @@
 
 classes = []
 
+countDestructors = 0
+
 for c in model['classes']:
     methods = []
 
@@ -406,6 +408,7 @@
     })
 
     if 'destructor' in c:
+        countDestructors += 1
         classes[-1]['destructor'] = c['destructor']
 
 
@@ -460,10 +463,26 @@
         }))
 
 
-countMethods = 0
+
+##
+## Print statistics
+##
+
+countWrappedMethods = 0
+countCustomMethods = 0
 for c in sortedClasses:
-    countMethods += len(c['methods'])
+    countWrappedMethods += len(c['methods'])
+    countCustomMethods += len(c['custom_methods'])
 
-print('\nNumber of wrapped global functions: %d' % len(sortedGlobalFunctions + sortedCustomFunctions))
-print('Number of wrapped methods: %d\n' % countMethods)
-print('Total number of wrapped global functions or methods: %d\n' % (len(sortedGlobalFunctions + sortedCustomFunctions) + countMethods))
+print('\nNumber of automatically wrapped global functions: %d' % len(sortedGlobalFunctions))
+print('Number of automatically wrapped methods: %d' % countWrappedMethods)
+print('Number of automatically wrapped destructors: %d' % countDestructors)
+print('Number of manually implemented (custom) global functions: %d' % len(sortedCustomFunctions))
+print('Number of manually implemented (custom) methods: %d' % countCustomMethods)
+
+totalWrapped = (len(sortedGlobalFunctions) + countWrappedMethods + countDestructors)
+print('\nTotal number of automatically wrapped functions (including destructors): %d' % totalWrapped)
+print('NB: This number must correspond to "ParseOrthancSDK.py" in "orthanc-java"')
+
+total = totalWrapped + len(sortedCustomFunctions) + countCustomMethods
+print('\n=> Total number of functions or methods in the Python SDK: %d\n' % total)