Changeset 13:dbd30988fdb1 in finroc_plugins_composite_ports
- Timestamp:
- 30.04.2020 17:29:13 (3 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tInterfaceBase.cpp
r10 r13 36 36 #include "core/tRuntimeEnvironment.h" 37 37 #include "rrlib/util/string.h" 38 #include "rrlib/rtti_conversion/tStaticCastOperation.h" 38 39 39 40 //---------------------------------------------------------------------- … … 132 133 //} 133 134 135 void FindInterfacesBelowImplementation(std::vector<tInterfaceBase>& result, core::tFrameworkElement& parent, const rrlib::rtti::tType& type, bool skip_derived_interfaces) 136 { 137 for (auto it = parent.ChildrenBegin(); it != parent.ChildrenEnd(); ++it) 138 { 139 bool is_backend = typeid(*it) == typeid(tInterfaceBase::tBackend); 140 if (is_backend) 141 { 142 tInterfaceBase::tBackend& candidate = static_cast<tInterfaceBase::tBackend&>(*it); 143 if (candidate.IsPrimaryBackend() && (candidate.GetDataType() == type || ((!skip_derived_interfaces) && rrlib::rtti::conversion::tStaticCastOperation::IsImplicitlyConvertibleTo(candidate.GetDataType(), type)))) 144 { 145 result.emplace_back(&candidate); 146 continue; 147 } 148 } 149 if ((!it->IsPort()) || is_backend) 150 { 151 FindInterfacesBelowImplementation(result, *it, type, skip_derived_interfaces); 152 } 153 } 154 } 155 134 156 } 135 157 … … 182 204 } 183 205 } 206 } 207 208 std::vector<tInterfaceBase> tInterfaceBase::FindInterfacesBelow(core::tFrameworkElement& parent, const rrlib::rtti::tType& type, bool skip_derived_interfaces) 209 { 210 std::vector<tInterfaceBase> result; 211 if (type.GetTypeClassification() == rrlib::rtti::tTypeClassification::PORT_COMPOSITE_INTERFACE) 212 { 213 FindInterfacesBelowImplementation(result, parent, type, skip_derived_interfaces); 214 } 215 return result; 184 216 } 185 217 -
tInterfaceBase.h
r8 r13 122 122 return static_cast<tBackend*>(this->GetWrapped()); 123 123 } 124 125 /*! 126 * Searches for interfaces of specified type below parent element. 127 * 128 * \param parent Parent element below which to search for interface 129 * \param type Type of interface to search for 130 * \param skip_derived_interfaces By default subclasses of interfaces are also included. They are skipped if this parameter is true. 131 * \return Any interfaces found. Returns empty vector if type is not an interface type. 132 */ 133 static std::vector<tInterfaceBase> FindInterfacesBelow(core::tFrameworkElement& parent, const rrlib::rtti::tType& type, bool skip_derived_interfaces = false); 124 134 125 135 /*!
Note: See TracChangeset
for help on using the changeset viewer.