wavelength 1.0.0
Loading...
Searching...
No Matches
memfun2command.h
Go to the documentation of this file.
1#pragma once
2
3#include "os/command.h"
4
17template <typename Function, typename Object, typename Argument1, typename Argument2>
18class MemFun2Command : public Command {
19public:
28 MemFun2Command(Object *pObject, Function pfnMember, Argument1 argument1, Argument2 argument2)
29 : mObject(pObject), mMember(pfnMember), mArgument1(argument1), mArgument2(argument2) {
30 }
31
46 ~MemFun2Command() override = default;
47
62 void Execute() override {
63 (mObject->*mMember)(mArgument1, mArgument2);
64 }
65
66private:
67 Object *mObject;
68 Function mMember;
69 Argument1 mArgument1;
70 Argument2 mArgument2;
71};
72
94template <typename Function, typename Object, typename Argument1, typename Argument2>
95Command *
96NewMemFun2Command(Object *pObject, Function pfnMember, Argument1 argument1, Argument2 argument2) {
98 pObject, pfnMember, argument1, argument2);
99}
Unit of work a Scheduler runs at a set time.
Definition command.h:13
Command that calls a member function of an object with two arguments.
Definition memfun2command.h:18
void Execute() override
Call the member function with the arguments.
Definition memfun2command.h:62
MemFun2Command(Object *pObject, Function pfnMember, Argument1 argument1, Argument2 argument2)
Bind a member function and its arguments to an object.
Definition memfun2command.h:28
~MemFun2Command() override=default
Release the command.
Command * NewMemFun2Command(Object *pObject, Function pfnMember, Argument1 argument1, Argument2 argument2)
Allocate a command that calls a member function of an object with two arguments.
Definition memfun2command.h:96