Logo ROOT   6.10/00
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
THttpEngine.h
Go to the documentation of this file.
1 // $Id$
2 // Author: Sergey Linev 21/12/2013
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_THttpEngine
13 #define ROOT_THttpEngine
14 
15 #include "TNamed.h"
16 
17 class THttpServer;
18 class THttpCallArg;
19 class TCanvas;
20 
21 class THttpEngine : public TNamed {
22 protected:
23  friend class THttpServer;
24 
25  THttpServer *fServer; ///<! object server
26 
27  THttpEngine(const char *name, const char *title);
28 
29  void SetServer(THttpServer *serv) { fServer = serv; }
30 
31  /** Method regularly called in main ROOT context */
32  virtual void Process() {}
33 
34 public:
35  virtual ~THttpEngine();
36 
37  /** Method to create all components of engine. Called once from by the server */
38  virtual Bool_t Create(const char *) { return kFALSE; }
39 
40  /** Returns pointer to THttpServer associated with engine */
41  THttpServer *GetServer() const { return fServer; }
42 
43  ClassDef(THttpEngine, 0) // abstract class which should provide http-based protocol for server
44 };
45 
46 // ====================================================================
47 
48 class THttpWSEngine : public TNamed {
49 
50 protected:
51  THttpWSEngine(const char *name, const char *title);
52 
53  Bool_t fReady; ///<! indicate if websocket get ready flag to send bigger amount of data
54  Bool_t fModified; ///<! true when canvas was modified
55  Bool_t fGetMenu; ///<! true when menu was requested
56  TCanvas *fCanv; ///<! canvas associated with websocket
57 
58  void CheckModifiedFlag();
59 
60 public:
61  virtual ~THttpWSEngine();
62 
63  virtual UInt_t GetId() const = 0;
64 
65  virtual void ClearHandle() = 0;
66 
67  virtual void Send(const void *buf, int len) = 0;
68 
69  virtual void SendCharStar(const char *str);
70 
71  virtual Bool_t PreviewData(THttpCallArg *) { return kFALSE; }
72 
73  // --------- method to work with Canvas (temporary solution)
74 
75  virtual void ProcessData(THttpCallArg *arg);
76 
77  virtual void AssignCanvas(TCanvas *canv);
78 
79  virtual void CanvasModified();
80 
81  ClassDef(THttpWSEngine, 0) // abstract class for working with WebSockets-like protocol
82 };
83 
84 #endif
THttpServer * GetServer() const
Returns pointer to THttpServer associated with engine.
Definition: THttpEngine.h:41
virtual void Process()
Method regularly called in main ROOT context.
Definition: THttpEngine.h:32
Bool_t fReady
! indicate if websocket get ready flag to send bigger amount of data
Definition: THttpEngine.h:53
virtual void ProcessData(THttpCallArg *arg)
process data received from the client
bool Bool_t
Definition: RtypesCore.h:59
virtual void Send(const void *buf, int len)=0
void SetServer(THttpServer *serv)
Definition: THttpEngine.h:29
virtual void AssignCanvas(TCanvas *canv)
assign canvas to the web socket connects with CanvasModified signal
virtual ~THttpEngine()
destructor
Definition: THttpEngine.cxx:46
virtual void SendCharStar(const char *str)
Envelope for sending string via the websocket.
Definition: THttpEngine.cxx:72
#define ClassDef(name, id)
Definition: Rtypes.h:297
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual Bool_t PreviewData(THttpCallArg *)
Definition: THttpEngine.h:71
THttpEngine(const char *name, const char *title)
normal constructor
Definition: THttpEngine.cxx:38
Bool_t fGetMenu
! true when menu was requested
Definition: THttpEngine.h:55
THttpServer * fServer
! object server
Definition: THttpEngine.h:25
virtual UInt_t GetId() const =0
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual Bool_t Create(const char *)
Method to create all components of engine.
Definition: THttpEngine.h:38
void CheckModifiedFlag()
if canvas was modified, send new copy to the client
Definition: THttpEngine.cxx:89
TCanvas * fCanv
! canvas associated with websocket
Definition: THttpEngine.h:56
const Bool_t kFALSE
Definition: RtypesCore.h:92
The Canvas class.
Definition: TCanvas.h:31
virtual void CanvasModified()
react on canvas modifications
Definition: THttpEngine.cxx:80
virtual ~THttpWSEngine()
destructor
Definition: THttpEngine.cxx:64
THttpWSEngine(const char *name, const char *title)
normal constructor
Definition: THttpEngine.cxx:56
Bool_t fModified
! true when canvas was modified
Definition: THttpEngine.h:54
virtual void ClearHandle()=0
char name[80]
Definition: TGX11.cxx:109