forked from KhronosGroup/ANARI-SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Object.cpp
56 lines (42 loc) · 1.06 KB
/
Object.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright 2022-2024 The Khronos Group
// SPDX-License-Identifier: Apache-2.0
#include "Object.h"
// std
#include <atomic>
#include <cstdarg>
namespace helide {
// Object definitions /////////////////////////////////////////////////////////
Object::Object(ANARIDataType type, HelideGlobalState *s)
: helium::BaseObject(type, s)
{}
void Object::commit()
{
// no-op
}
bool Object::getProperty(
const std::string_view &name, ANARIDataType type, void *ptr, uint32_t flags)
{
if (name == "valid" && type == ANARI_BOOL) {
helium::writeToVoidP(ptr, isValid());
return true;
}
return false;
}
bool Object::isValid() const
{
return true;
}
HelideGlobalState *Object::deviceState() const
{
return (HelideGlobalState *)helium::BaseObject::m_state;
}
// UnknownObject definitions //////////////////////////////////////////////////
UnknownObject::UnknownObject(ANARIDataType type, HelideGlobalState *s)
: Object(type, s)
{}
bool UnknownObject::isValid() const
{
return false;
}
} // namespace helide
HELIDE_ANARI_TYPEFOR_DEFINITION(helide::Object *);