File: vtkPVPluginTracker.h

package info (click to toggle)
paraview 5.4.1%2Bdfsg4-3.1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 218,616 kB
  • sloc: cpp: 2,331,508; ansic: 322,365; python: 111,051; xml: 79,203; tcl: 47,013; yacc: 4,877; java: 4,438; perl: 3,238; sh: 2,920; lex: 1,908; f90: 748; makefile: 273; pascal: 228; objc: 83; fortran: 31
file content (137 lines) | stat: -rw-r--r-- 4,766 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*=========================================================================

  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.

=========================================================================*/
/**
 * @class   vtkPVPluginTracker
 * @brief   a global manager for each processes to keep track
 * of plugins loaded on that process.
 *
 * 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 "vtkObject.h"
#include "vtkPVClientServerCoreCoreModule.h" //needed for exports
#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) VTK_OVERRIDE;

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

  /**
   * 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*);

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

  //@{
  /**
   * 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);
  //@}

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

  /**
   * 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);

  //@{
  /**
   * 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);
  //@}

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

protected:
  vtkPVPluginTracker();
  ~vtkPVPluginTracker();

private:
  vtkPVPluginTracker(const vtkPVPluginTracker&) VTK_DELETE_FUNCTION;
  void operator=(const vtkPVPluginTracker&) VTK_DELETE_FUNCTION;

  class vtkPluginsList;
  vtkPluginsList* PluginsList;

  static vtkPluginSearchFunction StaticPluginSearchFunction;
};

#endif

// VTK-HeaderTest-Exclude: vtkPVPluginTracker.h