MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ expose_form()

template<typename Source, typename Access = Reflect::RecordAccess<Source>>
template<auto Function>
requires Reflect::DescribedFunction<Function>
void MayaFlux::Portal::Forma::CallTable< Source, Access >::expose_form ( std::string name = {})
inline

Register a described function that returns a Geometry::Form.

Template Parameters
FunctionPointer to the function, such as &Geometry::horizontal_fader.
Parameters
nameThe name a document calls it by, the function's own name when empty.

Definition at line 201 of file CallTable.hpp.

201 {})
202 {
203 using Traits = Detail::FunctionTraits<decltype(Function)>;
205
206 if (name.empty()) {
208 name = std::string(full.substr(full.rfind("::") == std::string_view::npos ? 0 : full.rfind("::") + 2));
209 }
210
211 m_makers.insert_or_assign(std::move(name),
212 Maker([](const Source& call, const Source& element, const ElementHit& hit,
215 if (!form)
216 return std::nullopt;
217
218 State initial {};
223 "<" + std::string(Access::name(element)) + "> has an invalid state of " + std::string(*text));
224 return std::nullopt;
225 }
226 }
227
228 apply_hit(*form, hit);
230 }));
231 }
std::function< std::optional< Placer >(const Source &, const Source &, const ElementHit &, std::string &)> Maker
Functions a document calls by name, with the function's own parameter names as attributes.
std::optional< typename FunctionTraits< decltype(Function)>::Result > call_described(const Source &call, std::string &error)
Calls a described function with the arguments an element's attributes give by parameter name.
Definition CallTable.hpp:96
Placer form_placer(Geometry::Form< State > form, State initial)
A Placer that places a form with an initial state on a Surface and returns its element id.
Definition CallTable.hpp:44
void apply_hit(Geometry::Form< T > &form, const ElementHit &hit)
Write a document's spatial fields after a form's own.
std::string located_message(uint64_t location, std::string_view message)
A diagnostic message prefixed with the location of the element it concerns.