HttpOdb.h

Go to the documentation of this file.
00001 //
00002 // Access ODB via mhttpd http requests
00003 //
00004 // Name: HttpOdb.h
00005 // Author: K.Olchanski, 12-Nov-2008
00006 //
00007 // $Id$
00008 //
00009 
00010 #ifndef INCLUDE_HttpOdb_H
00011 #define INCLUDE_HttpOdb_H
00012 
00013 #include "VirtualOdb.h"
00014 
00015 ///
00016 /// To enable ODB access in mhttpd, create an ODB string entry "/Custom/secret.html!" with blank value.
00017 ///
00018 /// Then create an HttpOdb class with URL "http://hostname:port/CS/secret.html" and use the odb access functions as required.
00019 ///
00020 /// Note that HTTP access is not optimized for speed. It can be slow, can result in high CPU utilization by mhttpd and is subject to lengthy delays if mhttpd is busy with something else (i.e. starting a run or generating history plots).
00021 ///
00022 /// In this usage, the string "secret.html" functions as an access password.
00023 ///
00024 
00025 /// Access to ODB through the MIDAS HTTP server mhttpd
00026 
00027 class HttpOdb : public VirtualOdb
00028 {
00029  protected:
00030   const char* fUrl;
00031   int fDebug;
00032 
00033  public:
00034   /// Contructor from a base URL
00035   HttpOdb(const char* url);
00036 
00037   /// Destructor
00038   virtual ~HttpOdb();
00039 
00040   int      odbReadAny(   const char*name, int index, int tid,void* buf, int bufsize=0);
00041   int      odbReadInt(   const char*name, int index, int      defaultValue);
00042   uint32_t odbReadUint32(const char*name, int index, uint32_t defaultValue);
00043   bool     odbReadBool(  const char*name, int index, bool     defaultValue);
00044   double   odbReadDouble(const char*name, int index, double   defaultValue);
00045   float    odbReadFloat(const char*name, int index, float    defaultValue);
00046   const char* odbReadString(const char*name, int index, const char* defaultValue);
00047   int      odbReadArraySize(const char*name);
00048 
00049  protected:
00050   const char* jkey(const char* path);
00051   const char* jget(const char* path, int index);
00052 
00053  protected:
00054   char fRequestBuf[1024];
00055   char fReplyBuf[1024];
00056 };
00057 
00058 #endif
00059 //end

Generated on 12 Feb 2016 for ROOT Analyzer by  doxygen 1.6.1