VTK  9.7.1
vtkResourceFileLocator.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
23 #ifndef vtkResourceFileLocator_h
24 #define vtkResourceFileLocator_h
25 
26 #include "vtkCommonMiscModule.h" // For export macro
27 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_6_0
28 #include "vtkObject.h"
29 
30 #include <string> // needed for std::string
31 #include <vector> // needed for std::vector
32 
33 VTK_ABI_NAMESPACE_BEGIN
34 class VTKCOMMONMISC_EXPORT vtkResourceFileLocator : public vtkObject
35 {
36 public:
37  static vtkResourceFileLocator* New();
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
42 
46  vtkSetMacro(LogVerbosity, int);
47  vtkGetMacro(LogVerbosity, int);
49 
55  virtual std::string Locate(const std::string& anchor, const std::string& landmark,
56  const std::string& defaultDir = std::string());
57 
66  virtual std::string Locate(const std::string& anchor,
67  const std::vector<std::string>& landmark_prefixes, const std::string& landmark,
68  const std::string& defaultDir = std::string());
69 
73  static VTK_FILEPATH std::string GetLibraryPathForAddress(const void* ptr);
74 
78  static VTK_FILEPATH std::string GetCurrentExecutablePath();
79 
81 
89  VTK_DEPRECATED_IN_9_6_0("Use GetLibraryPathForAddress() instead")
90  static VTK_FILEPATH std::string GetLibraryPathForSymbolUnix(const char* symbolname);
91  VTK_DEPRECATED_IN_9_6_0("Use GetLibraryPathForAddress() instead")
92  static VTK_FILEPATH std::string GetLibraryPathForSymbolWin32(const void* fptr);
94 
95 protected:
97  ~vtkResourceFileLocator() override;
98 
99 private:
100  vtkResourceFileLocator(const vtkResourceFileLocator&) = delete;
101  void operator=(const vtkResourceFileLocator&) = delete;
102 
103  int LogVerbosity;
104 };
105 
106 #define vtkGetLibraryPathForSymbol(function) \
107  vtkResourceFileLocator::GetLibraryPathForAddress(reinterpret_cast<const void*>(&function))
108 
109 VTK_ABI_NAMESPACE_END
110 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
#define VTK_DEPRECATED_IN_9_6_0(reason)
a simple class to control print indentation
Definition: vtkIndent.h:28
utility to locate resource files.
#define VTK_FILEPATH
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...