CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ModuleWeb.h
Go to the documentation of this file.
1 #ifndef EVF_MODULEWEB_H
2 #define EVF_MODULEWEB_H
3 
4 #include "toolbox/lang/Class.h"
5 #include "xdata/InfoSpace.h"
6 #include <string>
7 #include <pthread.h>
8 #include <semaphore.h>
9 
10 namespace xgi{
11  class Input;
12  class Output;
13 }
14 
15 
16 namespace evf
17 {
18 
19 
20 namespace moduleweb {
21  class ForkParams {
22  public:
24  int slotId;
25  bool restart;
26  int isMaster;
27  };
28  class ForkInfoObj {
29  public:
31  {
32  control_sem_ = new sem_t;
33  sem_init(control_sem_,0,0);
34  stopCondition=0;
35  receivedStop_=false;
36  }
38  {
39  sem_destroy(control_sem_);
40  delete control_sem_;
41  }
42  void lock() {if (mst_lock_) pthread_mutex_lock(mst_lock_);}
43  void unlock() {if (mst_lock_) pthread_mutex_unlock(mst_lock_);}
44  void (*forkHandler) (void *);
46  unsigned int stopCondition;
48  sem_t *control_sem_;
49  pthread_mutex_t * mst_lock_;
50  void * fuAddr;
51  };
52 }
53 
54  class ModuleWeb : public toolbox::lang::Class
55  {
56  public:
57  ModuleWeb(const std::string &);
58  virtual ~ModuleWeb(){}
59  virtual void defaultWebPage(xgi::Input *in, xgi::Output *out);
60  virtual void publish(xdata::InfoSpace *) = 0;
61  virtual void publishToXmas(xdata::InfoSpace *){};
62  protected:
63  std::string moduleName_;
64  private:
65  virtual void openBackDoor(unsigned int timeout_sec = 0, bool * started = 0){};
66  virtual void closeBackDoor(){};
67  virtual void publishForkInfo(moduleweb::ForkInfoObj *forkInfoObj);
68  friend class ModuleWebRegistry;
69  };
70 }
71 #endif
virtual void publishForkInfo(moduleweb::ForkInfoObj *forkInfoObj)
Definition: ModuleWeb.cc:21
#define Input(cl)
Definition: vmac.h:189
virtual void closeBackDoor()
Definition: ModuleWeb.h:66
virtual void publishToXmas(xdata::InfoSpace *)
Definition: ModuleWeb.h:61
void(* forkHandler)(void *)
Definition: ModuleWeb.h:44
unsigned int stopCondition
Definition: ModuleWeb.h:46
virtual void publish(xdata::InfoSpace *)=0
ModuleWeb(const std::string &)
Definition: ModuleWeb.cc:15
std::string moduleName_
Definition: ModuleWeb.h:61
tuple out
Definition: dbtoconf.py:99
virtual void defaultWebPage(xgi::Input *in, xgi::Output *out)
Definition: ModuleWeb.cc:27
pthread_mutex_t * mst_lock_
Definition: ModuleWeb.h:49
virtual void openBackDoor(unsigned int timeout_sec=0, bool *started=0)
Definition: ModuleWeb.h:65
#define Output(cl)
Definition: vmac.h:193
virtual ~ModuleWeb()
Definition: ModuleWeb.h:58