Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp_node_v1.hpp
Go to the documentation of this file.
1// pulp/native_components/pulp_node_v1.hpp — C++ conveniences over the public
2// node ABI. Adds NOTHING to the ABI; the contract is pulp_node_v1.h.
3#pragma once
4
6
7#include <cstddef>
8#include <cstdint>
9#include <type_traits>
10
12
13inline constexpr std::uint32_t kNodeAbiMajor = PULP_NODE_V1_ABI_MAJOR;
14inline constexpr std::size_t kNodeEntryMinimumSize =
15 offsetof(pulp_node_entry_v1, descriptor)
16 + sizeof(((pulp_node_entry_v1*)nullptr)->descriptor);
17
18// The public node ABI major tracks the runtime node-ABI generation
19// (pulp::PULP_NODE_ABI_VERSION in <pulp/runtime/node_abi.hpp>) so a single
20// number identifies the node interface across the source API (CustomNodeType)
21// and this frozen binary ABI. That cross-module equality is asserted in the
22// test (test_pulp_node_v1.cpp) rather than here, so this header — and the
23// pulp::native-components module — stays dependency-free.
24
25// True when an entry advertises a compatible ABI. Same-major + at least the
26// minimum size (through the first required callback) is accepted; trailing
27// fields a newer node adds are ignored by an older host.
28inline bool node_is_compatible(const pulp_node_entry_v1* entry) noexcept {
29 return entry != nullptr && entry->abi_major == kNodeAbiMajor &&
30 entry->size >= kNodeEntryMinimumSize;
31}
32
33// Every boundary struct must be a C-compatible POD.
34static_assert(std::is_standard_layout_v<pulp_node_descriptor_v1>);
35static_assert(std::is_trivially_copyable_v<pulp_node_descriptor_v1>);
36static_assert(std::is_standard_layout_v<pulp_node_audio_v1>);
37static_assert(std::is_standard_layout_v<pulp_node_prepare_v1>);
38static_assert(std::is_standard_layout_v<pulp_node_host_services_v1>);
39static_assert(std::is_standard_layout_v<pulp_node_writer_v1>);
40static_assert(std::is_standard_layout_v<pulp_node_entry_v1>);
41static_assert(std::is_trivially_copyable_v<pulp_node_entry_v1>);
42
43} // namespace pulp::native_components
Definition native_core.hpp:16
constexpr std::uint32_t kNodeAbiMajor
Definition pulp_node_v1.hpp:13
bool node_is_compatible(const pulp_node_entry_v1 *entry) noexcept
Definition pulp_node_v1.hpp:28
constexpr std::size_t kNodeEntryMinimumSize
Definition pulp_node_v1.hpp:14
#define PULP_NODE_V1_ABI_MAJOR
Definition pulp_node_v1.h:53
Definition pulp_node_v1.h:161