7 #ifndef __LIBCAMERA_OBJECT_H__
8 #define __LIBCAMERA_OBJECT_H__
19 template<
typename... Args>
32 template<
typename T,
typename R,
typename... FuncArgs,
typename... Args,
33 typename std::enable_if_t<std::is_base_of<Object, T>::value> * =
nullptr>
37 T *obj =
static_cast<T *
>(
this);
38 auto *method =
new BoundMethodMember<T, R, FuncArgs...>(obj,
this, func, type);
39 return method->activate(args...,
true);
51 friend class SignalBase;
54 void notifyThreadMove();
56 void connect(SignalBase *signal);
57 void disconnect(SignalBase *signal);
60 std::vector<Object *> children_;
63 std::list<SignalBase *> signals_;
64 unsigned int pendingMessages_;
Method bind and invocation.
ConnectionType
Connection type for asynchronous communication.
Definition: bound_method.h:19
A message that can be posted to a Thread.
Definition: message.h:22
Base object to support automatic signal disconnection.
Definition: object.h:25
Object(Object *parent=nullptr)
Construct an Object instance.
Definition: object.cpp:61
R invokeMethod(R(T::*func)(FuncArgs...), ConnectionType type, Args... args)
Invoke a method asynchronously on an Object instance.
Definition: object.h:34
Object * parent() const
Retrieve the object's parent.
Definition: object.h:45
virtual void message(Message *msg)
Message handler for the object.
Definition: object.cpp:133
void moveToThread(Thread *thread)
Move the object and all its children to a different thread.
Definition: object.cpp:197
Thread * thread() const
Retrieve the thread the object is bound to.
Definition: object.h:42
virtual ~Object()
Destroy an Object instance.
Definition: object.cpp:77
void postMessage(std::unique_ptr< Message > msg)
Post a message to the object's thread.
Definition: object.cpp:116
A thread of execution.
Definition: thread.h:31