HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDGT_Utils.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS:
7  */
8 
9 #ifndef __PDGT_UTILS_H__
10 #define __PDGT_UTILS_H__
11 
12 #include "PDGT_API.h"
13 
14 #include <UT/UT_KnownPath.h>
15 
16 class UT_StringArray;
17 class UT_StringHolder;
18 class UT_WorkBuffer;
19 
20 /**
21  * Utility functions for loading PDG type definitions from Python modules
22  * and shared libraries.
23  */
25 {
26 public:
27  /// Loads a shared library containing PDG type definitions, given a path
28  /// to the dso, the name of the function to call in the library and the
29  /// argument to that function.
30  static bool loadDSO(const UT_StringHolder& dso_path,
31  const UT_StringHolder& dso_function,
32  void* dso_arg);
33 
34  /// Loads shared libraries on the Houdini dso path that have the specified
35  /// dso_function and calls that function with the dso_arg.
36  static bool loadDSO(const UT_StringHolder& dso_function, void* dso_arg);
37 
38  /// Loads PDG types from all Python modules, and stores them in the module
39  /// specified by `type_module`. For example, in PDG the type_module is
40  /// set to `pdg.types`.
41  static bool loadPythonModules(const UT_StringHolder& type_module,
42  UT_WorkBuffer& errors);
43 
44  /// Loads PDG types from a Python module at a specifc path on the system.
45  static bool loadPythonPath(const UT_StringHolder& type_module,
46  const UT_StringHolder& path,
47  UT_WorkBuffer& errors);
48 
49  /// Reloads the PDG type from the specified Python module.
50  static bool reloadPythonModule(const UT_StringHolder& type_module,
51  const UT_StringHolder& python_module,
52  bool reregister,
53  UT_WorkBuffer& errors);
54 
55  /// Returns the array of search paths for finding PDG types definitions.
56  static void searchPath(UT_StringArray& path_list,
57  UT_KnownPath search_instance);
58 
59  /// Finds the specified file name on the search path, and returns the
60  /// absolute path to the file.
61  static bool findFile(const UT_StringHolder& file_name,
62  UT_StringHolder& output_file,
63  UT_KnownPath search_instance);
64 
65 
66  /// Globs all files with the specified extension on the PDG search path,
67  /// with an optional subdirectory.
68  static bool globFiles(UT_StringArray& file_list,
69  UT_KnownPath search_instance,
71  const UT_StringHolder& subdirectory,
72  bool full_path);
73 
74  /// Globs all of the directories from the search path
75  static bool globDirectories(UT_StringArray& dir_list,
76  UT_KnownPath search_instance,
77  const UT_StringHolder& search,
78  bool full_path,
79  bool unique);
80 
81  /// Globs the list of import-able Python modules from the PDG type
82  /// search path.
83  static bool globPythonModules(UT_StringArray& file_list,
84  UT_KnownPath search_instance,
85  const UT_StringHolder& subdir,
86  bool full_path,
87  bool unique);
88 
89  /// Returns a list of directories/files to skip when globbing python
90  /// modules
91  static bool moduleSkipList(UT_StringArray& skip_list);
92 };
93 
94 #endif
#define PDGT_API
Definition: PDGT_API.h:23
UT_KnownPath
Definition: UT_KnownPath.h:14
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
auto search(const T &set, const V &val) -> std::pair< bool, decltype(std::begin(detail::smart_deref(set)))>
A search function.
Definition: CLI11.h:3170
I unique(I begin, I end)
Definition: pugixml.cpp:7195
OIIO_UTIL_API std::string extension(string_view filepath, bool include_dot=true) noexcept