VTK  9.3.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 "vtkObject.h"
28 
29 #include <string> // needed for std::string
30 #include <vector> // needed for std::vector
31 
32 VTK_ABI_NAMESPACE_BEGIN
33 class VTKCOMMONMISC_EXPORT vtkResourceFileLocator : public vtkObject
34 {
35 public:
36  static vtkResourceFileLocator* New();
38  void PrintSelf(ostream& os, vtkIndent indent) override;
39 
41 
45  vtkSetMacro(LogVerbosity, int);
46  vtkGetMacro(LogVerbosity, int);
48 
50 
55  virtual std::string Locate(const std::string& anchor, const std::string& landmark,
56  const std::string& defaultDir = std::string());
58 
60 
68  virtual std::string Locate(const std::string& anchor,
69  const std::vector<std::string>& landmark_prefixes, const std::string& landmark,
70  const std::string& defaultDir = std::string());
72 
74 
82  static VTK_FILEPATH std::string GetLibraryPathForSymbolUnix(const char* symbolname);
83  static VTK_FILEPATH std::string GetLibraryPathForSymbolWin32(const void* fptr);
85 
86 protected:
88  ~vtkResourceFileLocator() override;
89 
90 private:
92  void operator=(const vtkResourceFileLocator&) = delete;
93 
94  int LogVerbosity;
95 };
96 
97 #if defined(_WIN32) && !defined(__CYGWIN__)
98 #define vtkGetLibraryPathForSymbol(function) \
99  vtkResourceFileLocator::GetLibraryPathForSymbolWin32(reinterpret_cast<const void*>(&function))
100 #else
101 #define vtkGetLibraryPathForSymbol(function) \
102  vtkResourceFileLocator::GetLibraryPathForSymbolUnix(#function)
103 #endif
104 
105 VTK_ABI_NAMESPACE_END
106 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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...