You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to change this line to also consider BT::AnyTypeAllowed. This would allow the user to correctly allow all types for a specific port.
When using BT::Any instead, the BT::TypeInfo of the port defines the functor for converting from string like here. This essentially breaks the scripting language because BT::convertFromString<BT::Any>() is illegal but will be called internally when a script is evaluated for a variable associated with a BT::Any port (This association is defined during tree initialization to validate types).
Therefore, I suggest to replace
ifconstexpr(std::is_same_v<BT::Any, T>)
{
if(config().manifest->ports.at(key).type() != typeid(BT::Any))
{
throwLogicError("setOutput<Any> is not allowed, unless the port ""was declared using OutputPort<Any>");
}
}
with this
ifconstexpr(std::is_same_v<BT::Any, T>)
{
const std::type_index type = config().manifest->ports.at(key).type();
if(type != typeid(BT::Any) && type != typeid(BT::AnyTypeAllowed))
{
throwLogicError("setOutput<BT::Any> is not allowed, unless the port ""was declared using OutputPort<BT::Any> or ""OutputPort<BT::AnyTypeAllowed>");
}
}
It would be nice if what I'm trying to do here would be possible with BT::Any alone but I guess this requires to dig deep in the type validation and scripting logic.
The text was updated successfully, but these errors were encountered:
I would like to change this line to also consider
BT::AnyTypeAllowed
. This would allow the user to correctly allow all types for a specific port.When using
BT::Any
instead, theBT::TypeInfo
of the port defines the functor for converting from string like here. This essentially breaks the scripting language becauseBT::convertFromString<BT::Any>()
is illegal but will be called internally when a script is evaluated for a variable associated with aBT::Any
port (This association is defined during tree initialization to validate types).Therefore, I suggest to replace
with this
from here.
It would be nice if what I'm trying to do here would be possible with
BT::Any
alone but I guess this requires to dig deep in the type validation and scripting logic.The text was updated successfully, but these errors were encountered: