~ubuntu-branches/ubuntu/precise/flightgear/precise

« back to all changes in this revision

Viewing changes to src/FDM/JSBSim/input_output/FGScript.h

  • Committer: Bazaar Package Importer
  • Author(s): Ove Kaaven
  • Date: 2011-01-30 15:46:35 UTC
  • mfrom: (3.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110130154635-rlynmg9n5hzxq5xe
Tags: 2.0.0-3
* Recommend fgfs-aircraft-base and fgfs-models-base.
  Closes. #610276.
* Added note about scenery SharedModels.tgz to README.Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 Author:       Jon Berndt
4
4
 Date started: 12/21/2001
5
5
 
6
 
 ------------- Copyright (C) 2001  Jon S. Berndt (jsb@hal-pc.org) -------------
 
6
 ------------- Copyright (C) 2001  Jon S. Berndt (jon@jsbsim.org) -------------
7
7
 
8
8
 This program is free software; you can redistribute it and/or modify it under
9
9
 the terms of the GNU Lesser General Public License as published by the Free Software
40
40
#include "FGJSBBase.h"
41
41
#include "FGState.h"
42
42
#include "FGFDMExec.h"
43
 
#include <math/FGFunction.h>
44
 
#include <math/FGCondition.h>
 
43
#include "math/FGFunction.h"
 
44
#include "math/FGCondition.h"
45
45
#include <vector>
46
 
#include <input_output/FGXMLFileRead.h>
 
46
#include "input_output/FGXMLFileRead.h"
47
47
 
48
48
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
49
49
DEFINITIONS
70
70
    format. A test condition (or conditions) can be set up in an event in a
71
71
    script and when the condition evaluates to true, the specified
72
72
    action[s] is/are taken. An event can be <em>persistent</em>,
73
 
    meaning that at all times when the test condition evaluates to true
74
 
    the specified <em>set</em> actions take place. When the set of
75
 
    tests evaluates to true for a given
 
73
    meaning that at every time the test condition first evaluates to true
 
74
    (toggling from false to true) then the specified <em>set</em> actions take
 
75
    place. An event can also be defined to execute or evaluate continuously
 
76
    while the condition is true. When the set of tests evaluates to true for a given
76
77
    condition, an item may be set to another value. This value may
77
78
    be a value, or a delta value, and the change from the
78
 
    current value to the new value can be either via a step function,
79
 
    a ramp, or an exponential approach. The speed of a ramp or
 
79
    current value to the new value can be either via a step action,
 
80
    a ramp, or an exponential approach. The speed of a ramp or exponential
80
81
    approach is specified via the time constant. Here is an example
81
82
    illustrating the format of the script file:
82
83
 
185
186
  bool RunScript(void);
186
187
 
187
188
  void ResetEvents(void) {
188
 
    for (int i=0; i<Events.size(); i++) Events[i].reset();
 
189
    for (unsigned int i=0; i<Events.size(); i++) Events[i].reset();
189
190
  }
190
191
 
191
192
private:
204
205
  struct event {
205
206
    FGCondition     *Condition;
206
207
    bool             Persistent;
 
208
    bool             Continuous;
207
209
    bool             Triggered;
208
 
    bool             PrevTriggered;
209
210
    bool             Notify;
210
211
    bool             Notified;
211
212
    double           Delay;
226
227
 
227
228
    event() {
228
229
      Triggered = false;
229
 
      PrevTriggered = false;
230
230
      Persistent = false;
 
231
      Continuous = false;
231
232
      Delay = 0.0;
232
233
      Notify = Notified = false;
233
234
      Name = "";
237
238
 
238
239
    void reset(void) {
239
240
      Triggered = false;
240
 
      PrevTriggered = false;
241
241
      Notified = false;
242
242
      StartTime = 0.0;
243
243
    }