Changeset 490:e387ca5db0fd in finroc_core
- Timestamp:
- 15.12.2021 15:56:35 (2 years ago)
- Branch:
- default
- Parents:
- 487:3ae47727c72a (diff), 489:5ad391eb57a4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
port/tPortWrapperBase.h
r473 r490 422 422 this->Set(std::forward<ARG1>(argument1)); 423 423 this->ProcessArguments(std::forward<TArgs>(rest)...); 424 this->ApplyModifier(std::forward<ARG1>(argument1)); 424 425 } 425 426 426 427 /*! 427 * Depending on the TArgument type, calling Set on this class will either428 * set a suitable parameter in the base class - or execute the modifier429 * (if TArgument is derived from the tModifier class)428 * This Set() method will set a suitable parameter in the base class 429 * depending on the type of the argument passed to it. 430 * Modifiers are skipped. 430 431 * 431 432 * A static assertion is thrown if an argument of an invalid type is provided. … … 437 438 tBase::Set(std::forward<TArgument>(argument)); 438 439 } 440 template <typename TArgument, typename = typename std::enable_if <std::is_base_of<tAbstractPortCreationInfo::tModifier, typename std::remove_pointer<typename std::decay<TArgument>::type>::type>::value, int>::type> 441 inline void Set(TArgument& argument) 442 {} 443 444 /*! 445 * If TArgument is a modifier, executes it. Has no effect otherwise. 446 */ 447 template < typename TArgument, typename = typename std::enable_if < !std::is_base_of<tAbstractPortCreationInfo::tModifier, typename std::decay<TArgument>::type>::value, int >::type > 448 inline void ApplyModifier(TArgument && argument) 449 {} 439 450 template <typename TArgument, typename = typename std::enable_if<std::is_base_of<tAbstractPortCreationInfo::tModifier, typename std::decay<TArgument>::type>::value, int>::type> 440 inline void Set(TArgument* argument)451 inline void ApplyModifier(TArgument* argument) 441 452 { 442 453 (*argument)(*this); 443 454 } 444 455 template <typename TArgument, typename = typename std::enable_if<std::is_base_of<tAbstractPortCreationInfo::tModifier, typename std::decay<TArgument>::type>::value, int>::type> 445 inline void Set(TArgument& argument)456 inline void ApplyModifier(TArgument& argument) 446 457 { 447 458 argument(*this); … … 461 472 this->Set(std::forward<A>(argument1)); 462 473 this->ProcessArguments(std::forward<ARest>(rest)...); 474 this->ApplyModifier(std::forward<A>(argument1)); 463 475 } 464 476 };
Note: See TracChangeset
for help on using the changeset viewer.