OSVR-Core
|
A wrapper for a unary function that only calls its contained function when the input has changed. More...
#include <DeduplicatingFunctionWrapper.h>
Public Types | |
using | argument_type = ArgumentType |
Argument type: always must be supplied via template parameter. | |
using | storage_type = typename std::conditional< std::is_same< StorageType, void >::value, typename std::remove_const< typename std::remove_reference< ArgumentType >::type >::type, StorageType >::type |
Storage type: if not supplied via template parameter, inferred by removing const& from the argument type. More... | |
typedef void | return_type |
Return type - presently fixed. | |
typedef std::function< return_type(argument_type)> | function_type |
std::function type corresponding to what is being wrapped. | |
Public Member Functions | |
DeduplicatingFunctionWrapper (function_type const &f) | |
Constructor from a function. | |
DeduplicatingFunctionWrapper () | |
Default constructor - must have function set before calling. | |
void | setFunction (function_type const &f) |
Set/replace the function. | |
return_type | operator() (argument_type arg,...) |
Function call operator: passes call along to contained function if and only if (argument != last argument) or (first time being called) More... | |
A wrapper for a unary function that only calls its contained function when the input has changed.
using osvr::common::DeduplicatingFunctionWrapper< ArgumentType, StorageType >::storage_type = typename std::conditional< std::is_same<StorageType, void>::value, typename std::remove_const< typename std::remove_reference<ArgumentType>::type>::type, StorageType>::type |
Storage type: if not supplied via template parameter, inferred by removing const& from the argument type.
|
inline |
Function call operator: passes call along to contained function if and only if (argument != last argument) or (first time being called)
Takes and throws away extra arguments so you don't have to wrap it in std::bind to get flexible calling ability.