wavelength 1.0.0
Loading...
Searching...
No Matches
memfun1command.h
Go to the documentation of this file.
1#pragma once
2
3#include "os/command.h"
4
16template <typename Function, typename Object, typename Argument>
17class MemFun1Command : public Command {
18public:
26 MemFun1Command(Object *pObject, Function pfnMember, Argument argument)
27 : mObject(pObject), mMember(pfnMember), mArgument(argument) {
28 }
29
54 ~MemFun1Command() override = default;
55
80 void Execute() override {
81 (mObject->*mMember)(mArgument);
82 }
83
84private:
85 Object *mObject;
86 Function mMember;
87 Argument mArgument;
88};
89
118template <typename Function, typename Object, typename Argument>
119Command *NewMemFun1Command(Object *pObject, Function pfnMember, Argument argument) {
120 return new MemFun1Command<Function, Object, Argument>(pObject, pfnMember, argument);
121}
Unit of work a Scheduler runs at a set time.
Definition command.h:13
Command that calls a member function of an object with one argument.
Definition memfun1command.h:17
~MemFun1Command() override=default
Release the command.
void Execute() override
Call the member function with the argument.
Definition memfun1command.h:80
MemFun1Command(Object *pObject, Function pfnMember, Argument argument)
Bind a member function and its argument to an object.
Definition memfun1command.h:26
Command * NewMemFun1Command(Object *pObject, Function pfnMember, Argument argument)
Allocate a command that calls a member function of an object with one argument.
Definition memfun1command.h:119