OpenCOVER
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OpenCOVER.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
20 #ifndef OPEN_COVER_H
21 #define OPEN_COVER_H
22 
23 #include <util/common.h>
25 
26 #ifdef HAS_MPI
27 #include <mpi.h>
28 #endif
29 
30 namespace covise
31 {
32 class VRBClient;
33 class Message;
34 }
35 
36 namespace opencover
37 {
38 namespace ui
39 {
40 class Action;
41 class Button;
42 class Group;
43 }
44 
45 class coHud;
46 class buttonSpecCell;
47 class coVRPlugin;
48 class coTabletUI;
49 class coTUITabFolder;
50 
51 extern COVEREXPORT covise::VRBClient *vrbc;
52 
53 class COVEREXPORT OpenCOVER
54 {
55 private:
56  vrui::coInteractionManager interactionManager;
57  bool exitFlag;
58  void readConfigFile();
59  void parseLine(char *line);
60  int frameNum;
61  char *vrbHost;
62  int vrbPort;
63  static OpenCOVER *s_instance;
64  double fl_time, old_fl_time;
65  float sum_time;
66  bool printFPS;
67  bool ignoreMouseEvents;
68 
69  void waitForWindowID();
70 
71  coVRPlugin *m_visPlugin;
72  bool m_forceMpi;
73 
74  ui::Group *m_quitGroup=nullptr;
75  ui::Action *m_quit=nullptr;
76  ui::Button *m_clusterStats=nullptr;
77 
78 public:
79  OpenCOVER();
80 #ifdef HAS_MPI
81  OpenCOVER(const MPI_Comm *comm);
82 #endif
83 #ifdef WIN32
84  OpenCOVER(HWND parentWindow);
85 #else
86  OpenCOVER(int parentWindow);
87 #endif
88  bool run();
89  bool init();
90  bool initDone();
91  ~OpenCOVER();
92  void loop();
93  bool frame();
94  void doneRendering();
95  void setExitFlag(bool flag);
97  {
98  return exitFlag;
99  }
100  static OpenCOVER *instance();
101  void handleEvents(int type, int state, int code);
105  double lastUpdateTime = -1.0, lastFrameTime = -1.0;
106  std::deque<double> frameDurations;
107  void setIgnoreMouseEvents(bool ign)
108  {
109  ignoreMouseEvents = ign;
110  }
111 #ifdef WIN32
112  HWND parentWindow;
113 #else
114  // should be Window from <X11/Xlib.h>
116 #endif
117 
118  void requestQuit();
119  coVRPlugin *visPlugin() const;
120 
121  size_t numTuis() const;
122  coTabletUI *tui(size_t idx) const;
123  coTUITabFolder *tuiTab(size_t idx) const;
124 
126  bool watchFileDescriptor(int fd);
128  bool unwatchFileDescriptor(int fd);
129 
130 private:
131 #ifdef HAS_MPI
132  MPI_Comm m_comm;
133 #endif
134  bool m_renderNext;
135  bool m_initialized = false;
136  std::vector<coTabletUI *> tabletUIs;
137  std::vector<coTUITabFolder *> tabletTabs;
138 
139  std::set<int> m_watchedFds;
140 };
141 }
142 #endif
double beginAppTraversal
Definition: OpenCOVER.h:103
double endAppTraversal
Definition: OpenCOVER.h:104
COVEREXPORT covise::VRBClient * vrbc
Definition: coHud.h:32
void setIgnoreMouseEvents(bool ign)
Definition: OpenCOVER.h:107
Definition: coInteractionManager.h:17
Definition: coTabletUI.h:76
Definition: coTabletUI.h:723
int parentWindow
Definition: OpenCOVER.h:115
make sure to clean up properly in the plugin&#39;s dtor
Definition: coVRPlugin.h:70
std::deque< double > frameDurations
Definition: OpenCOVER.h:106
int getExitFlag()
Definition: OpenCOVER.h:96
coHud * hud
Definition: OpenCOVER.h:102
Definition: OpenCOVER.h:53