OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
osvr::common::DeduplicatingFunctionWrapper< ArgumentType, StorageType > Class Template Reference

A wrapper for a unary function that only calls its contained function when the input has changed. More...

#include <osvr/Common/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.
 
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...
 

Detailed Description

template<typename ArgumentType, typename StorageType = void>
class osvr::common::DeduplicatingFunctionWrapper< ArgumentType, StorageType >

A wrapper for a unary function that only calls its contained function when the input has changed.

Definition at line 44 of file DeduplicatingFunctionWrapper.h.

Member Function Documentation

template<typename ArgumentType , typename StorageType = void>
return_type osvr::common::DeduplicatingFunctionWrapper< ArgumentType, StorageType >::operator() ( argument_type  arg,
  ... 
)
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.

Definition at line 79 of file DeduplicatingFunctionWrapper.h.


The documentation for this class was generated from the following file: