Changeset 490:e387ca5db0fd in finroc_core


Ignore:
Timestamp:
15.12.2021 15:56:35 (2 years ago)
Author:
Max Reichardt <max.reichardt@…>
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
Message:

Merge with 17.03

File:
1 edited

Legend:

Unmodified
Added
Removed
  • port/tPortWrapperBase.h

    r473 r490  
    422422      this->Set(std::forward<ARG1>(argument1)); 
    423423      this->ProcessArguments(std::forward<TArgs>(rest)...); 
     424      this->ApplyModifier(std::forward<ARG1>(argument1)); 
    424425    } 
    425426 
    426427    /*! 
    427      * Depending on the TArgument type, calling Set on this class will either 
    428      * set a suitable parameter in the base class - or execute the modifier 
    429      * (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. 
    430431     * 
    431432     * A static assertion is thrown if an argument of an invalid type is provided. 
     
    437438      tBase::Set(std::forward<TArgument>(argument)); 
    438439    } 
     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    {} 
    439450    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) 
    441452    { 
    442453      (*argument)(*this); 
    443454    } 
    444455    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) 
    446457    { 
    447458      argument(*this); 
     
    461472      this->Set(std::forward<A>(argument1)); 
    462473      this->ProcessArguments(std::forward<ARest>(rest)...); 
     474      this->ApplyModifier(std::forward<A>(argument1)); 
    463475    } 
    464476  }; 
Note: See TracChangeset for help on using the changeset viewer.