FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairMQExHistoServer.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 #ifndef FAIRMQEXHISTOSERVER
9 #define FAIRMQEXHISTOSERVER
10 
11 #include "FairMQExHistoCanvasDrawer.h" // for FairMQExHistoCanvasDrawer
12 
13 #include <FairMQDevice.h>
14 #include <THttpServer.h>
15 #include <TObjArray.h>
16 #include <memory>
17 #include <string>
18 #include <thread>
19 #include <utility>
20 
21 class FairMQExHistoServer : public FairMQDevice
22 {
23  public:
25 
26  virtual ~FairMQExHistoServer();
27 
28  void UpdateHttpServer();
29 
30  void SetCanvasDrawer(std::unique_ptr<FairMQExHistoCanvasDrawer> canvasDrawer)
31  {
32  fCanvasDrawer = std::move(canvasDrawer);
33  }
34 
35  protected:
36  virtual void InitTask();
37 
38  bool ReceiveData(FairMQMessagePtr& msg, int index);
39 
40  virtual void PreRun();
41 
42  virtual void PostRun();
43 
44  private:
45  std::string fInputChannelName;
46 
47  TObjArray fArrayHisto;
48 
49  int fNMessages;
50 
51  THttpServer fServer;
52 
53  std::unique_ptr<FairMQExHistoCanvasDrawer> fCanvasDrawer;
54 
55  std::thread fThread;
56  bool fStopThread;
57 
58  int FindHistogram(const std::string& name);
59 
61  FairMQExHistoServer& operator=(const FairMQExHistoServer&);
62 };
63 
64 #endif
bool ReceiveData(FairMQMessagePtr &msg, int index)
void SetCanvasDrawer(std::unique_ptr< FairMQExHistoCanvasDrawer > canvasDrawer)