diff Resources/Samples/OrthancCppClient/Basic/main.cpp @ 480:482cde3f3c14

sample of c++ client
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 16 Jul 2013 09:22:55 +0200
parents 888f8a778e70
children
line wrap: on
line diff
--- a/Resources/Samples/OrthancCppClient/Basic/main.cpp	Tue Jul 16 09:08:09 2013 +0200
+++ b/Resources/Samples/OrthancCppClient/Basic/main.cpp	Tue Jul 16 09:22:55 2013 +0200
@@ -28,6 +28,7 @@
 #include <iostream>
 
 #include "../../../../Core/HttpClient.h"
+#include "../../../../OrthancCppClient/OrthancConnection.h"
 
 int main()
 {
@@ -42,5 +43,31 @@
   // Display the JSON answer
   std::cout << result << std::endl;
 
+  // Display the content of the local Orthanc instance
+  OrthancClient::OrthancConnection orthanc("http://localhost:8042");
+
+  for (unsigned int i = 0; i < orthanc.GetPatientCount(); 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);
+      std::cout << "  Study: " << study.GetId() << std::endl;
+
+      for (unsigned int k = 0; k < study.GetSeriesCount(); k++)
+      {
+        OrthancClient::Series& series = study.GetSeries(k);
+        std::cout << "    Series: " << series.GetId() << std::endl;
+
+        for (unsigned int l = 0; l < series.GetInstanceCount(); l++)
+        {
+          std::cout << "      Instance: " << series.GetInstance(l).GetId() << std::endl;
+        }
+      }
+    }
+  }
+
   return 0;
 }