Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
479:0cd977e94479 | 480:482cde3f3c14 |
---|---|
26 | 26 |
27 | 27 |
28 #include <iostream> | 28 #include <iostream> |
29 | 29 |
30 #include "../../../../Core/HttpClient.h" | 30 #include "../../../../Core/HttpClient.h" |
31 #include "../../../../OrthancCppClient/OrthancConnection.h" | |
31 | 32 |
32 int main() | 33 int main() |
33 { | 34 { |
34 // Prepare a simple call to a Web service | 35 // Prepare a simple call to a Web service |
35 Orthanc::HttpClient c; | 36 Orthanc::HttpClient c; |
40 c.Apply(result); | 41 c.Apply(result); |
41 | 42 |
42 // Display the JSON answer | 43 // Display the JSON answer |
43 std::cout << result << std::endl; | 44 std::cout << result << std::endl; |
44 | 45 |
46 // Display the content of the local Orthanc instance | |
47 OrthancClient::OrthancConnection orthanc("http://localhost:8042"); | |
48 | |
49 for (unsigned int i = 0; i < orthanc.GetPatientCount(); i++) | |
50 { | |
51 OrthancClient::Patient& patient = orthanc.GetPatient(i); | |
52 std::cout << "Patient: " << patient.GetId() << std::endl; | |
53 | |
54 for (unsigned int j = 0; j < patient.GetStudyCount(); j++) | |
55 { | |
56 OrthancClient::Study& study = patient.GetStudy(j); | |
57 std::cout << " Study: " << study.GetId() << std::endl; | |
58 | |
59 for (unsigned int k = 0; k < study.GetSeriesCount(); k++) | |
60 { | |
61 OrthancClient::Series& series = study.GetSeries(k); | |
62 std::cout << " Series: " << series.GetId() << std::endl; | |
63 | |
64 for (unsigned int l = 0; l < series.GetInstanceCount(); l++) | |
65 { | |
66 std::cout << " Instance: " << series.GetInstance(l).GetId() << std::endl; | |
67 } | |
68 } | |
69 } | |
70 } | |
71 | |
45 return 0; | 72 return 0; |
46 } | 73 } |