changeset 500:ec19da4a1fe7 laaw

fix api
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 17 Jul 2013 22:31:22 +0200
parents ddeae3c3a8c2
children ee33c7d0cda0
files OrthancCppClient/Instance.cpp OrthancCppClient/Instance.h OrthancCppClient/OrthancConnection.h OrthancCppClient/Patient.cpp OrthancCppClient/Patient.h OrthancCppClient/Series.cpp OrthancCppClient/Series.h OrthancCppClient/Study.cpp OrthancCppClient/Study.h
diffstat 9 files changed, 29 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancCppClient/Instance.cpp	Wed Jul 17 17:42:18 2013 +0200
+++ b/OrthancCppClient/Instance.cpp	Wed Jul 17 22:31:22 2013 +0200
@@ -96,11 +96,11 @@
     }
   }
 
-  std::string Instance::GetTagAsString(const char* tag)
+  const char* Instance::GetTagAsString(const char* tag) const
   {
     if (tags_.isMember(tag))
     {
-      return tags_[tag].asString();
+      return tags_[tag].asCString();
     }
     else
     {
@@ -108,7 +108,7 @@
     }
   }
 
-  float Instance::GetTagAsFloat(const char* tag)
+  float Instance::GetTagAsFloat(const char* tag) const
   {
     std::string value = GetTagAsString(tag);
 
@@ -122,7 +122,7 @@
     }
   }
 
-  int Instance::GetTagAsInt(const char* tag)
+  int Instance::GetTagAsInt(const char* tag) const
   {
     std::string value = GetTagAsString(tag);
 
--- a/OrthancCppClient/Instance.h	Wed Jul 17 17:42:18 2013 +0200
+++ b/OrthancCppClient/Instance.h	Wed Jul 17 22:31:22 2013 +0200
@@ -70,11 +70,11 @@
       return mode_;
     }
 
-    std::string GetTagAsString(const char* tag);
+    const char* GetTagAsString(const char* tag) const;
 
-    float GetTagAsFloat(const char* tag);
+    float GetTagAsFloat(const char* tag) const;
 
-    int32_t GetTagAsInt(const char* tag);
+    int32_t GetTagAsInt(const char* tag) const;
 
     uint32_t GetWidth();
 
--- a/OrthancCppClient/OrthancConnection.h	Wed Jul 17 17:42:18 2013 +0200
+++ b/OrthancCppClient/OrthancConnection.h	Wed Jul 17 22:31:22 2013 +0200
@@ -79,7 +79,7 @@
       patients_.Reload();
     }
 
-    const Orthanc::HttpClient& GetHttpClient() const
+    LAAW_API_INTERNAL const Orthanc::HttpClient& GetHttpClient() const
     {
       return client_;
     }
--- a/OrthancCppClient/Patient.cpp	Wed Jul 17 17:42:18 2013 +0200
+++ b/OrthancCppClient/Patient.cpp	Wed Jul 17 22:31:22 2013 +0200
@@ -52,7 +52,8 @@
   Orthanc::IDynamicObject* Patient::GetFillerItem(size_t index)
   {
     Json::Value::ArrayIndex tmp = static_cast<Json::Value::ArrayIndex>(index);
-    return new Study(connection_, patient_["Studies"][tmp].asString());
+    std::string id = patient_["Studies"][tmp].asString();
+    return new Study(connection_, id.c_str());
   }
 
   Patient::Patient(const OrthancConnection& connection,
@@ -65,11 +66,11 @@
     ReadPatient();
   }
 
-  std::string Patient::GetMainDicomTag(const char* tag, const char* defaultValue) const
+  const char* Patient::GetMainDicomTag(const char* tag, const char* defaultValue) const
   {
     if (patient_["MainDicomTags"].isMember(tag))
     {
-      return patient_["MainDicomTags"][tag].asString();
+      return patient_["MainDicomTags"][tag].asCString();
     }
     else
     {
--- a/OrthancCppClient/Patient.h	Wed Jul 17 17:42:18 2013 +0200
+++ b/OrthancCppClient/Patient.h	Wed Jul 17 22:31:22 2013 +0200
@@ -79,7 +79,7 @@
       return id_.c_str();
     }
 
-    std::string GetMainDicomTag(const char* tag, 
+    const char* GetMainDicomTag(const char* tag, 
                                 const char* defaultValue) const;
   };
 }
--- a/OrthancCppClient/Series.cpp	Wed Jul 17 17:42:18 2013 +0200
+++ b/OrthancCppClient/Series.cpp	Wed Jul 17 22:31:22 2013 +0200
@@ -228,6 +228,7 @@
   {
     ReadSeries();
     status_ = Status3DImage_NotTested;
+    url_ = std::string(connection_.GetOrthancUrl()) + "/series/" + id_;
 
     instances_.SetThreadCount(connection.GetThreadCount());
   }
@@ -253,11 +254,6 @@
     return dynamic_cast<Instance&>(instances_.GetItem(index));
   }
 
-  std::string Series::GetUrl() const
-  {
-    return std::string(connection_.GetOrthancUrl()) + "/series/" + id_;
-  }
-
   unsigned int Series::GetWidth()
   {
     Check3DImage();
@@ -310,11 +306,11 @@
   }
 
 
-  std::string Series::GetMainDicomTag(const char* tag, const char* defaultValue) const
+  const char* Series::GetMainDicomTag(const char* tag, const char* defaultValue) const
   {
     if (series_["MainDicomTags"].isMember(tag))
     {
-      return series_["MainDicomTags"][tag].asString();
+      return series_["MainDicomTags"][tag].asCString();
     }
     else
     {
--- a/OrthancCppClient/Series.h	Wed Jul 17 17:42:18 2013 +0200
+++ b/OrthancCppClient/Series.h	Wed Jul 17 22:31:22 2013 +0200
@@ -52,7 +52,7 @@
     };
 
     const OrthancConnection& connection_;
-    std::string id_;
+    std::string id_, url_;
     Json::Value series_;
     Orthanc::ArrayFilledByThreads  instances_;
     Status3DImage status_;
@@ -96,7 +96,10 @@
       return id_.c_str();
     }
 
-    std::string GetUrl() const;
+    const char* GetUrl() const
+    {
+      return url_.c_str();
+    }
 
     uint32_t GetWidth();
 
@@ -104,7 +107,7 @@
 
     void GetVoxelSize(float& sizeX, float& sizeY, float& sizeZ);  
 
-    std::string GetMainDicomTag(const char* tag, 
+    const char* GetMainDicomTag(const char* tag, 
                                 const char* defaultValue) const;
 
     LAAW_API_INTERNAL void Load3DImage(void* target,
--- a/OrthancCppClient/Study.cpp	Wed Jul 17 17:42:18 2013 +0200
+++ b/OrthancCppClient/Study.cpp	Wed Jul 17 22:31:22 2013 +0200
@@ -57,7 +57,7 @@
   }
 
   Study::Study(const OrthancConnection& connection,
-               const std::string& id) :
+               const char* id) :
     connection_(connection),
     id_(id),
     series_(*this)
@@ -66,11 +66,11 @@
     ReadStudy();
   }
 
-  std::string Study::GetMainDicomTag(const char* tag, const char* defaultValue) const
+  const char* Study::GetMainDicomTag(const char* tag, const char* defaultValue) const
   {
     if (study_["MainDicomTags"].isMember(tag))
     {
-      return study_["MainDicomTags"][tag].asString();
+      return study_["MainDicomTags"][tag].asCString();
     }
     else
     {
--- a/OrthancCppClient/Study.h	Wed Jul 17 17:42:18 2013 +0200
+++ b/OrthancCppClient/Study.h	Wed Jul 17 22:31:22 2013 +0200
@@ -57,7 +57,7 @@
 
   public:
     Study(const OrthancConnection& connection,
-          const std::string& id);
+          const char* id);
 
     void Reload()
     {
@@ -74,12 +74,12 @@
       return dynamic_cast<Series&>(series_.GetItem(index));
     }
 
-    const std::string& GetId() const
+    const char* GetId() const
     {
-      return id_;
+      return id_.c_str();
     }
 
-    std::string GetMainDicomTag(const char* tag, 
+    const char* GetMainDicomTag(const char* tag, 
                                 const char* defaultValue) const;
   };
 }