changeset 33:10406d66d1c6

cppcheck
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Jun 2024 11:14:02 +0200
parents 09f60b487512
children bb51eb757154 4faec1378b89
files JavaSDK/be/uclouvain/orthanc/Callbacks.java NEWS Plugin/JavaEnvironment.cpp Plugin/JavaEnvironment.h Plugin/JavaVirtualMachine.h Plugin/Mutex.h Plugin/OrthancString.h
diffstat 7 files changed, 42 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/JavaSDK/be/uclouvain/orthanc/Callbacks.java	Fri Jun 14 10:50:52 2024 +0200
+++ b/JavaSDK/be/uclouvain/orthanc/Callbacks.java	Fri Jun 14 11:14:02 2024 +0200
@@ -30,13 +30,36 @@
  * Wrapper around the callbacks provided by the Orthanc SDK.
  **/
 public class Callbacks {
+    /**
+     * Callback to react to changes.
+     **/
     public interface OnChange {
+        /**
+         * Signature of a callback function that is triggered when a
+         * change happens to some DICOM resource.
+         * @param changeType The type of change.
+         * @param resourceType The type of resource affected by this change.
+         * @param resourceId The identifier of the affected resource, if any.
+         **/
         public void call(ChangeType changeType,
                          ResourceType resourceType,
                          String resourceId);
     }
 
+    /**
+     * Callback to serve a resource in the REST API.
+     **/
     public interface OnRestRequest {
+        /**
+         * Signature of a callback function that answers a REST request.
+         * @param output Output containing the answer that is sent to the REST client.
+         * @param method The HTTP method.
+         * @param uri The URI, starting from the root of the Orthanc server.
+         * @param regularExpressionGroups The actual values of the groups matched by the regular expression.
+         * @param headers The HTTP headers of the request.
+         * @param getParameters The parameters of a GET request.
+         * @param body The body of the request (only applicable to POST and PUT methods).
+         **/
         public void call(RestOutput output,
                          HttpMethod method,
                          String uri,
@@ -46,8 +69,18 @@
                          byte[] body);
     }
 
+    /**
+     * Register a callback to monitor changes.
+     * @param callback The callback to handle the change.
+     **/
     public static native void register(OnChange callback);
 
+    /**
+     * Register a REST callback. Note that the callback will NOT be
+     * invoked in mutual exclusion.
+     * @param pathRegularExpression Regular expression for the URI. May contain groups.
+     * @param callback The callback to handle the REST call.
+     **/
     public static native void register(String pathRegularExpression,
                                        OnRestRequest callback);
 }
--- a/NEWS	Fri Jun 14 10:50:52 2024 +0200
+++ b/NEWS	Fri Jun 14 11:14:02 2024 +0200
@@ -1,4 +1,6 @@
 Pending changes in the mainline
 ===============================
 
+=> Minimum SDK version: 1.10.0 <=
+
 * Initial release
--- a/Plugin/JavaEnvironment.cpp	Fri Jun 14 10:50:52 2024 +0200
+++ b/Plugin/JavaEnvironment.cpp	Fri Jun 14 11:14:02 2024 +0200
@@ -123,8 +123,8 @@
 {
   if (GetValue().ThrowNew(FindClass(fqn), message.c_str()) != 0)
   {
-    std::string message = "Cannot throw exception " + fqn;
-    OrthancPluginLogError(context_, message.c_str());
+    std::string tmp = "Cannot throw exception " + fqn;
+    OrthancPluginLogError(context_, tmp.c_str());
   }
 }
 
--- a/Plugin/JavaEnvironment.h	Fri Jun 14 10:50:52 2024 +0200
+++ b/Plugin/JavaEnvironment.h	Fri Jun 14 11:14:02 2024 +0200
@@ -38,9 +38,9 @@
   JNIEnv *env_;
 
 public:
-  JavaEnvironment(JNIEnv* env);
+  explicit JavaEnvironment(JNIEnv* env);
 
-  JavaEnvironment(JavaVirtualMachine& jvm);
+  explicit JavaEnvironment(JavaVirtualMachine& jvm);
 
   ~JavaEnvironment();
 
--- a/Plugin/JavaVirtualMachine.h	Fri Jun 14 10:50:52 2024 +0200
+++ b/Plugin/JavaVirtualMachine.h	Fri Jun 14 11:14:02 2024 +0200
@@ -35,7 +35,7 @@
   JavaVM *jvm_;
 
 public:
-  JavaVirtualMachine(const std::string& classPath);
+  explicit JavaVirtualMachine(const std::string& classPath);
 
   ~JavaVirtualMachine();
 
--- a/Plugin/Mutex.h	Fri Jun 14 10:50:52 2024 +0200
+++ b/Plugin/Mutex.h	Fri Jun 14 11:14:02 2024 +0200
@@ -47,7 +47,7 @@
     Mutex&  mutex_;
 
   public:
-    Locker(Mutex& mutex) :
+    explicit Locker(Mutex& mutex) :
       mutex_(mutex)
     {
       mutex_.Lock();
--- a/Plugin/OrthancString.h	Fri Jun 14 10:50:52 2024 +0200
+++ b/Plugin/OrthancString.h	Fri Jun 14 11:14:02 2024 +0200
@@ -33,7 +33,7 @@
   char*  str_;
 
 public:
-  OrthancString(char* str) :
+  explicit OrthancString(char* str) :
     str_(str)
   {
   }