summaryrefslogtreecommitdiff
path: root/include/libcamera/bound_method.h
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-08-12 02:59:19 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-08-17 18:32:28 +0300
commitf83820a5d18bfdfa9853ef3ef71abfb47f626ac8 (patch)
tree3baab0b5ae1aa3f84a4b84d9861766daa77d9800 /include/libcamera/bound_method.h
parent0e65ed81453ce0ae8534b3fbc3f44a846d816910 (diff)
libcamera: bound_method: Decouple from Signal implementation
To make the BoundMethod classes more generic, replace direct access to private member from Signal classes with accessors or helper functions. This allows removal of friend statements from the BoundMethod classes. 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/libcamera/bound_method.h')
-rw-r--r--include/libcamera/bound_method.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/include/libcamera/bound_method.h b/include/libcamera/bound_method.h
index 38c44b92..54c40fc5 100644
--- a/include/libcamera/bound_method.h
+++ b/include/libcamera/bound_method.h
@@ -13,9 +13,6 @@
namespace libcamera {
class Object;
-template<typename... Args>
-class Signal;
-class SignalBase;
class BoundMethodBase
{
@@ -28,7 +25,7 @@ public:
bool match(T *obj) { return obj == obj_; }
bool match(Object *object) { return object == object_; }
- void disconnect(SignalBase *signal);
+ Object *object() const { return object_; }
void activatePack(void *pack);
virtual void invokePack(void *pack) = 0;
@@ -93,6 +90,8 @@ public:
BoundMemberMethod(T *obj, Object *object, void (T::*func)(Args...))
: BoundMethodArgs<Args...>(obj, object), func_(func) {}
+ bool match(void (T::*func)(Args...)) const { return func == func_; }
+
void activate(Args... args)
{
if (this->object_)
@@ -107,7 +106,6 @@ public:
}
private:
- friend class Signal<Args...>;
void (T::*func_)(Args...);
};
@@ -118,11 +116,12 @@ public:
BoundStaticMethod(void (*func)(Args...))
: BoundMethodArgs<Args...>(nullptr, nullptr), func_(func) {}
+ bool match(void (*func)(Args...)) const { return func == func_; }
+
void activate(Args... args) { (*func_)(args...); }
void invoke(Args... args) {}
private:
- friend class Signal<Args...>;
void (*func_)(Args...);
};