# HG changeset patch # User Sebastien Jodogne # Date 1374093082 -7200 # Node ID ec19da4a1fe717830665cd8c0f1d2a78818f2948 # Parent ddeae3c3a8c293b30b765793be341360c51d0b82 fix api diff -r ddeae3c3a8c2 -r ec19da4a1fe7 OrthancCppClient/Instance.cpp --- 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); diff -r ddeae3c3a8c2 -r ec19da4a1fe7 OrthancCppClient/Instance.h --- 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(); diff -r ddeae3c3a8c2 -r ec19da4a1fe7 OrthancCppClient/OrthancConnection.h --- 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_; } diff -r ddeae3c3a8c2 -r ec19da4a1fe7 OrthancCppClient/Patient.cpp --- 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(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 { diff -r ddeae3c3a8c2 -r ec19da4a1fe7 OrthancCppClient/Patient.h --- 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; }; } diff -r ddeae3c3a8c2 -r ec19da4a1fe7 OrthancCppClient/Series.cpp --- 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(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 { diff -r ddeae3c3a8c2 -r ec19da4a1fe7 OrthancCppClient/Series.h --- 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, diff -r ddeae3c3a8c2 -r ec19da4a1fe7 OrthancCppClient/Study.cpp --- 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 { diff -r ddeae3c3a8c2 -r ec19da4a1fe7 OrthancCppClient/Study.h --- 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_.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; }; }