-
Notifications
You must be signed in to change notification settings - Fork 6
/
Object.cpp
59 lines (45 loc) · 1.17 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
57
58
59
// Copyright 2022 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#include "Object.h"
// std
#include <atomic>
#include <cstdarg>
namespace anari_ospray {
// Object definitions /////////////////////////////////////////////////////////
Object::Object(ANARIDataType type, OSPRayGlobalState *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;
}
OSPRayGlobalState *Object::deviceState() const
{
return (OSPRayGlobalState *)helium::BaseObject::m_state;
}
// UnknownObject definitions //////////////////////////////////////////////////
UnknownObject::UnknownObject(ANARIDataType type, OSPRayGlobalState *s)
: Object(type, s)
{
reportMessage(
ANARI_SEVERITY_WARNING, "created unknown %s", anari::toString(type));
}
bool UnknownObject::isValid() const
{
return false;
}
} // namespace anari_ospray
OSPRAY_ANARI_TYPEFOR_DEFINITION(anari_ospray::Object *);