VTK  9.4.20241219
vtkAnariDevice.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
13#ifndef vtkAnariDevice_h
14#define vtkAnariDevice_h
15
16#include "vtkObject.h"
17#include "vtkRenderingAnariModule.h" // For export macro
18
19#include <anari/anari_cpp.hpp> // for ANARI handles
20
21#include <functional> // for std::function
22
23VTK_ABI_NAMESPACE_BEGIN
24
25class vtkAnariDeviceInternals;
26
27class VTKRENDERINGANARI_EXPORT vtkAnariDevice : public vtkObject
28{
29public:
30 using OnNewDeviceCallback = std::function<void(anari::Device)>;
31
33 vtkTypeMacro(vtkAnariDevice, vtkObject);
34 void PrintSelf(ostream& os, vtkIndent indent) override;
35
41 void SetAnariDebugConfig(const char* traceDir, const char* traceMode);
42
50 const char* libraryName, const char* deviceName, bool enableDebugLayer = false);
51
55 bool AnariInitialized() const;
56
60 anari::Device GetHandle() const;
61
65 const anari::Extensions& GetAnariDeviceExtensions() const;
66
71
72protected:
77
81 virtual ~vtkAnariDevice();
82
83private:
84 vtkAnariDevice(const vtkAnariDevice&) = delete;
85 void operator=(const vtkAnariDevice&) = delete;
86
87 vtkAnariDeviceInternals* Internal{ nullptr };
88};
89
90VTK_ABI_NAMESPACE_END
91#endif
base class to objects which create + manage a ANARI library + device
anari::Device GetHandle() const
Get the current ANARI device, which will be NULL if not yet setup.
bool SetupAnariDeviceFromLibrary(const char *libraryName, const char *deviceName, bool enableDebugLayer=false)
Initialize this vtkAnariDevice from the name of an anari::Library and anari::Device to be loaded.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkAnariDevice * New()
vtkAnariDevice()
Default constructor.
bool AnariInitialized() const
Check if ANARI has been initialized with SetupAnariDeviceFromLibrary.
void SetAnariDebugConfig(const char *traceDir, const char *traceMode)
Setup the trace directory and trace mode strings for the debug device for when SetupAnariDeviceFromLi...
std::function< void(anari::Device)> OnNewDeviceCallback
virtual ~vtkAnariDevice()
Destructor.
const anari::Extensions & GetAnariDeviceExtensions() const
Get the current ANARI device extensions, which will be empty if not yet setup.
void SetOnNewDeviceCallback(OnNewDeviceCallback &&cb)
Set a callback that gets called whenever a new device has been created.
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162