diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-08-12 14:19:06 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-08-17 18:47:17 +0300 |
commit | 2b25819ec07e8de0b4be658c7d46f6c1c495766d (patch) | |
tree | 984c9c1785413b75bbe4825eca2895c6848f09e0 /include | |
parent | 4d9f1a0efc038e12b5cfdb53cb89fad9976fccb2 (diff) |
libcamera: object: Create parent-child relationships
Add a parent Object to Object instances, and track the parent-children
relationships. Children are bound to the same thread as their parent,
and moving an Object to a thread automatically moves all its children.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'include')
-rw-r--r-- | include/libcamera/object.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/libcamera/object.h b/include/libcamera/object.h index e128c75e..3308330a 100644 --- a/include/libcamera/object.h +++ b/include/libcamera/object.h @@ -9,6 +9,7 @@ #include <list> #include <memory> +#include <vector> #include <libcamera/bound_method.h> @@ -23,7 +24,7 @@ class Thread; class Object { public: - Object(); + Object(Object *parent = nullptr); virtual ~Object(); void postMessage(std::unique_ptr<Message> msg); @@ -41,6 +42,8 @@ public: Thread *thread() const { return thread_; } void moveToThread(Thread *thread); + Object *parent() const { return parent_; } + protected: virtual void message(Message *msg); @@ -57,6 +60,9 @@ private: void connect(SignalBase *signal); void disconnect(SignalBase *signal); + Object *parent_; + std::vector<Object *> children_; + Thread *thread_; std::list<SignalBase *> signals_; unsigned int pendingMessages_; |