annotate Platforms/Generic/OracleWebService.cpp @ 876:580dd82e13f5 am-dev

added GetApproximateMemoryUsage
author Alain Mazy <alain@mazy.be>
date Wed, 03 Jul 2019 10:15:29 +0200
parents c35e98d22764
children b537002f83a9 1c7ae79c426d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
434
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
1 /**
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
2 * Stone of Orthanc
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
6 *
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
10 * the License, or (at your option) any later version.
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
11 *
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
15 * Affero General Public License for more details.
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
16 *
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
19 **/
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
20
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
21
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
22 #include "OracleWebService.h"
732
c35e98d22764 move Deprecated classes to a separate folder
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 726
diff changeset
23 #include "../../Framework/Deprecated/Toolbox/IWebService.h"
434
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
24
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 434
diff changeset
25 namespace Deprecated
434
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
26 {
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
27
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
28
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 434
diff changeset
29 class OracleWebService::WebServiceCachedGetCommand : public IOracleCommand, OrthancStone::IObservable
434
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
30 {
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
31 protected:
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 434
diff changeset
32 std::auto_ptr<OrthancStone::MessageHandler<IWebService::HttpRequestSuccessMessage> > successCallback_;
434
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
33 std::auto_ptr<Orthanc::IDynamicObject> payload_;
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
34 boost::shared_ptr<BaseWebService::CachedHttpRequestSuccessMessage> cachedMessage_;
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 434
diff changeset
35 OrthancStone::NativeStoneApplicationContext& context_;
434
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
36
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
37 public:
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 434
diff changeset
38 WebServiceCachedGetCommand(OrthancStone::MessageBroker& broker,
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 434
diff changeset
39 OrthancStone::MessageHandler<IWebService::HttpRequestSuccessMessage>* successCallback, // takes ownership
434
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
40 boost::shared_ptr<BaseWebService::CachedHttpRequestSuccessMessage> cachedMessage,
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
41 Orthanc::IDynamicObject* payload /* takes ownership */,
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 434
diff changeset
42 OrthancStone::NativeStoneApplicationContext& context
434
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
43 ) :
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
44 IObservable(broker),
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
45 successCallback_(successCallback),
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
46 payload_(payload),
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
47 cachedMessage_(cachedMessage),
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
48 context_(context)
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
49 {
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
50 }
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
51
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
52 virtual void Execute()
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
53 {
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
54 // nothing to do, everything is in the commit
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
55 }
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
56
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
57 virtual void Commit()
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
58 {
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
59 // We want to make sure that, i.e, the UpdateThread is not
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
60 // triggered while we are updating the "model" with the result of
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
61 // a WebServiceCommand
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 434
diff changeset
62 OrthancStone::NativeStoneApplicationContext::GlobalMutexLocker lock(context_);
434
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
63
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
64 IWebService::HttpRequestSuccessMessage successMessage(cachedMessage_->GetUri(),
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
65 cachedMessage_->GetAnswer(),
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
66 cachedMessage_->GetAnswerSize(),
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
67 cachedMessage_->GetAnswerHttpHeaders(),
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
68 payload_.get());
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
69
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
70 successCallback_->Apply(successMessage);
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
71 }
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
72 };
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
73
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
74 void OracleWebService::NotifyHttpSuccessLater(boost::shared_ptr<BaseWebService::CachedHttpRequestSuccessMessage> cachedMessage,
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
75 Orthanc::IDynamicObject* payload, // takes ownership
726
4f2416d519b4 moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 434
diff changeset
76 OrthancStone::MessageHandler<IWebService::HttpRequestSuccessMessage>* successCallback)
434
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
77 {
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
78 oracle_.Submit(new WebServiceCachedGetCommand(GetBroker(), successCallback, cachedMessage, payload, context_));
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
79 }
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
80
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
81
3a8bcc45c221 moved the HTTP cache from OrthancApiClient to BaseWebService (not implemented yet in WASM)
am@osimis.io
parents:
diff changeset
82 }