File: vtkPVPluginTracker.h

package info (click to toggle)
paraview 5.1.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 221,108 kB
  • ctags: 236,092
  • sloc: cpp: 2,416,026; ansic: 190,891; python: 99,856; xml: 81,001; tcl: 46,915; yacc: 5,039; java: 4,413; perl: 3,108; sh: 1,974; lex: 1,926; f90: 748; asm: 471; pascal: 228; makefile: 198; objc: 83; fortran: 31
file content (122 lines) | stat: -rw-r--r-- 4,767 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*=========================================================================

  Program:   ParaView
  Module:    vtkPVPluginTracker.h

  Copyright (c) Kitware, Inc.
  All rights reserved.
  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME vtkPVPluginTracker - a global manager for each processes to keep track
// of plugins loaded on that process.
// .SECTION Description
// vtkPVPluginTracker is a singleton that's present on each process to keep
// track of plugins loaded on that process. Whenever is plugin is loaded (either
// statically using PV_PLUGIN_IMPORT() or dynamically, it gets registered with
// the  on every process that it is loaded.
// Whenever a plugin is registered, this class fires a vtkCommand::RegisterEvent
// that handlers can listen to, to process the plugin.
#ifndef vtkPVPluginTracker_h
#define vtkPVPluginTracker_h

#include "vtkPVClientServerCoreCoreModule.h" //needed for exports
#include "vtkObject.h"
#include "vtkSmartPointer.h" // needed  for vtkSmartPointer;

class vtkPVPlugin;
class vtkPVXMLElement;

typedef bool (*vtkPluginSearchFunction)(const char*);

class VTKPVCLIENTSERVERCORECORE_EXPORT  vtkPVPluginTracker : public vtkObject
{
public:
  static vtkPVPluginTracker* New();
  vtkTypeMacro(vtkPVPluginTracker, vtkObject);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Provides access to the singleton. This will create the vtkPVPluginTracker
  // singleton the first time this method is called.
  static vtkPVPluginTracker* GetInstance();

  // Description:
  // Called by vtkPVPluginLoader after a plugin is loaded on the process. This
  // registers the plugin instance with the manager. It fires an event
  // (vtkCommand::RegisterEvent)
  // signalling that a plugin was loaded. Handlers that the process the plugin
  // by detecting the interfaces implemented by the plugin and the processing
  // those on a case-by-case basis.
  // Note there's no call to unregister a plugin. Once a plugin has been loaded,
  // it cannot be unloaded for the lifetime of the process.
  void RegisterPlugin(vtkPVPlugin*);

  // Description:
  // This API is used to register available plugins without actually loading
  // them.
  unsigned int RegisterAvailablePlugin(const char* filename);

  // Description:
  // Called to load application-specific configuration xml. The xml is of the
  // form:
  // @code
  // <Plugins>
  //    <Plugin name="[plugin name]" filename="[optionnal file name] auto_load="[bool]" />
  //       ...
  // </Plugins>
  // @endcode
  // This method will process the XML, locate the plugin shared library and
  // either load the plugin or call RegisterAvailablePlugin based on the status
  // of the auto_load flag. auto_load flag is optionnal and is 0 by default.
  // filaname is also optionnal, if not provided this method will look in 
  // different place to find the plugin, eg. paraview lib dir. It will NOT look
  // in PV_PLUGIN_PATH.
  void LoadPluginConfigurationXML(const char* filename, bool forceLoad = false);
  void LoadPluginConfigurationXML(vtkPVXMLElement*, bool forceLoad = false);
  void LoadPluginConfigurationXMLFromString(const char* xmlcontents, bool forceLoad = false);

  // Description:
  // Methods to iterate over registered plugins.
  unsigned int GetNumberOfPlugins();

  // Description:
  // Returns the plugin instance. This is non-null only for loaded plugins. If
  // a plugin was merely registered as a "available" plugin, then one can only
  // use the methods to query some primitive information about that plugin.
  vtkPVPlugin* GetPlugin(unsigned int index);

  // Description:
  // This is provided for wrapped languages since they can't directly access the
  // vtkPVPlugin instance.
  const char* GetPluginName(unsigned int index);
  const char* GetPluginFileName(unsigned int index);
  bool GetPluginLoaded(unsigned int index);
  bool GetPluginAutoLoad(unsigned int index);

  // Description:
  // Sets the function used to load static plugins.
  static void SetStaticPluginSearchFunction(vtkPluginSearchFunction function);

protected:
  vtkPVPluginTracker();
  ~vtkPVPluginTracker();

private:
  vtkPVPluginTracker(const vtkPVPluginTracker&); // Not implemented
  void operator=(const vtkPVPluginTracker&); // Not implemented

  class vtkPluginsList;
  vtkPluginsList* PluginsList;

  static vtkPluginSearchFunction StaticPluginSearchFunction;

};

#endif

// VTK-HeaderTest-Exclude: vtkPVPluginTracker.h