runtime 1.1.4
Checked CEL programs, owned values, and reusable execution stacks
Loading...
Searching...
No Matches
callable.hpp
1// SPDX-License-Identifier: BSL-1.0
2#ifndef CEL_RUNTIME_CALLABLE_HPP
3#define CEL_RUNTIME_CALLABLE_HPP
4#include <cel/runtime/dyn_segment.hpp>
5
6namespace cel {
9
10namespace detail {
11struct callable_state;
12struct callable_access;
13class callable_invocation;
14} // namespace detail
40class callable {
41 detail::retirement_ptr<detail::callable_state> _state;
42 friend struct detail::callable_access;
43 friend class detail::callable_invocation;
44
45public:
61 callable(compiled_segment body, std::span<const value_type> parameters);
65 callable(const callable&) noexcept = default;
69 callable(callable&&) noexcept = default;
76 callable& operator=(const callable&) noexcept = default;
83 callable& operator=(callable&&) noexcept = default;
93 const value_type& type() const noexcept;
99 const stack_requirements& requirements() const noexcept;
120 value call(raw_stack& stack, std::span<const value> arguments) const;
138 static callable from_value(const value& source);
139};
140
142} // namespace cel
143#endif
const stack_requirements & requirements() const noexcept
Borrows known body storage requirements; external callback costs are not inferred.
callable(const callable &) noexcept=default
Shares the reference-semantic code handle, not an independent callback-state copy.
callable(callable &&) noexcept=default
Transfers the code handle.
value call(raw_stack &stack, std::span< const value > arguments) const
Executes declared positional inputs and returns one independent result owner.
static callable from_value(const value &source)
Returns a shared handle to the installed callable stored in source.
callable(compiled_segment body, std::span< const value_type > parameters)
Binds independent one-result code and every explicit source-order parameter.
value to_value() const
Creates an owning value carrier sharing this explicitly reference-semantic code.
const value_type & type() const noexcept
Borrows the full installed signature, including unused parameters.
A move-only handle to immutable frozen code and its captures.
Definition dyn_segment.hpp:646
An exclusive owner of reusable canonical operand storage.
Definition raw_stack.hpp:47
An immutable, shared semantic type with a canonical byte layout.
Definition value_type.hpp:65
Holds any type representable by CEL, including client-defined types.
Definition value.hpp:83
Byte extents for stack reservation and type descriptors.
Definition callable.hpp:6
The statically known storage requirements of a frozen ordinary program.
Definition dyn_segment.hpp:55