2
* Copyright (C) 2010, 2011 Tuomo Penttinen, all rights reserved.
4
* Author: Tuomo Penttinen <tp@herqq.org>
6
* This file is part of Herqq UPnP (HUPnP) library.
8
* Herqq UPnP is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU Lesser General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
13
* Herqq UPnP is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU Lesser General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public License
19
* along with Herqq UPnP. If not, see <http://www.gnu.org/licenses/>.
22
#ifndef HACTIONINVOKE_CALLBACK_H_
23
#define HACTIONINVOKE_CALLBACK_H_
25
#include <HUpnpCore/HUpnp>
26
#include <HUpnpCore/HFunctor>
39
* This is a type definition for a <em>callable entity</em> that is used
40
* as a callback for signaling the completion of an HClientAction invocation.
42
* You can create \c %HActionInvokeCallback objects using normal functions,
43
* functors and member functions that follow the signature of
47
* bool function(Herqq::Upnp::HClientAction*, const Herqq::Upnp::HClientActionOp&);
52
* \li The first parameter is a type of an "ID" of the asynchronous action invocation.
53
* \li The second parameter specifies the output arguments of the action invocation,
56
* <h3>Return value</h3>
57
* The return value indicates if the invoked HClientAction should emit an
58
* HClientAction::invokeComplete() after the callback has returned.
59
* \li \b true indicates that the HClientAction should sent the corresponding event.
61
* The following example demonstrates how you can instantiate the \c %HActionInvokeCallback
62
* for a normal function, functor and a member function.
66
* #include <HUpnpCore/HClientAction>
68
* #include "myclass.h" // your code that contains declaration for MyClass
72
* bool freefun(Herqq::Upnp::HClientAction*, const Herqq::Upnp::HClientActionOp&)
80
* bool operator()(Herqq::Upnp::HClientAction*, const Herqq::Upnp::HClientActionOp&)
87
* bool MyClass::memfun(Herqq::Upnp::HClientAction*, const Herqq::Upnp::HClientActionOp&)
92
* void MyClass::example()
94
* Herqq::Upnp::HActionInvokeCallback usingFreeFunction(freefun);
97
* Herqq::Upnp::HActionInvokeCallback usingFunctor(myfunc);
99
* Herqq::Upnp::HActionInvokeCallback usingMemberFunction(this, &MyClass::memfun);
104
* You can test if the object can be invoked simply by issuing
105
* <tt>if (actionInvokeCallbackObject) { ... } </tt>
107
* \headerfile hactioninvoke_callback.h HActionInvokeCallback
109
* \ingroup hupnp_devicemodel
111
typedef Functor<bool, H_TYPELIST_2(
112
HClientAction*, const HClientActionOp&)> HActionInvokeCallback;
117
#endif /* HACTIONINVOKE_CALLBACK_H_ */