LiveKit C++ Client SDK v1.1.0
Real-time audio/video/data SDK for C++
Loading...
Searching...
No Matches
ffi_handle.h
1/*
2 * Copyright 2025 LiveKit
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#pragma once
18
19#include <cstdint>
20
21#include "livekit/visibility.h"
22
23namespace livekit {
24
29class LIVEKIT_API FfiHandle {
30public:
31 explicit FfiHandle(uintptr_t h = 0) noexcept;
32 ~FfiHandle();
33
34 // Non-copyable
35 FfiHandle(const FfiHandle&) = delete;
36 FfiHandle& operator=(const FfiHandle&) = delete;
37
38 // Movable
39 FfiHandle(FfiHandle&& other) noexcept;
40 FfiHandle& operator=(FfiHandle&& other) noexcept;
41
43 void reset(uintptr_t new_handle = 0) noexcept;
44
46 [[nodiscard]] uintptr_t release() noexcept;
47
49 [[nodiscard]] bool valid() const noexcept;
50
52 [[nodiscard]] uintptr_t get() const noexcept;
53
55 explicit operator bool() const noexcept { return valid(); }
56
57private:
58 uintptr_t handle_{0};
59};
60
61} // namespace livekit
RAII wrapper for an FFI handle (uintptr_t) coming from Rust.
Definition ffi_handle.h:29
void reset(uintptr_t new_handle=0) noexcept
Replace the current handle with a new one, dropping the old if needed.
Public API for the LiveKit C++ Client SDK.
Definition audio_frame.h:25