5#ifndef PT_LUA_ASYNCCALL_H
6#define PT_LUA_ASYNCCALL_H
10#include <Pt/Reflex/TypeManager.h>
11#include <Pt/Reflex/Argument.h>
12#include <Pt/Reflex/ArgumentTraits.h>
13#include <Pt/System/EventLoop.h>
54 void bind(Pt::Reflex::TypeManager& tm);
58 Pt::Reflex::Type*
rtype()
const;
94 virtual Pt::Reflex::Type* onBind(Pt::Reflex::TypeManager& tm) = 0;
98 virtual Pt::Any onGetResult() = 0;
100 virtual void onCancel() = 0;
105 std::string _errorMsg;
106 Pt::Reflex::Type* _rtype;
123 virtual Pt::Reflex::Type* onBind(Pt::Reflex::TypeManager& tm)
override
125 return tm.getType(
typeid(R) );
153 virtual Pt::Reflex::Type* onBind(Pt::Reflex::TypeManager& tm)
override
155 return tm.getType(
typeid(
void) );
Value of any copyable type.
Definition Any.h:79
void cancel()
Cancels the call.
virtual ~AsyncCall()
Destroys the call.
Pt::Signal & finished()
Signal emitted when the call is ready or has failed.
void bind(Pt::Reflex::TypeManager &tm)
Binds the result type from tm.
const std::string & errorMessage() const
Returns the stored error text.
Pt::Reflex::Type * rtype() const
Returns the Reflex result type, or a null pointer before bind.
void setError(const std::string &msg)
Stores msg as the error of this call.
bool hasError() const
Returns true when the call stored an error.
void setReady()
Emits finished() to mark the call ready.
void beginCall(Pt::System::EventLoop &loop)
Starts the call on loop.
Pt::Any getResult()
Returns the result after the call has finished.
AsyncCall()
Creates an idle asynchronous call.
Asynchronous native call with result type R.
Definition AsyncCall.h:121
virtual R onResult()=0
Returns the result of the finished call.
Multicast Signal to call multiple slots.
Definition Signal.h:190
Event loop of a thread or process.
Definition EventLoop.h:83
Lua runtime and reflected bindings.
Core module.
Definition Allocator.h:33