cacheView.h
1 //
2 // Copyright 2025 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_EXEC_EXEC_CACHE_VIEW_H
8 #define PXR_EXEC_EXEC_CACHE_VIEW_H
9 
10 #include "pxr/pxr.h"
11 
12 #include "pxr/exec/exec/api.h"
13 
14 #include "pxr/base/tf/span.h"
15 #include "pxr/exec/vdf/dataManagerFacade.h"
16 
17 #include <memory>
18 #include <optional>
19 
20 PXR_NAMESPACE_OPEN_SCOPE
21 
22 class Exec_ValueExtractor;
24 class VdfMaskedOutput;
25 class VtValue;
26 
34 {
35 public:
37  Exec_CacheView() = default;
38 
40  Exec_CacheView(const Exec_CacheView &) = delete;
41 
46  EXEC_API
48 
49  EXEC_API
50  ~Exec_CacheView();
51 
57  EXEC_API
58  VtValue Get(int index) const;
59 
60 private:
61  friend class Exec_RequestImpl;
62 
63  // Constructs a cache view that extracts computed values from
64  // \p dataManager. The data manager must outlive the cache view.
66  const VdfDataManagerFacade dataManager,
69 
70  // Constructs a cache view that assumes ownership of an \p executor, so that
71  // it remains valid while computed values are extracted from it.
73  std::unique_ptr<VdfExecutorInterface> &&executor,
76 
77 private:
78  std::optional<const VdfDataManagerFacade> _dataManager;
79  const TfSpan<const VdfMaskedOutput> _outputs;
80  const TfSpan<const Exec_ValueExtractor> _extractors;
81  std::unique_ptr<VdfExecutorInterface> _executor;
82 };
83 
84 PXR_NAMESPACE_CLOSE_SCOPE
85 
86 #endif
EXEC_API VtValue Get(int index) const
Returns the computed value for the provided extraction index.
Contains data structures necessary to implement exec requests that are independent of scene descripti...
Definition: requestImpl.h:47
Class to hold on to an externally owned output and a mask.
Definition: maskedOutput.h:31
Exec_CacheView()=default
Constructs an invalid cache view.
Abstract base class for classes that execute a VdfNetwork to compute a requested set of values.
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:89
Facade that gives clients access to values cached on an executor, without exposing the entire VdfExec...
A view into values cached by ExecSystem.
Definition: cacheView.h:33