Changeset 22:e2e8d05ef4e4 in finroc_plugins_composite_ports
- Timestamp:
- 02.03.2021 00:15:46 (2 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
internal/type_traits.h
r16 r22 229 229 using MakeCounterPartParameterIfInput = MakeCounterDirectionPort<TPort, true>; 230 230 231 template <template <typename> class TPort, bool TServer >231 template <template <typename> class TPort, bool TServer, bool TClient> 232 232 struct MakeRPCPort 233 233 { 234 234 template <typename T> 235 using type = core::tPortWrapperBase; 236 }; 237 template <template <typename> class TPort> 238 struct MakeRPCPort<TPort, false, true> 239 { 240 template <typename T> 235 241 using base_type = typename std::conditional < std::is_base_of<data_ports::tProxyPort<tTestType, false>, TPort<tTestType>>::value || std::is_base_of<data_ports::tProxyPort<tTestType, true>, TPort<tTestType>>::value, rpc_ports::tProxyPort<T, false>, rpc_ports::tClientPort<T >>::type; 236 242 … … 239 245 }; 240 246 template <template <typename> class TPort> 241 struct MakeRPCPort<TPort, true >247 struct MakeRPCPort<TPort, true, false> 242 248 { 243 249 template <typename T> … … 249 255 250 256 template <template <typename> class TPort> 251 using MakeServerIfInput = MakeRPCPort<TPort, IsInputPort<TPort>::value >;252 template <template <typename> class TPort> 253 using MakeClientIfInput = MakeRPCPort<TPort, IsOutputPort<TPort>::value >;257 using MakeServerIfInput = MakeRPCPort<TPort, IsInputPort<TPort>::value, IsOutputPort<TPort>::value>; 258 template <template <typename> class TPort> 259 using MakeClientIfInput = MakeRPCPort<TPort, IsOutputPort<TPort>::value, IsInputPort<TPort>::value>; 254 260 255 261 -
tInterfaceBase.cpp
r21 r22 337 337 bool tInterfaceBase::tBackend::CreateOutputPort(int primary_relation_id) 338 338 { 339 auto* backend = GetBackend(primary_relation_id); 340 if (backend->GetFlag(tFlag::INTERFACE_FOR_OUTPUTS)) 341 { 342 return true; 343 } 344 if (backend->GetFlag(tFlag::INTERFACE_FOR_INPUTS) || backend->GetFlag(tFlag::PARAMETER_INTERFACE)) 339 auto backend = GetBackend(primary_relation_id); 340 if (!backend) 345 341 { 346 342 return false; 347 343 } 348 if (backend->GetFlag(tFlag::INTERFACE_FOR_RPC_PORTS)) 344 auto component_interface = GetAggregator(*backend); 345 if ((!component_interface) || (!internal::IsComponent(component_interface->GetParent()))) 346 { 347 return false; 348 } 349 if (component_interface->GetFlag(tFlag::INTERFACE_FOR_RPC_PORTS)) 349 350 { 350 351 int last_relation = primary_relation_id & 0xFF; … … 358 359 return derived_from_backend_is_output; 359 360 } 361 } 362 if (component_interface->GetFlag(tFlag::INTERFACE_FOR_OUTPUTS)) 363 { 364 return true; 365 } 366 if (component_interface->GetFlag(tFlag::INTERFACE_FOR_INPUTS) || component_interface->GetFlag(tFlag::PARAMETER_INTERFACE)) 367 { 368 return false; 360 369 } 361 370 throw std::runtime_error("Unspecified port direction"); … … 424 433 } 425 434 426 tFrameworkElement* parent_candidate = (relation_list.empty() && do_not_create_primary_port_type)? nullptr : component_interface;435 tFrameworkElement* parent_candidate = do_not_create_primary_port_type ? nullptr : component_interface; 427 436 core::tFrameworkElementFlags use_these_original_flags; 428 437 if (do_not_create_primary_port_type) … … 503 512 case internal::tPortTypeRelation::ePTR_CLIENT_IF_INPUT: 504 513 target_set_flags = tFlag::INTERFACE_FOR_RPC_PORTS; 505 target_unset_flags = core::tFrameworkElementFlags();514 target_unset_flags = (partial_interface && (!parent_candidate)) ? target_set_flags : core::tFrameworkElementFlags(); // With partially instantiated interfaces, create service ports if the port types they are derived from are also created 506 515 break; 507 516 default: … … 525 534 } 526 535 527 if ((!new_candidate) && this->IsPartialInterface() && ((partial_interface_direction_is_output && (!target_set_flags.Get(tFlag::INTERFACE_FOR_OUTPUTS))) || ((!partial_interface_direction_is_output) && target_set_flags.Get(tFlag::INTERFACE_FOR_OUTPUTS)) ))536 if ((!new_candidate) && this->IsPartialInterface() && ((partial_interface_direction_is_output && (!target_set_flags.Get(tFlag::INTERFACE_FOR_OUTPUTS))) || ((!partial_interface_direction_is_output) && target_set_flags.Get(tFlag::INTERFACE_FOR_OUTPUTS)) || target_set_flags.Get(tFlag::INTERFACE_FOR_RPC_PORTS))) 528 537 { 529 538 use_these_original_flags = target_set_flags; -
tInterfaceBase.h
r20 r22 235 235 236 236 /*! 237 * \param any_port_typeWhether backend is a generic port (-> unspecified whether input or output)237 * \param generic_port_backend Whether backend is a generic port (-> unspecified whether input or output) 238 238 * \return Default port flags for ports below this backend 239 239 */
Note: See TracChangeset
for help on using the changeset viewer.