diff Core/RestApi/RestApi.h @ 210:96b7918a6a18

start of the refactoring of the Orthanc REST API
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 28 Nov 2012 18:03:44 +0100
parents 9960642f0f45
children f276b175dcaf
line wrap: on
line diff
--- a/Core/RestApi/RestApi.h	Wed Nov 28 17:22:07 2012 +0100
+++ b/Core/RestApi/RestApi.h	Wed Nov 28 18:03:44 2012 +0100
@@ -32,7 +32,6 @@
 
 #pragma once
 
-#include "../IDynamicObject.h"
 #include "../HttpServer/HttpHandler.h"
 #include "RestApiPath.h"
 #include "RestApiOutput.h"
@@ -48,7 +47,7 @@
 
     private:
       RestApiOutput* output_;
-      IDynamicObject* context_;
+      RestApi* context_;
       const HttpHandler::Arguments* httpHeaders_;
       const RestApiPath::Components* uriComponents_;
       const UriComponents* trailing_;
@@ -59,9 +58,9 @@
         return *output_;
       }
 
-      IDynamicObject* GetContext()
+      RestApi& GetContext()
       {
-        return context_;
+        return *context_;
       }
     
       const HttpHandler::Arguments& GetHttpHeaders() const
@@ -149,9 +148,6 @@
     typedef std::list< std::pair<RestApiPath*, PostHandler> > PostHandlers;
     typedef std::list< std::pair<RestApiPath*, DeleteHandler> > DeleteHandlers;
 
-    // CAUTION: PLEASE INTRODUCE MUTEX BETWEEN CONTEXTS !!!
-    std::auto_ptr<IDynamicObject> context_;
-
     GetHandlers  getHandlers_;
     PutHandlers  putHandlers_;
     PostHandlers  postHandlers_;
@@ -169,11 +165,6 @@
     {
     }
 
-    void SetContext(IDynamicObject* context)  // This takes the ownership
-    {
-      context_.reset(context);
-    }
-
     ~RestApi();
 
     virtual bool IsServedUri(const UriComponents& uri);