OpenIG  2.0.4
cross-platform open-source OpenSceneGraph Image Generator
Plugin.h
1 //#******************************************************************************
2 //#*
3 //#* Copyright (C) 2015 Compro Computer Services
4 //#* http://openig.compro.net
5 //#*
6 //#* Source available at: https://github.com/CCSI-CSSI/MuseOpenIG
7 //#*
8 //#* This software is released under the LGPL.
9 //#*
10 //#* This software is free software; you can redistribute it and/or modify
11 //#* it under the terms of the GNU Lesser General Public License as published
12 //#* by the Free Software Foundation; either version 2.1 of the License, or
13 //#* (at your option) any later version.
14 //#*
15 //#* This software is distributed in the hope that it will be useful,
16 //#* but WITHOUT ANY WARRANTY; without even the implied warranty of
17 //#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
18 //#* the GNU Lesser General Public License for more details.
19 //#*
20 //#* You should have received a copy of the GNU Lesser General Public License
21 //#* along with this library; if not, write to the Free Software
22 //#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 //#*
24 //#* Please direct any questions or comments to the OpenIG Forums
25 //#* Email address: openig@compro.net
26 //#*
27 //#*
28 //#* Please direct any questions or comments to the OpenIG Forums
29 //#* Email address: openig@compro.net
30 //#*
31 //#*
32 //#*****************************************************************************
33 #ifndef PLUGIN_H
34 #define PLUGIN_H
35 
36 #if defined(OPENIG_SDK)
37  #include <OpenIG-PluginBase/Export.h>
38  #include <OpenIG-PluginBase/PluginContext.h>
39 #else
40  #include <Core-PluginBase/Export.h>
41  #include <Core-PluginBase/PluginContext.h>
42 #endif
43 
44 #include <string>
45 
46 #include <osg/Referenced>
47 #include <osg/Node>
48 
49 namespace OpenIG {
50  namespace PluginBase {
51 
52  class PluginHost;
53 
134  class IGPLUGINCORE_EXPORT Plugin : public osg::Referenced
135  {
136  public:
137  friend class PluginHost;
145  : osg::Referenced()
146  , _orderNumber(0)
147  {}
148 
159  virtual std::string getName() = 0;
160 
169  virtual std::string getDescription() = 0;
170 
178  virtual std::string getVersion() = 0;
179 
187  virtual std::string getAuthor() = 0;
188 
197  std::string getLibrary() const { return _library; }
198 
209  int getOrderNumber() const { return _orderNumber; }
210 
223  virtual void databaseRead(const std::string&, osg::Node*, const osgDB::Options*) {}
224 
237  virtual void databaseReadInVisitorBeforeTraverse(osg::Node&, const osgDB::Options*) {}
238 
251  virtual void databaseReadInVisitorAfterTraverse(osg::Node&) {}
252 
262  virtual void config(const std::string&) {}
263 
273  virtual void init(PluginContext&) {}
274 
282  virtual void update(PluginContext&) {}
283 
292  virtual void preFrame(PluginContext&, double) {}
293 
302  virtual void postFrame(PluginContext&, double) {}
303 
312  virtual void clean(PluginContext&) {}
313 
327  virtual void entityAdded(PluginContext&, unsigned int, osg::Node&, const std::string&) {}
328 
336  virtual void beginningOfFrame(PluginContext&) {}
337 
345  virtual void endOfFrame(PluginContext&) {}
346 
347  protected:
348  std::string _library;
358  void setLibrary(const std::string& library)
359  {
360  _library = library;
361  }
362 
371  void setOrderNumber(int orderNumber)
372  {
373  _orderNumber = orderNumber;
374  }
375  };
376 
377  }
378 } // namespace
379 
380 #endif // PLUGIN_H
Definition: ImageGenerator.h:62
virtual void databaseReadInVisitorAfterTraverse(osg::Node &)
Hook for begining of the loaded model traveral.
Definition: Plugin.h:251
virtual void beginningOfFrame(PluginContext &)
Hook called on the very beginning of the frame before any processing.
Definition: Plugin.h:336
virtual void postFrame(PluginContext &, double)
Postframe hook.
Definition: Plugin.h:302
The PluginHost class.
Definition: PluginHost.h:61
Plugin()
Constructor.
Definition: Plugin.h:144
The Plugin class.
Definition: Plugin.h:134
virtual void clean(PluginContext &)
Method called on exit to give the user chance to perform cleanup.
Definition: Plugin.h:312
std::string getLibrary() const
The shared library name where the plugin is defined.
Definition: Plugin.h:197
virtual void preFrame(PluginContext &, double)
Preframe hook.
Definition: Plugin.h:292
void setOrderNumber(int orderNumber)
Sets the plugin order number.
Definition: Plugin.h:371
int getOrderNumber() const
The order number of the plugin.
Definition: Plugin.h:209
virtual void update(PluginContext &)
Update hook.
Definition: Plugin.h:282
virtual void databaseRead(const std::string &, osg::Node *, const osgDB::Options *)
Hook for database read.
Definition: Plugin.h:223
The PluginContext class.
Definition: PluginContext.h:59
virtual void endOfFrame(PluginContext &)
Hook called on the end of the frame after all the frame processing.
Definition: Plugin.h:345
virtual void databaseReadInVisitorBeforeTraverse(osg::Node &, const osgDB::Options *)
Hook for begining of the loaded model traveral.
Definition: Plugin.h:237
virtual void init(PluginContext &)
Method to init the plugin with a given igplugincore::PluginContext.
Definition: Plugin.h:273
void setLibrary(const std::string &library)
The order number of the plugin. See igplugincore::Plugin::getOrderNumber.
Definition: Plugin.h:358
virtual void entityAdded(PluginContext &, unsigned int, osg::Node &, const std::string &)
Hook called when OpenIG::Base::Entity is added to the scene.
Definition: Plugin.h:327
int _orderNumber
The shared library file name where this plugin is implemented.
Definition: Plugin.h:349
virtual void config(const std::string &)
Method to configure the plugin from a XML file.
Definition: Plugin.h:262