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

◆ get_int()

std::optional< int32_t > MayaFlux::Core::InputValue::OSCMessage::get_int ( size_t  index = 0) const
noexcept

Extract an int32 argument by index.

float arguments are truncated to int32_t.

Parameters
indexArgument index (0-based).
Returns
Int value, or std::nullopt if out of range or wrong type.

Definition at line 135 of file InputBinding.cpp.

136{
137 if (index >= arguments.size())
138 return std::nullopt;
139 return std::visit([](const auto& v) -> std::optional<int32_t> {
140 using T = std::decay_t<decltype(v)>;
141 if constexpr (std::is_same_v<T, int32_t>)
142 return v;
143 if constexpr (std::is_same_v<T, float>)
144 return static_cast<int32_t>(v);
145 return std::nullopt;
146 },
148}
uint32_t index
Definition VKDevice.cpp:142
std::vector< OSCArg > arguments
Typed arguments.

References index.