diff --git a/libuavcan/include/uavcan/internal/transport/dispatcher.hpp b/libuavcan/include/uavcan/internal/transport/dispatcher.hpp index 8a4432fa0c..073b256ac7 100644 --- a/libuavcan/include/uavcan/internal/transport/dispatcher.hpp +++ b/libuavcan/include/uavcan/internal/transport/dispatcher.hpp @@ -89,6 +89,9 @@ public: IOutgoingTransferRegistry& getOutgoingTransferRegistry() { return outgoing_transfer_reg_; } NodeID getSelfNodeID() const { return self_node_id_; } + + const ISystemClock& getSystemClock() const { return sysclock_; } + ISystemClock& getSystemClock() { return sysclock_; } }; } diff --git a/libuavcan/include/uavcan/internal/util.hpp b/libuavcan/include/uavcan/internal/util.hpp index 15ab6e7bfa..8e8b7aa3fd 100644 --- a/libuavcan/include/uavcan/internal/util.hpp +++ b/libuavcan/include/uavcan/internal/util.hpp @@ -74,6 +74,27 @@ template struct BooleanType { }; typedef BooleanType TrueType; typedef BooleanType FalseType; +/** + * Makeshift binder + */ +template +class MethodBinder +{ + ObjectPtr obj_; + MemFunPtr fun_; + +public: + MethodBinder(ObjectPtr o, MemFunPtr f) : obj_(o), fun_(f) { } + + void operator()() { (obj_->*fun_)(); } + + template + void operator()(Par1 p1) { (obj_->*fun_)(p1); } + + template + void operator()(Par1 p1, Par2 p2) { (obj_->*fun_)(p1, p2); } +}; + } /// Ensure that conditional comilation macros are present