Skip to content
Snippets Groups Projects
Commit 47c757f6 authored by Sergey Linev's avatar Sergey Linev
Browse files

[http] use override specifier in derived classes

Delete THttpServer copy constructor
parent aab37a2d
Branches
Tags
No related merge requests found
......@@ -32,8 +32,8 @@ class THttpServer : public TNamed {
protected:
TList fEngines; ///<! engines which runs http server
THttpTimer *fTimer{nullptr}; ///<! timer used to access main thread
TRootSniffer *fSniffer{nullptr}; ///<! sniffer provides access to ROOT objects hierarchy
std::unique_ptr<THttpTimer> fTimer; ///<! timer used to access main thread
std::unique_ptr<TRootSniffer> fSniffer; ///<! sniffer provides access to ROOT objects hierarchy
Bool_t fTerminated{kFALSE}; ///<! termination flag, disables all requests processing
Long_t fMainThrdId{0}; ///<! id of the thread for processing requests
Bool_t fOwnThread{kFALSE}; ///<! true when specialized thread allocated for processing requests
......@@ -67,8 +67,11 @@ protected:
static Bool_t VerifyFilePath(const char *fname);
THttpServer(const THttpServer &) = delete;
THttpServer &operator=(const THttpServer &) = delete;
public:
THttpServer(const char *engine = "civetweb:8080");
THttpServer(const char *engine = "http:8080");
virtual ~THttpServer();
Bool_t CreateEngine(const char *engine);
......@@ -76,7 +79,7 @@ public:
Bool_t IsAnyEngine() const { return fEngines.GetSize() > 0; }
/** returns pointer on objects sniffer */
TRootSniffer *GetSniffer() const { return fSniffer; }
TRootSniffer *GetSniffer() const { return fSniffer.get(); }
void SetSniffer(TRootSniffer *sniff);
......@@ -151,7 +154,7 @@ public:
/** Restrict access to specified object */
void Restrict(const char *path, const char *options);
Bool_t RegisterCommand(const char *cmdname, const char *method, const char *icon = 0);
Bool_t RegisterCommand(const char *cmdname, const char *method, const char *icon = nullptr);
Bool_t Hide(const char *fullname, Bool_t hide = kTRUE);
......@@ -172,7 +175,7 @@ public:
/** Reads content of file from the disk, use std::string in return value */
static std::string ReadFileContent(const std::string &filename);
ClassDef(THttpServer, 0) // HTTP server for ROOT analysis
ClassDefOverride(THttpServer, 0) // HTTP server for ROOT analysis
};
#endif
......@@ -242,7 +242,7 @@ public:
Bool_t Produce(const std::string &path, const std::string &file, const std::string &options, std::string &res);
ClassDef(TRootSniffer, 0) // Sniffer of ROOT objects (basic version)
ClassDefOverride(TRootSniffer, 0) // Sniffer of ROOT objects (basic version)
};
#endif
......@@ -25,7 +25,7 @@ protected:
Bool_t fOnlySecured{kFALSE}; ///<! if server should run only https protocol
Int_t fMaxAge{3600}; ///<! max-age parameter
virtual void Terminate() { fTerminating = kTRUE; }
void Terminate() override { fTerminating = kTRUE; }
Bool_t IsSecured() const { return fOnlySecured; }
......@@ -33,7 +33,7 @@ public:
TCivetweb(Bool_t only_secured = kFALSE);
virtual ~TCivetweb();
virtual Bool_t Create(const char *args);
Bool_t Create(const char *args) override;
const char *GetTopName() const { return fTopName.Data(); }
......
......@@ -25,13 +25,13 @@ protected:
std::unique_ptr<std::thread> fThrd; ///<! thread which takes requests, can be many later
Bool_t fTerminating{kFALSE}; ///<! set when http server wants to terminate all engines
virtual void Terminate() { fTerminating = kTRUE; }
void Terminate() override { fTerminating = kTRUE; }
public:
TFastCgi();
virtual ~TFastCgi();
virtual Bool_t Create(const char *args);
Bool_t Create(const char *args) override;
Int_t GetSocket() const { return fSocket; }
......
......@@ -22,6 +22,7 @@
#include "RConfigure.h"
#include "TRegexp.h"
#include "TObjArray.h"
#include "ROOT/RMakeUnique.hxx"
#include "THttpEngine.h"
#include "THttpLongPollEngine.h"
......@@ -57,7 +58,7 @@ public:
/// timeout handler
/// used to process http requests in main ROOT thread
virtual void Timeout() { fServer.ProcessRequests(); }
void Timeout() override { fServer.ProcessRequests(); }
};
//////////////////////////////////////////////////////////////////////////////////////////////////
......@@ -235,9 +236,7 @@ THttpServer::~THttpServer()
void THttpServer::SetSniffer(TRootSniffer *sniff)
{
if (fSniffer)
delete fSniffer;
fSniffer = sniff;
fSniffer.reset(sniff);
}
////////////////////////////////////////////////////////////////////////////////
......@@ -409,14 +408,13 @@ void THttpServer::SetTimer(Long_t milliSec, Bool_t mode)
{
if (fTimer) {
fTimer->Stop();
delete fTimer;
fTimer = nullptr;
fTimer.reset();
}
if (milliSec > 0) {
if (fOwnThread) {
Error("SetTimer", "Server runs already in special thread, therefore no any timer can be created");
} else {
fTimer = new THttpTimer(milliSec, mode, *this);
fTimer = std::make_unique<THttpTimer>(milliSec, mode, *this);
fTimer->TurnOn();
}
}
......
......@@ -22,25 +22,25 @@ protected:
TMemFile *fMemFile{nullptr}; ///<! file used to manage streamer infos
TList *fSinfo{nullptr}; ///<! last produced streamer info
virtual void ScanObjectProperties(TRootSnifferScanRec &rec, TObject *obj);
void ScanObjectProperties(TRootSnifferScanRec &rec, TObject *obj) override;
virtual void ScanKeyProperties(TRootSnifferScanRec &rec, TKey *key, TObject *&obj, TClass *&obj_class);
void ScanKeyProperties(TRootSnifferScanRec &rec, TKey *key, TObject *&obj, TClass *&obj_class) override;
virtual void ScanObjectChilds(TRootSnifferScanRec &rec, TObject *obj);
void ScanObjectChilds(TRootSnifferScanRec &rec, TObject *obj) override;
void CreateMemFile();
virtual Bool_t CanDrawClass(TClass *cl) { return IsDrawableClass(cl); }
Bool_t CanDrawClass(TClass *cl) override { return IsDrawableClass(cl); }
virtual Bool_t HasStreamerInfo() const { return kTRUE; }
Bool_t HasStreamerInfo() const override { return kTRUE; }
virtual Bool_t ProduceBinary(const std::string &path, const std::string &options, std::string &res);
Bool_t ProduceBinary(const std::string &path, const std::string &options, std::string &res) override;
virtual Bool_t ProduceImage(Int_t kind, const std::string &path, const std::string &options, std::string &res);
Bool_t ProduceImage(Int_t kind, const std::string &path, const std::string &options, std::string &res) override;
virtual Bool_t ProduceXml(const std::string &path, const std::string &options, std::string &res);
Bool_t ProduceXml(const std::string &path, const std::string &options, std::string &res) override;
virtual Bool_t ProduceExe(const std::string &path, const std::string &options, Int_t reskind, std::string &res);
Bool_t ProduceExe(const std::string &path, const std::string &options, Int_t reskind, std::string &res) override;
public:
TRootSnifferFull(const char *name, const char *objpath = "Objects");
......@@ -48,16 +48,15 @@ public:
static Bool_t IsDrawableClass(TClass *cl);
virtual Bool_t IsStreamerInfoItem(const char *itemname);
Bool_t IsStreamerInfoItem(const char *itemname) override;
virtual ULong_t GetStreamerInfoHash();
ULong_t GetStreamerInfoHash() override;
virtual ULong_t GetItemHash(const char *itemname);
ULong_t GetItemHash(const char *itemname) override;
virtual void *
FindInHierarchy(const char *path, TClass **cl = nullptr, TDataMember **member = nullptr, Int_t *chld = nullptr);
void *FindInHierarchy(const char *path, TClass **cl = nullptr, TDataMember **member = nullptr, Int_t *chld = nullptr) override;
ClassDef(TRootSnifferFull, 0) // Sniffer for many ROOT classes, including histograms, graphs, pads and tree
ClassDefOverride(TRootSnifferFull, 0) // Sniffer for many ROOT classes, including histograms, graphs, pads and tree
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment