AMPS C/C++ Client Class Reference AMPS C/C++ Client Version 5.3.5.4

Public Member Functions | List of all members
AMPS::Handler< Func, Object > Class Template Reference

Wrapper for callback functions in AMPS. More...

`#include <MessageRouter.hpp>`

## Public Member Functions
| Handler ()
| Null constructor – no function is wrapped.
| Handler (Func func_, void *userData_)
| Constructor for use with a bare function pointer. More...
| Handler (const Handler &orig_)
| Copy constructor. More...
template<typename T >
| Handler (const T &callback_)
| Constructor for use with a standard c++ library function object. More...

## Detailed Description

### template<typename Func, typename Object>
class AMPS::Handler< Func, Object >

Wrapper for callback functions in AMPS.

Can be used to bind a function pointer with a void* to use as a callback, or if available, can wrap a std::function<Object> object, so you can supply the return value of std::bind, or even a lambda.

## Constructor & Destructor Documentation

## ◆ Handler() [1/3]

template<typename Func , typename Object >

AMPS::Handler< Func, Object >::Handler | ( | Func | func_,
|  | void * | userData_
| ) |  |
| inline

Constructor for use with a bare function pointer.

Parameters

  func_ | The function pointer to bind. func must be declared:j void myFunction(Object o, void* userData); for example, void myHandler(const Message&m, void *userData);
  userData_ | a value you'd like passed in when you're called.

## ◆ Handler() [2/3]

template<typename Func , typename Object >

AMPS::Handler< Func, Object >::Handler | ( | const Handler< Func, Object > & | orig_ | ) |
| inline

Copy constructor.

Parameters

  orig_ | The handler to copy

## ◆ Handler() [3/3]

template<typename Func , typename Object >
template<typename T >

AMPS::Handler< Func, Object >::Handler | ( | const T & | callback_ | ) |
| inline

Constructor for use with a standard c++ library function object.

Parameters

  callback_ | An object that can be assigned to a std::function

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

- include/amps/MessageRouter.hpp