OpenCOVER
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
coVRPluginList.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 
8 #ifndef COVR_PLUGIN_LIST_H
9 #define COVR_PLUGIN_LIST_H
10 
24 #include "coVRDynLib.h"
25 #include "coVRPlugin.h"
26 #include <osg/Drawable>
27 #include <map>
28 
29 namespace covise
30 {
31 class Message;
32 };
33 
34 namespace osg
35 {
36 class Node;
37 class Group;
38 };
39 
40 namespace opencover
41 {
42 class RenderObject;
43 class coInteractor;
44 
45 class COVEREXPORT coVRPluginList
46 {
47  friend class coVRPluginSupport;
48  friend class OpenCOVER;
49 
50 public:
52  {
56  NumPluginDomains // keep last
57  };
58 
59  // plugin management functions
61  static coVRPluginList *instance();
63  void loadDefault();
64 
66  coVRPlugin *getPlugin(const char *name) const;
67 
69  coVRPlugin *addPlugin(const char *name, PluginDomain domain=Default);
70 
72  void unload(coVRPlugin *m);
73 
74  //
75  // methods forwarded to plugins
76 
78  void notify(int level, const char *text) const;
79 
81  void addNode(osg::Node *, const RenderObject *o = NULL, coVRPlugin *addingPlugin = NULL) const;
82 
84  void addObject(const RenderObject *container, osg::Group *root,
85  const RenderObject *geometry, const RenderObject *normals, const RenderObject *colors, const RenderObject *texture) const;
86 
88  void newInteractor(const RenderObject *container, coInteractor *it) const;
89 
91  bool requestInteraction(coInteractor *inter, osg::Node *triggerNode, bool isMouse);
92 
94  void coviseError(const char *error) const;
95 
97  void guiToRenderMsg(const char *msg) const;
98 
100  void removeObject(const char *objName, bool replaceFlag) const;
102  void removeNode(osg::Node *node, bool isGroup = false, osg::Node *realNode = NULL) const;
104  bool update() const;
106  void preFrame();
108  void postFrame() const;
110  void preDraw(osg::RenderInfo &renderInfo) const;
112  void preSwapBuffers(int windowNumber) const;
114  void clusterSyncDraw() const;
116  void postSwapBuffers(int windowNumber) const;
118  void param(const char *paramName, bool inMapLoading) const;
120  bool key(int type, int keySym, int mod) const;
122  bool userEvent(int mod) const;
124  void requestTimestep(int timestep);
126  void setTimestep(int timestep);
128  void message(int toWhom, int t, int l, const void *b) const;
131  void forwardMessage(int len, const void *buf) const;
133  void requestQuit(bool killSession) const;
135  bool sendVisMessage(const covise::Message *msg) const;
137  bool becomeCollaborativeMaster() const;
139  covise::Message *waitForVisMessage(int messageType) const;
141  bool executeAll() const;
143  void expandBoundingSphere(osg::BoundingSphere &bs) const;
144 
146  void commitTimestep(int t, coVRPlugin *caller);
147 
148  void unloadAllPlugins(PluginDomain domain=Default);
149 
150 private:
151  coVRPluginList();
152  ~coVRPluginList();
154  void init();
156  void init2();
158  void unloadQueued();
160  void manage(coVRPlugin *plug, PluginDomain domain);
162  void unmanage(coVRPlugin *plug);
163 
165  coVRPlugin *loadPlugin(const char *name, bool showErrors = true);
166 
167  void grabKeyboard(coVRPlugin *);
168  coVRPlugin *keyboardGrabber() const
169  {
170  return keyboardPlugin;
171  }
172  int pointerGrabbed;
173  coVRPlugin *keyboardPlugin;
174 
175  void grabViewer(coVRPlugin *);
176  coVRPlugin *viewerGrabber() const;
177  coVRPlugin *viewerPlugin = nullptr;
178 
179  static coVRPluginList *singleton;
180  void updateState();
181 
182  typedef std::map<std::string, coVRPlugin *> PluginMap;
183  PluginMap m_plugins;
184  std::vector<coVRPlugin *> m_loadedPlugins[NumPluginDomains];
185 
186  typedef std::vector<CO_SHLIB_HANDLE> HandleList;
187  HandleList m_unloadNext, m_unloadQueue;
188  int m_numOutstandingTimestepPlugins = 0;
189  int m_requestedTimestep = -1;
190  int m_currentTimestep = 0;
191 };
192 }
193 #endif
base class for data received from visualization systems (e.g. COVISE or Vistle)
Definition: RenderObject.h:146
abstract feedback class for interacting with parameters of visualization modules (e.g. COVISE or Vistle)
Definition: coInteractor.h:36
Definition: coVRPluginList.h:55
Definition: coVRPluginList.h:45
Definition: coVRPluginList.h:54
dynamic library loading
Definition: coVRPluginList.h:53
double OSGVRUIEXPORT mod(double a, double b)
make sure to clean up properly in the plugin&#39;s dtor
Definition: coVRPlugin.h:70
OpenCOVER plugin interface, derive plugins from coVRPlugin.
Definition: OpenCOVER.h:53
PluginDomain
Definition: coVRPluginList.h:51
Definition: coVRPluginSupport.h:191