#include <command.h>
Inheritance diagram for RepeatCommand:


Public Member Functions | |
| double | getDuration () |
| void | process (ExecutionEnvironment &, double t, double dt)=0 |
| RepeatCommand (CommandSequence *_body, int _repeatCount) | |
| ~RepeatCommand () | |
Private Attributes | |
| CommandSequence * | body |
| double | bodyDuration |
| Execution * | execution |
| int | repeatCount |
|
||||||||||||
|
Definition at line 738 of file command.cpp. References body, and bodyDuration. 00738 : 00739 body(_body), 00740 repeatCount(_repeatCount), 00741 bodyDuration(0.0), 00742 execution(NULL) 00743 { 00744 for (CommandSequence::const_iterator iter = body->begin(); 00745 iter != body->end(); iter++) 00746 { 00747 bodyDuration += (*iter)->getDuration(); 00748 } 00749 }
|
|
|
Definition at line 751 of file command.cpp. References execution. 00752 {
00753 if (execution != NULL)
00754 delete execution;
00755 // delete body;
00756 }
|
|
|
Definition at line 789 of file command.cpp. References bodyDuration, and repeatCount. 00790 {
00791 return bodyDuration * repeatCount;
00792 }
|
|
||||||||||||||||
|
Implements Command. Definition at line 758 of file command.cpp. References body, bodyDuration, execution, Execution::reset(), and Execution::tick(). 00759 {
00760 double t0 = t - dt;
00761 int loop0 = (int) (t0 / bodyDuration);
00762 int loop1 = (int) (t / bodyDuration);
00763
00764 // TODO: This is bogus . . . should not be storing a reference to an
00765 // execution environment.
00766 if (execution == NULL)
00767 execution = new Execution(*body, env);
00768
00769 if (loop0 == loop1)
00770 {
00771 execution->tick(dt);
00772 }
00773 else
00774 {
00775 double timeLeft = (loop0 + 1) * bodyDuration - t0;
00776 execution->tick(timeLeft);
00777
00778 for (int i = loop0 + 1; i < loop1; i++)
00779 {
00780 execution->reset(*body);
00781 execution->tick(bodyDuration);
00782 }
00783
00784 execution->reset(*body);
00785 execution->tick(t - loop1 * bodyDuration);
00786 }
00787 }
|
|
|
Definition at line 539 of file command.h. Referenced by process(), and RepeatCommand(). |
|
|
Definition at line 540 of file command.h. Referenced by getDuration(), process(), and RepeatCommand(). |
|
|
Definition at line 542 of file command.h. Referenced by process(), and ~RepeatCommand(). |
|
|
Definition at line 541 of file command.h. Referenced by getDuration(). |
1.4.1