TaskManagerIO
Toggle main menu visibility
Loading...
Searching...
No Matches
src
ExecWithParameter.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2018 https://www.thecoderscorner.com (Dave Cherry)..
3
* This product is licensed under an Apache license, see the LICENSE file in the top-level directory.
4
*/
5
6
#ifndef TASKMANAGERIO_EXECWITHPARAMETER_H
7
#define TASKMANAGERIO_EXECWITHPARAMETER_H
8
13
14
#include "
TaskTypes.h
"
15
27
template
<
class
TParam>
class
ExecWithParameter
:
public
Executable
{
28
private
:
29
void (*fnParam)(TParam);
30
TParam param;
31
public
:
37
ExecWithParameter
(
void
(*fn)(TParam), TParam storedParam) : fnParam(fn), param(storedParam){}
38
~ExecWithParameter
()
override
=
default
;
39
40
void
exec
()
override
{
41
fnParam(param);
42
}
43
};
44
52
template
<
class
TParam1,
class
TParam2>
class
ExecWith2Parameters
:
public
Executable
{
53
private
:
54
void (*fnParam)(TParam1, TParam2);
55
TParam1 param1;
56
TParam2 param2;
57
public
:
64
ExecWith2Parameters
(
void
(*fn)(TParam1, TParam2), TParam1 storedParam1, TParam2 storedParam2 ) :
65
fnParam(fn), param1(storedParam1), param2(storedParam2) {}
66
~ExecWith2Parameters
()
override
=
default
;
67
68
void
exec
()
override
{
69
fnParam(param1, param2);
70
}
71
};
72
73
74
#endif
//TASKMANAGERIO_EXECWITHPARAMETER_H
TaskTypes.h
This class represents the core tasks that are added to task manager, and the TimerTask object itself.
ExecWith2Parameters
Definition
ExecWithParameter.h:52
ExecWith2Parameters::ExecWith2Parameters
ExecWith2Parameters(void(*fn)(TParam1, TParam2), TParam1 storedParam1, TParam2 storedParam2)
Definition
ExecWithParameter.h:64
ExecWith2Parameters::exec
void exec() override
Definition
ExecWithParameter.h:68
ExecWithParameter
Definition
ExecWithParameter.h:27
ExecWithParameter::ExecWithParameter
ExecWithParameter(void(*fn)(TParam), TParam storedParam)
Definition
ExecWithParameter.h:37
ExecWithParameter::exec
void exec() override
Definition
ExecWithParameter.h:40
Executable
Definition
TaskTypes.h:28