Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenWalnut Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
a7b1f7ec
Commit
a7b1f7ec
authored
Apr 13, 2010
by
Sebastian Eichelbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CHANGE] - extended doc in WMTemplate for trigger properties
parent
1ab48afd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
src/common/WPropertyTypes.cpp
src/common/WPropertyTypes.cpp
+2
-0
src/modules/template/WMTemplate.cpp
src/modules/template/WMTemplate.cpp
+26
-0
No files found.
src/common/WPropertyTypes.cpp
View file @
a7b1f7ec
...
...
@@ -22,6 +22,8 @@
//
//---------------------------------------------------------------------------
#include <string>
#include "WPropertyTypes.h"
std
::
ostream
&
WPVBaseTypes
::
operator
<<
(
std
::
ostream
&
out
,
const
WPVBaseTypes
::
PV_TRIGGER
&
c
)
...
...
src/modules/template/WMTemplate.cpp
View file @
a7b1f7ec
...
...
@@ -444,6 +444,32 @@ void WMTemplate::moduleMain()
m_output
->
updateData
(
newData
);
// This sets the new data to the output connector and automatically notifies all modules connected to your output.
}
// As we provided our condition to m_aTrigger too, the main thread will wake up if it changes. The GUI can change the trigger only to the
// state "PV_TRIGGER_TRIGGERED" (this is the case if the user presses the button).
if
(
m_aTrigger
->
get
(
true
)
==
WPVBaseTypes
::
PV_TRIGGER_TRIGGERED
)
{
// Now that the trigger has the state "triggered", a time consuming operation can be done here.
debugLog
()
<<
"User triggered an important and time consuming operation."
;
// Do something here. As above, do not forget to inform the user about your progress.
int
steps
=
10
;
boost
::
shared_ptr
<
WProgress
>
progress1
=
boost
::
shared_ptr
<
WProgress
>
(
new
WProgress
(
"Doing something important"
,
steps
)
);
m_progress
->
addSubProgress
(
progress1
);
for
(
int
i
=
0
;
i
<
steps
;
++
i
)
{
++*
progress1
;
sleep
(
1
);
}
progress1
->
finish
();
// As long as the module does not reset the trigger to "ready", the GUI disables the trigger button. This is very useful to avoid
// that a user presses the button multiple times during an operation. When setting the property back to "ready", the GUI re-enables
// the button and the user can press it again.
// To avoid the moduleMain- loop to awake every time we reset the trigger, provide a second parameter to the set() method. It denotes
// whether the change notification should be fired or not. In our case, we avoid this by providing false to the second parameter.
m_aTrigger
->
set
(
WPVBaseTypes
::
PV_TRIGGER_READY
,
false
);
}
}
// At this point, the container managing this module signalled to shutdown. The main loop has ended and you should clean up. Always remove
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment