changeset 591:a00f626290db

better api
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 02 Oct 2013 17:36:14 +0200
parents 3237eea24487
children c5ee586a0a08
files CMakeLists.txt OrthancCppClient/SharedLibrary/AUTOGENERATED/OrthancCppClient.h Resources/OrthancClient.doxygen Resources/Samples/OrthancClient/Basic/main.cpp Resources/Samples/OrthancClient/Vtk/main.cpp
diffstat 5 files changed, 63 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Wed Oct 02 15:01:02 2013 +0200
+++ b/CMakeLists.txt	Wed Oct 02 17:36:14 2013 +0200
@@ -366,14 +366,20 @@
     ${CMAKE_CURRENT_BINARY_DIR}/OrthancClient.doxygen
     @ONLY)
 
-  add_custom_target(doc
-    ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Orthanc.doxygen
-    COMMAND
+  add_custom_target(doc-client
     ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/OrthancClient.doxygen
     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-    COMMENT "Generating API documentation with Doxygen" VERBATIM
+    COMMENT "Generating client documentation with Doxygen" VERBATIM
     )
 
+  add_custom_target(doc-internal
+    ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Orthanc.doxygen
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+    COMMENT "Generating internal documentation with Doxygen" VERBATIM
+    )
+
+  add_custom_target(doc DEPENDS doc-client doc-internal)
+
 else()
   message("Doxygen not found. The documentation will not be built.")
 endif()
--- a/OrthancCppClient/SharedLibrary/AUTOGENERATED/OrthancCppClient.h	Wed Oct 02 15:01:02 2013 +0200
+++ b/OrthancCppClient/SharedLibrary/AUTOGENERATED/OrthancCppClient.h	Wed Oct 02 17:36:14 2013 +0200
@@ -520,11 +520,18 @@
     friend class ::OrthancClient::Instance;
   private:
     bool isReference_;
+    OrthancConnection& operator= (const OrthancConnection&); // Assignment is forbidden
     void* pimpl_;
     OrthancConnection(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
   public:
-    OrthancConnection(const OrthancConnection& other) { *this = other; }
-    void operator= (const OrthancConnection& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true;  }
+    /**
+     * @brief Construct a new reference to this object.
+     *
+     * Construct a new reference to this object. Pay attention to the fact that when the referenced object is deleted, the content of this object will be invalid.
+     *
+     * @param other The original object.
+     **/
+    OrthancConnection(const OrthancConnection& other) : pimpl_(other.pimpl_), isReference_(true) { }
     inline OrthancConnection(const ::std::string& orthancUrl);
     inline OrthancConnection(const ::std::string& orthancUrl, const ::std::string& username, const ::std::string& password);
     inline ~OrthancConnection();
@@ -550,11 +557,18 @@
     friend class ::OrthancClient::Instance;
   private:
     bool isReference_;
+    Patient& operator= (const Patient&); // Assignment is forbidden
     void* pimpl_;
     Patient(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
   public:
-    Patient(const Patient& other) { *this = other; }
-    void operator= (const Patient& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true;  }
+    /**
+     * @brief Construct a new reference to this object.
+     *
+     * Construct a new reference to this object. Pay attention to the fact that when the referenced object is deleted, the content of this object will be invalid.
+     *
+     * @param other The original object.
+     **/
+    Patient(const Patient& other) : pimpl_(other.pimpl_), isReference_(true) { }
     inline Patient(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
     inline ~Patient();
     inline void Reload();
@@ -575,11 +589,18 @@
     friend class ::OrthancClient::Instance;
   private:
     bool isReference_;
+    Series& operator= (const Series&); // Assignment is forbidden
     void* pimpl_;
     Series(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
   public:
-    Series(const Series& other) { *this = other; }
-    void operator= (const Series& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true;  }
+    /**
+     * @brief Construct a new reference to this object.
+     *
+     * Construct a new reference to this object. Pay attention to the fact that when the referenced object is deleted, the content of this object will be invalid.
+     *
+     * @param other The original object.
+     **/
+    Series(const Series& other) : pimpl_(other.pimpl_), isReference_(true) { }
     inline Series(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
     inline ~Series();
     inline void Reload();
@@ -609,11 +630,18 @@
     friend class ::OrthancClient::Instance;
   private:
     bool isReference_;
+    Study& operator= (const Study&); // Assignment is forbidden
     void* pimpl_;
     Study(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
   public:
-    Study(const Study& other) { *this = other; }
-    void operator= (const Study& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true;  }
+    /**
+     * @brief Construct a new reference to this object.
+     *
+     * Construct a new reference to this object. Pay attention to the fact that when the referenced object is deleted, the content of this object will be invalid.
+     *
+     * @param other The original object.
+     **/
+    Study(const Study& other) : pimpl_(other.pimpl_), isReference_(true) { }
     inline Study(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
     inline ~Study();
     inline void Reload();
@@ -634,11 +662,18 @@
     friend class ::OrthancClient::Study;
   private:
     bool isReference_;
+    Instance& operator= (const Instance&); // Assignment is forbidden
     void* pimpl_;
     Instance(void* pimpl) : isReference_(true), pimpl_(pimpl) {}
   public:
-    Instance(const Instance& other) { *this = other; }
-    void operator= (const Instance& other) { if (!other.isReference_) throw ::OrthancClient::OrthancClientException("Cannot copy a non-reference object"); pimpl_ = other.pimpl_; isReference_ = true;  }
+    /**
+     * @brief Construct a new reference to this object.
+     *
+     * Construct a new reference to this object. Pay attention to the fact that when the referenced object is deleted, the content of this object will be invalid.
+     *
+     * @param other The original object.
+     **/
+    Instance(const Instance& other) : pimpl_(other.pimpl_), isReference_(true) { }
     inline Instance(::OrthancClient::OrthancConnection& connection, const ::std::string& id);
     inline ~Instance();
     inline ::std::string GetId() const;
--- a/Resources/OrthancClient.doxygen	Wed Oct 02 15:01:02 2013 +0200
+++ b/Resources/OrthancClient.doxygen	Wed Oct 02 17:36:14 2013 +0200
@@ -318,7 +318,7 @@
 # Private class members and static file members will be hidden unless
 # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
 
-EXTRACT_ALL            = YES
+EXTRACT_ALL            = NO
 
 # If the EXTRACT_PRIVATE tag is set to YES all private members of a class
 # will be included in the documentation.
@@ -584,7 +584,7 @@
 # wrong or incomplete parameter documentation, but not about the absence of
 # documentation.
 
-WARN_NO_PARAMDOC       = NO
+WARN_NO_PARAMDOC       = YES
 
 # The WARN_FORMAT tag determines the format of the warning messages that
 # doxygen can produce. The string should contain the $file, $line, and $text
--- a/Resources/Samples/OrthancClient/Basic/main.cpp	Wed Oct 02 15:01:02 2013 +0200
+++ b/Resources/Samples/OrthancClient/Basic/main.cpp	Wed Oct 02 17:36:14 2013 +0200
@@ -41,17 +41,17 @@
 
     for (unsigned int i = 0; i < orthanc.GetPatientCount(); i++)
     {
-      OrthancClient::Patient patient = orthanc.GetPatient(i);
+      OrthancClient::Patient patient(orthanc.GetPatient(i));
       std::cout << "Patient: " << patient.GetId() << std::endl;
 
       for (unsigned int j = 0; j < patient.GetStudyCount(); j++)
       {
-        OrthancClient::Study study = patient.GetStudy(j);
+        OrthancClient::Study study(patient.GetStudy(j));
         std::cout << "  Study: " << study.GetId() << std::endl;
 
         for (unsigned int k = 0; k < study.GetSeriesCount(); k++)
         {
-          OrthancClient::Series series = study.GetSeries(k);
+          OrthancClient::Series series(study.GetSeries(k));
           std::cout << "    Series: " << series.GetId() << std::endl;
 
           for (unsigned int l = 0; l < series.GetInstanceCount(); l++)
--- a/Resources/Samples/OrthancClient/Vtk/main.cpp	Wed Oct 02 15:01:02 2013 +0200
+++ b/Resources/Samples/OrthancClient/Vtk/main.cpp	Wed Oct 02 17:36:14 2013 +0200
@@ -143,17 +143,17 @@
 
     for (unsigned int i = 0; i < orthanc.GetPatientCount(); i++)
     {
-      OrthancClient::Patient patient = orthanc.GetPatient(i);
+      OrthancClient::Patient patient(orthanc.GetPatient(i));
       std::cout << "Patient: " << patient.GetId() << std::endl;
 
       for (unsigned int j = 0; j < patient.GetStudyCount(); j++)
       {
-        OrthancClient::Study study = patient.GetStudy(j);
+        OrthancClient::Study study(patient.GetStudy(j));
         std::cout << "  Study: " << study.GetId() << std::endl;
 
         for (unsigned int k = 0; k < study.GetSeriesCount(); k++)
         {
-          OrthancClient::Series series = study.GetSeries(k);
+          OrthancClient::Series series(study.GetSeries(k));
           std::cout << "    Series: " << series.GetId() << std::endl;
 
           if (series.Is3DImage())