VTK  9.0.2
vtkResourceFileLocator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkResourceFileLocator.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
32 #ifndef vtkResourceFileLocator_h
33 #define vtkResourceFileLocator_h
34 
35 #include "vtkCommonMiscModule.h" // For export macro
36 #include "vtkObject.h"
37 
38 #include <string> // needed for std::string
39 #include <vector> // needed for std::vector
40 
41 class VTKCOMMONMISC_EXPORT vtkResourceFileLocator : public vtkObject
42 {
43 public:
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
49 
57  VTK_LEGACY(void SetPrintDebugInformation(bool));
58  VTK_LEGACY(bool GetPrintDebugInformation());
59  VTK_LEGACY(void PrintDebugInformationOn());
60  VTK_LEGACY(void PrintDebugInformationOff());
62 
64 
68  vtkSetMacro(LogVerbosity, int);
69  vtkGetMacro(LogVerbosity, int);
71 
73 
78  virtual std::string Locate(const std::string& anchor, const std::string& landmark,
79  const std::string& defaultDir = std::string());
81 
83 
91  virtual std::string Locate(const std::string& anchor,
92  const std::vector<std::string>& landmark_prefixes, const std::string& landmark,
93  const std::string& defaultDir = std::string());
95 
97 
105  static std::string GetLibraryPathForSymbolUnix(const char* symbolname);
106  static std::string GetLibraryPathForSymbolWin32(const void* fptr);
108 
109 protected:
112 
113 private:
115  void operator=(const vtkResourceFileLocator&) = delete;
116 
117  int LogVerbosity;
118 };
119 
120 #if defined(_WIN32) && !defined(__CYGWIN__)
121 #define vtkGetLibraryPathForSymbol(function) \
122  vtkResourceFileLocator::GetLibraryPathForSymbolWin32(reinterpret_cast<const void*>(&function))
123 #else
124 #define vtkGetLibraryPathForSymbol(function) \
125  vtkResourceFileLocator::GetLibraryPathForSymbolUnix(#function)
126 #endif
127 
128 #endif
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:63
utility to locate resource files.
virtual std::string Locate(const std::string &anchor, const std::string &landmark, const std::string &defaultDir=std::string())
Given a starting anchor directory, look for the landmark file relative to the anchor.
void SetPrintDebugInformation(bool)
Enable/disable printing of testing of various path during Locate to stdout.
~vtkResourceFileLocator() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkResourceFileLocator * New()
static std::string GetLibraryPathForSymbolUnix(const char *symbolname)
Returns the name of the library providing the symbol.
virtual std::string Locate(const std::string &anchor, const std::vector< std::string > &landmark_prefixes, const std::string &landmark, const std::string &defaultDir=std::string())
This variant is used to look for landmark relative to the anchor using additional prefixes for the la...
static std::string GetLibraryPathForSymbolWin32(const void *fptr)
@ string
Definition: vtkX3D.h:496