Changeset 11:ca584c3bd2d4 in finroc_plugins_composite_ports
- Timestamp:
- 26.03.2020 15:25:43 (3 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
auto_connect.cpp
r0 r11 33 33 // External includes (system with <>, local with "") 34 34 //---------------------------------------------------------------------- 35 #include "rrlib/rtti_conversion/tStaticCastOperation.h" 35 36 36 37 //---------------------------------------------------------------------- … … 137 138 } 138 139 140 void ConnectUnconnectedMatchingInterfaces(core::tPortGroup& source_component_interface, core::tPortGroup& destination_component_interface, bool connect_derived_interfaces) 141 { 142 for (auto destination_port = destination_component_interface.ChildPortsBegin(); destination_port != destination_component_interface.ChildPortsEnd(); ++destination_port) 143 { 144 if (destination_port->IsReady() && destination_port->GetDataType().GetTypeClassification() == rrlib::rtti::tTypeClassification::PORT_COMPOSITE_INTERFACE && destination_port->CountIncomingConnections() == 0) 145 { 146 for (auto source_port = source_component_interface.ChildPortsBegin(); source_port != source_component_interface.ChildPortsEnd(); ++source_port) 147 { 148 if (source_port->IsReady() && source_port->GetDataType().GetTypeClassification() == rrlib::rtti::tTypeClassification::PORT_COMPOSITE_INTERFACE && (source_port->GetDataType() == destination_port->GetDataType() || (connect_derived_interfaces && rrlib::rtti::conversion::tStaticCastOperation::IsImplicitlyConvertibleTo(source_port->GetDataType(), destination_port->GetDataType())))) 149 { 150 bool already_connected = false; 151 for (auto connector = source_port->OutgoingConnectionsBegin(); connector != source_port->OutgoingConnectionsEnd(); ++connector) 152 { 153 auto aggregator = core::tEdgeAggregator::GetAggregator(connector->Destination()); 154 if (aggregator == &destination_component_interface) 155 { 156 already_connected = true; 157 break; 158 } 159 } 160 if (!already_connected) 161 { 162 source_port->ConnectTo(*destination_port); 163 } 164 } 165 } 166 } 167 } 168 } 169 170 139 171 //---------------------------------------------------------------------- 140 172 // End of namespace declaration -
auto_connect.h
r0 r11 36 36 // External includes (system with <>, local with "") 37 37 //---------------------------------------------------------------------- 38 #include "core/port/tPortGroup.h" 38 39 39 40 //---------------------------------------------------------------------- … … 71 72 */ 72 73 template <typename TComponent, typename TInterface> 73 st atic std::string ConnectChildComponentInterfaces(TComponent& composite_component, std::vector<TInterface>& interfaces_variable, const std::string& common_prefix, size_t start_index = 1, const std::string& common_postfix = "");74 std::string ConnectChildComponentInterfaces(TComponent& composite_component, std::vector<TInterface>& interfaces_variable, const std::string& common_prefix, size_t start_index = 1, const std::string& common_postfix = ""); 74 75 75 76 /*! … … 81 82 */ 82 83 template <typename TComponent, typename TInterface> 83 staticvoid ConnectFirstChildComponentInterface(TComponent& composite_component, TInterface& interface);84 void ConnectFirstChildComponentInterface(TComponent& composite_component, TInterface& interface); 84 85 86 /*! 87 * Connects unconnected port composite interfaces in destination component interface with any matching 88 * component interfaces found in source. 89 * This function does not connect interfaces in source that are already connected to destination. 90 * 91 * \param source_component_interface Component interface with outgoing data flow 92 * \param destination_component_interface Component interface with incoming data flow 93 * \param connect_derived_interfaces Whether to connect sub- and superclass port composite interfaces 94 */ 95 void ConnectUnconnectedMatchingInterfaces(core::tPortGroup& source_component_interface, core::tPortGroup& destination_component_interface, bool connect_derived_interfaces = false); 85 96 86 97 //----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.