Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ApplicationCore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ChimeraTK Mirror
ApplicationCore
Commits
f69e07fe
Commit
f69e07fe
authored
6 years ago
by
Jens Georg
Browse files
Options
Downloads
Patches
Plain Diff
Add simple PeriodicTrigger ApplicationModule
parent
59d906d8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Modules/include/PeriodicTrigger.h
+33
-0
33 additions, 0 deletions
Modules/include/PeriodicTrigger.h
with
33 additions
and
0 deletions
Modules/include/PeriodicTrigger.h
0 → 100644
+
33
−
0
View file @
f69e07fe
#ifndef CHIMERATK_APPLICATION_CORE_PERIODIC_TRIGGER_H
#define CHIMERATK_APPLICATION_CORE_PERIODIC_TRIGGER_H
#include
"ApplicationCore.h"
#include
<chrono>
namespace
ChimeraTK
{
/**
* Simple periodic trigger that fires a variable once per second.
* After configurable number of seconds it will wrap around
*/
struct
PeriodicTrigger
:
public
ApplicationModule
{
using
ApplicationModule
::
ApplicationModule
;
ScalarPollInput
<
int
>
timeout
{
this
,
"timeout"
,
"s"
,
"Timeout in seconds"
};
ScalarOutput
<
int
>
tick
{
this
,
"tick"
,
""
,
"Timer tick"
};
void
mainLoop
()
{
tick
=
0
;
while
(
true
)
{
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
1
));
tick
++
;
tick
%=
timeout
;
tick
.
write
();
}
}
};
}
#endif // CHIMERATK_APPLICATION_CORE_PERIODIC_TRIGGER_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment