OWL
Loading...
Searching...
No Matches
APIContext.h
1// ======================================================================== //
2// Copyright 2019-2020 Ingo Wald //
3// //
4// Licensed under the Apache License, Version 2.0 (the "License"); //
5// you may not use this file except in compliance with the License. //
6// You may obtain a copy of the License at //
7// //
8// http://www.apache.org/licenses/LICENSE-2.0 //
9// //
10// Unless required by applicable law or agreed to in writing, software //
11// distributed under the License is distributed on an "AS IS" BASIS, //
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
13// See the License for the specific language governing permissions and //
14// limitations under the License. //
15// ======================================================================== //
16
17#include "owl/Context.h"
18#include <mutex>
19
20namespace owl {
21
22 struct APIHandle;
23
24 struct APIContext : public Context {
25 typedef std::shared_ptr<APIContext> SP;
26
27 APIContext(int32_t *requestedDeviceIDs,
28 int numRequestedDevices)
29 : Context(requestedDeviceIDs,
30 numRequestedDevices)
31 {}
32
34 virtual std::string toString() const override { return "owl::APIContext"; }
35
36 APIHandle *createHandle(Object::SP object);
37
38 void track(APIHandle *object);
39
40 void forget(APIHandle *object);
41
44 void releaseAll();
45
46 std::set<APIHandle *> activeHandles;
47 std::mutex monitor;
48 };
49
50} // ::owl
Definition: APIContext.h:24
virtual std::string toString() const override
Definition: APIContext.h:34
void releaseAll()
Definition: APIContext.cpp:47
Definition: APIHandle.h:34
Definition: Context.h:32