All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
info.h
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PLUG_INFO_H
25 #define PLUG_INFO_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/base/arch/attributes.h"
29 #include "pxr/base/js/value.h"
30 
31 #include <functional>
32 #include <memory>
33 #include <string>
34 #include <vector>
35 
36 PXR_NAMESPACE_OPEN_SCOPE
37 
38 class JsValue;
39 
41 class Plug_RegistrationMetadata {
42 public:
43  enum Type {
44  UnknownType,
45  LibraryType,
46 #ifdef PXR_PYTHON_SUPPORT_ENABLED
47  PythonType,
48 #endif // PXR_PYTHON_SUPPORT_ENABLED
49  ResourceType
50  };
51 
52  Plug_RegistrationMetadata() : type(UnknownType) { }
53  Plug_RegistrationMetadata(const JsValue&,
54  const std::string& valuePathname,
55  const std::string& locationForErrorReporting);
56 
57  Type type;
58  std::string pluginName;
59  std::string pluginPath;
60  JsObject plugInfo;
61  std::string libraryPath;
62  std::string resourcePath;
63 };
64 
66 class Plug_TaskArena {
67 public:
68  class Synchronous { }; // For single-threaded debugging.
69  Plug_TaskArena();
70  Plug_TaskArena(Synchronous);
71  ~Plug_TaskArena();
72 
74  template <class Fn>
75  void Run(Fn const &fn);
76 
78  void Wait();
79 
80 private:
81  class _Impl;
82  std::unique_ptr<_Impl> _impl;
83 };
84 
94 void
95 Plug_ReadPlugInfo(
96  const std::vector<std::string>& pathnames,
97  const std::function<bool (const std::string&)>& addVisitedPath,
98  const std::function<void (const Plug_RegistrationMetadata&)>& addPlugin,
99  Plug_TaskArena* taskArena);
100 
102 void Plug_SetPaths(const std::vector<std::string>&);
103 
104 PXR_NAMESPACE_CLOSE_SCOPE
105 
106 #endif // PLUG_INFO_H
A discriminated union type for JSON values.
Definition: value.h:61