changeset 1580:bf502300c52e

force the size of the enumerations in the plugin SDK
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Aug 2015 15:59:07 +0200
parents b93c398f934d
children 357c4bb15701
files Plugins/Include/orthanc/OrthancCDatabasePlugin.h Plugins/Include/orthanc/OrthancCPlugin.h Resources/GenerateErrorCodes.py
diffstat 3 files changed, 31 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Include/orthanc/OrthancCDatabasePlugin.h	Tue Aug 25 15:45:50 2015 +0200
+++ b/Plugins/Include/orthanc/OrthancCDatabasePlugin.h	Tue Aug 25 15:59:07 2015 +0200
@@ -67,7 +67,9 @@
     _OrthancPluginDatabaseAnswerType_Int32 = 14,
     _OrthancPluginDatabaseAnswerType_Int64 = 15,
     _OrthancPluginDatabaseAnswerType_Resource = 16,
-    _OrthancPluginDatabaseAnswerType_String = 17
+    _OrthancPluginDatabaseAnswerType_String = 17,
+
+    _OrthancPluginDatabaseAnswerType_INTERNAL = 0x7fffffff
   } _OrthancPluginDatabaseAnswerType;
 
 
--- a/Plugins/Include/orthanc/OrthancCPlugin.h	Tue Aug 25 15:45:50 2015 +0200
+++ b/Plugins/Include/orthanc/OrthancCPlugin.h	Tue Aug 25 15:59:07 2015 +0200
@@ -187,7 +187,9 @@
     OrthancPluginErrorCode_ReadOnly = 22    /*!< Cannot modify a read-only data structure */,
     OrthancPluginErrorCode_IncompatibleImageFormat = 23    /*!< Incompatible format of the images */,
     OrthancPluginErrorCode_IncompatibleImageSize = 24    /*!< Incompatible size of the images */,
-    OrthancPluginErrorCode_SharedLibrary = 25    /*!< Error while using a shared library (plugin) */
+    OrthancPluginErrorCode_SharedLibrary = 25    /*!< Error while using a shared library (plugin) */,
+
+    _OrthancPluginErrorCode_INTERNAL = 0x7fffffff
   } OrthancPluginErrorCode;
 
 
@@ -206,7 +208,9 @@
     OrthancPluginHttpMethod_Get = 1,    /*!< GET request */
     OrthancPluginHttpMethod_Post = 2,   /*!< POST request */
     OrthancPluginHttpMethod_Put = 3,    /*!< PUT request */
-    OrthancPluginHttpMethod_Delete = 4  /*!< DELETE request */
+    OrthancPluginHttpMethod_Delete = 4, /*!< DELETE request */
+
+    _OrthancPluginHttpMethod_INTERNAL = 0x7fffffff
   } OrthancPluginHttpMethod;
 
 
@@ -341,8 +345,9 @@
 
     /* Services for plugins implementing a database back-end */
     _OrthancPluginService_RegisterDatabaseBackend = 5000,
-    _OrthancPluginService_DatabaseAnswer = 5001
+    _OrthancPluginService_DatabaseAnswer = 5001,
 
+    _OrthancPluginService_INTERNAL = 0x7fffffff
   } _OrthancPluginService;
 
 
@@ -350,7 +355,9 @@
   {
     _OrthancPluginProperty_Description = 1,
     _OrthancPluginProperty_RootUri = 2,
-    _OrthancPluginProperty_OrthancExplorer = 3
+    _OrthancPluginProperty_OrthancExplorer = 3,
+
+    _OrthancPluginProperty_INTERNAL = 0x7fffffff
   } _OrthancPluginProperty;
 
 
@@ -398,7 +405,9 @@
      * This format describes a color image. The pixels are stored in 4
      * consecutive bytes. The memory layout is RGBA.
      **/
-    OrthancPluginPixelFormat_RGBA32 = 5
+    OrthancPluginPixelFormat_RGBA32 = 5,
+
+    _OrthancPluginPixelFormat_INTERNAL = 0x7fffffff
   } OrthancPluginPixelFormat;
 
 
@@ -410,7 +419,9 @@
   {
     OrthancPluginContentType_Unknown = 0,      /*!< Unknown content type */
     OrthancPluginContentType_Dicom = 1,        /*!< DICOM */
-    OrthancPluginContentType_DicomAsJson = 2   /*!< JSON summary of a DICOM file */
+    OrthancPluginContentType_DicomAsJson = 2,  /*!< JSON summary of a DICOM file */
+
+    _OrthancPluginContentType_INTERNAL = 0x7fffffff
   } OrthancPluginContentType;
 
 
@@ -423,7 +434,9 @@
     OrthancPluginResourceType_Patient = 0,     /*!< Patient */
     OrthancPluginResourceType_Study = 1,       /*!< Study */
     OrthancPluginResourceType_Series = 2,      /*!< Series */
-    OrthancPluginResourceType_Instance = 3     /*!< Instance */
+    OrthancPluginResourceType_Instance = 3,    /*!< Instance */
+
+    _OrthancPluginResourceType_INTERNAL = 0x7fffffff
   } OrthancPluginResourceType;
 
 
@@ -442,7 +455,9 @@
     OrthancPluginChangeType_NewStudy = 6,           /*!< New study created */
     OrthancPluginChangeType_StablePatient = 7,      /*!< Timeout: No new instance in this patient */
     OrthancPluginChangeType_StableSeries = 8,       /*!< Timeout: No new instance in this series */
-    OrthancPluginChangeType_StableStudy = 9         /*!< Timeout: No new instance in this study */
+    OrthancPluginChangeType_StableStudy = 9,        /*!< Timeout: No new instance in this study */
+
+    _OrthancPluginChangeType_INTERNAL = 0x7fffffff
   } OrthancPluginChangeType;
 
 
@@ -454,7 +469,9 @@
     OrthancPluginCompressionType_Zlib = 0,          /*!< Standard zlib compression */
     OrthancPluginCompressionType_ZlibWithSize = 1,  /*!< zlib, prefixed with uncompressed size (uint64_t) */
     OrthancPluginCompressionType_Gzip = 2,          /*!< Standard gzip compression */
-    OrthancPluginCompressionType_GzipWithSize = 3   /*!< gzip, prefixed with uncompressed size (uint64_t) */
+    OrthancPluginCompressionType_GzipWithSize = 3,  /*!< gzip, prefixed with uncompressed size (uint64_t) */
+
+    _OrthancPluginCompressionType_INTERNAL = 0x7fffffff
   } OrthancPluginCompressionType;
 
 
--- a/Resources/GenerateErrorCodes.py	Tue Aug 25 15:45:50 2015 +0200
+++ b/Resources/GenerateErrorCodes.py	Tue Aug 25 15:59:07 2015 +0200
@@ -79,7 +79,8 @@
     a = f.read()
 
 s = ',\n'.join(map(lambda x: '    OrthancPluginErrorCode_%s = %d    /*!< %s */' % (x['Name'], int(x['Code']), x['Description']), ERRORS))
-a = re.sub('(typedef enum\s*{)[^}]*?(\s*} OrthancPluginErrorCode;)', r'\1\n%s\2' % s, a, re.DOTALL)
+s += ',\n\n    _OrthancPluginErrorCode_INTERNAL = 0x7fffffff\n  '
+a = re.sub('(typedef enum\s*{)[^}]*?(} OrthancPluginErrorCode;)', r'\1\n%s\2' % s, a, re.DOTALL)
 
 with open(path, 'w') as f:
     f.write(a)