MOOSE/docs/Documentation/Scheduler.html
2017-03-10 23:05:02 +01:00

509 lines
14 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<link rel="stylesheet" href="stylesheet.css" type="text/css"/>
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div>
<div id="main">
<div id="navigation">
<h2>Modules</h2>
<ul><li>
<a href="index.html">index</a>
</li></ul>
<ul>
<li><a href="AI_Balancer.html">AI_Balancer</a></li>
<li><a href="AI_Cap.html">AI_Cap</a></li>
<li><a href="AI_Cas.html">AI_Cas</a></li>
<li><a href="AI_Patrol.html">AI_Patrol</a></li>
<li><a href="Account.html">Account</a></li>
<li><a href="Airbase.html">Airbase</a></li>
<li><a href="AirbasePolice.html">AirbasePolice</a></li>
<li><a href="Assign.html">Assign</a></li>
<li><a href="Base.html">Base</a></li>
<li><a href="Cargo.html">Cargo</a></li>
<li><a href="CleanUp.html">CleanUp</a></li>
<li><a href="Client.html">Client</a></li>
<li><a href="CommandCenter.html">CommandCenter</a></li>
<li><a href="Controllable.html">Controllable</a></li>
<li><a href="Database.html">Database</a></li>
<li><a href="Detection.html">Detection</a></li>
<li><a href="DetectionManager.html">DetectionManager</a></li>
<li><a href="Escort.html">Escort</a></li>
<li><a href="Event.html">Event</a></li>
<li><a href="Fsm.html">Fsm</a></li>
<li><a href="Group.html">Group</a></li>
<li><a href="Identifiable.html">Identifiable</a></li>
<li><a href="Menu.html">Menu</a></li>
<li><a href="Message.html">Message</a></li>
<li><a href="MissileTrainer.html">MissileTrainer</a></li>
<li><a href="Mission.html">Mission</a></li>
<li><a href="Movement.html">Movement</a></li>
<li><a href="Object.html">Object</a></li>
<li><a href="Point.html">Point</a></li>
<li><a href="Positionable.html">Positionable</a></li>
<li><a href="Process_JTAC.html">Process_JTAC</a></li>
<li><a href="Process_Pickup.html">Process_Pickup</a></li>
<li><a href="Route.html">Route</a></li>
<li><a href="Scenery.html">Scenery</a></li>
<li><a href="ScheduleDispatcher.html">ScheduleDispatcher</a></li>
<li>Scheduler</li>
<li><a href="Scoring.html">Scoring</a></li>
<li><a href="Sead.html">Sead</a></li>
<li><a href="Set.html">Set</a></li>
<li><a href="Smoke.html">Smoke</a></li>
<li><a href="Spawn.html">Spawn</a></li>
<li><a href="Static.html">Static</a></li>
<li><a href="Task.html">Task</a></li>
<li><a href="Task_A2G.html">Task_A2G</a></li>
<li><a href="Task_A2G_Dispatcher.html">Task_A2G_Dispatcher</a></li>
<li><a href="Task_PICKUP.html">Task_PICKUP</a></li>
<li><a href="Unit.html">Unit</a></li>
<li><a href="Utils.html">Utils</a></li>
<li><a href="Zone.html">Zone</a></li>
<li><a href="routines.html">routines</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Scheduler</code></h1>
<p><strong>Core</strong> - SCHEDULER prepares and handles the <strong>execution of functions over scheduled time (intervals)</strong>.</p>
<p><img src="..\Presentations\SCHEDULER\Dia1.JPG" alt="Banner Image"/></p>
<hr/>
<h1>1) <a href="Scheduler.html##(SCHEDULER)">Scheduler#SCHEDULER</a> class, extends <a href="Base.html##(BASE)">Base#BASE</a></h1>
<p>The <a href="Scheduler.html##(SCHEDULER)">Scheduler#SCHEDULER</a> class creates schedule.</p>
<h2>1.1) SCHEDULER constructor</h2>
<p>The SCHEDULER class is quite easy to use, but note that the New constructor has variable parameters:</p>
<ul>
<li><a href="Scheduler.html##(SCHEDULER).New">Scheduler#SCHEDULER.New</a>( nil ): Setup a new SCHEDULER object, which is persistently executed after garbage collection.</li>
<li><a href="Scheduler.html##(SCHEDULER).New">Scheduler#SCHEDULER.New</a>( Object ): Setup a new SCHEDULER object, which is linked to the Object. When the Object is nillified or destroyed, the SCHEDULER object will also be destroyed and stopped after garbage collection.</li>
<li><a href="Scheduler.html##(SCHEDULER).New">Scheduler#SCHEDULER.New</a>( nil, Function, FunctionArguments, Start, ... ): Setup a new persistent SCHEDULER object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.</li>
<li><a href="Scheduler.html##(SCHEDULER).New">Scheduler#SCHEDULER.New</a>( Object, Function, FunctionArguments, Start, ... ): Setup a new SCHEDULER object, linked to Object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.</li>
</ul>
<h2>1.2) SCHEDULER timer stopping and (re-)starting.</h2>
<p>The SCHEDULER can be stopped and restarted with the following methods:</p>
<ul>
<li><a href="Scheduler.html##(SCHEDULER).Start">Scheduler#SCHEDULER.Start</a>(): (Re-)Start the schedules within the SCHEDULER object. If a CallID is provided to :Start(), only the schedule referenced by CallID will be (re-)started.</li>
<li><a href="Scheduler.html##(SCHEDULER).Stop">Scheduler#SCHEDULER.Stop</a>(): Stop the schedules within the SCHEDULER object. If a CallID is provided to :Stop(), then only the schedule referenced by CallID will be stopped.</li>
</ul>
<h2>1.3) Create a new schedule</h2>
<p>With <a href="Scheduler.html##(SCHEDULER).Schedule">Scheduler#SCHEDULER.Schedule</a>() a new time event can be scheduled. This function is used by the :New() constructor when a new schedule is planned.</p>
<hr/>
<h3>Contributions:</h3>
<ul>
<li>FlightControl : Concept &amp; Testing</li>
</ul>
<h3>Authors:</h3>
<ul>
<li>FlightControl : Design &amp; Programming</li>
</ul>
<h3>Test Missions:</h3>
<ul>
<li>SCH - Scheduler</li>
</ul>
<hr/>
<h2>Global(s)</h2>
<table class="function_list">
<tr>
<td class="name" nowrap="nowrap"><a href="#SCHEDULER">SCHEDULER</a></td>
<td class="summary">
</td>
</tr>
</table>
<h2><a id="#(SCHEDULER)">Type <code>SCHEDULER</code></a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCHEDULER).ClassName">SCHEDULER.ClassName</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCHEDULER).Clear">SCHEDULER:Clear()</a></td>
<td class="summary">
<p>Clears all pending schedules.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCHEDULER).New">SCHEDULER:New(SchedulerObject, SchedulerFunction, SchedulerArguments, Start, Repeat, RandomizeFactor, Stop)</a></td>
<td class="summary">
<p>SCHEDULER constructor.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCHEDULER).Remove">SCHEDULER:Remove(ScheduleID)</a></td>
<td class="summary">
<p>Removes a specific schedule if a valid ScheduleID is provided.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCHEDULER).Schedule">SCHEDULER:Schedule(SchedulerObject, SchedulerFunction, SchedulerArguments, Start, Repeat, RandomizeFactor, Stop)</a></td>
<td class="summary">
<p>Schedule a new time event.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCHEDULER).ScheduleID">SCHEDULER.ScheduleID</a></td>
<td class="summary">
<p>the ID of the scheduler.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCHEDULER).SchedulerObject">SCHEDULER.SchedulerObject</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCHEDULER).Schedules">SCHEDULER.Schedules</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCHEDULER).Start">SCHEDULER:Start(ScheduleID)</a></td>
<td class="summary">
<p>(Re-)Starts the schedules or a specific schedule if a valid ScheduleID is provided.</p>
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCHEDULER).Stop">SCHEDULER:Stop(ScheduleID)</a></td>
<td class="summary">
<p>Stops the schedules or a specific schedule if a valid ScheduleID is provided.</p>
</td>
</tr>
</table>
<h2>Global(s)</h2>
<dl class="function">
<dt>
<em><a href="##(SCHEDULER)">#SCHEDULER</a></em>
<a id="SCHEDULER" >
<strong>SCHEDULER</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<h2><a id="#(Scheduler)" >Type <code>Scheduler</code></a></h2>
<h2><a id="#(SCHEDULER)" >Type <code>SCHEDULER</code></a></h2>
<p>The SCHEDULER class</p>
<h3>Field(s)</h3>
<dl class="function">
<dt>
<em>#string</em>
<a id="#(SCHEDULER).ClassName" >
<strong>SCHEDULER.ClassName</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(SCHEDULER).Clear" >
<strong>SCHEDULER:Clear()</strong>
</a>
</dt>
<dd>
<p>Clears all pending schedules.</p>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(SCHEDULER).New" >
<strong>SCHEDULER:New(SchedulerObject, SchedulerFunction, SchedulerArguments, Start, Repeat, RandomizeFactor, Stop)</strong>
</a>
</dt>
<dd>
<p>SCHEDULER constructor.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#table SchedulerObject </em></code>:
Specified for which Moose object the timer is setup. If a value of nil is provided, a scheduler will be setup without an object reference.</p>
</li>
<li>
<p><code><em>#function SchedulerFunction </em></code>:
The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.</p>
</li>
<li>
<p><code><em>#table SchedulerArguments </em></code>:
Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.</p>
</li>
<li>
<p><code><em>#number Start </em></code>:
Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.</p>
</li>
<li>
<p><code><em>#number Repeat </em></code>:
Specifies the interval in seconds when the scheduler will call the event function.</p>
</li>
<li>
<p><code><em>#number RandomizeFactor </em></code>:
Specifies a randomization factor between 0 and 1 to randomize the Repeat.</p>
</li>
<li>
<p><code><em>#number Stop </em></code>:
Specifies the amount of seconds when the scheduler will be stopped.</p>
</li>
</ul>
<h3>Return values</h3>
<ol>
<li>
<p><em><a href="##(SCHEDULER)">#SCHEDULER</a>:</em>
self.</p>
</li>
<li>
<p><em>#number:</em>
The ScheduleID of the planned schedule.</p>
</li>
</ol>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(SCHEDULER).Remove" >
<strong>SCHEDULER:Remove(ScheduleID)</strong>
</a>
</dt>
<dd>
<p>Removes a specific schedule if a valid ScheduleID is provided.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em>#number ScheduleID </em></code>:
(optional) The ScheduleID of the planned (repeating) schedule.</p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(SCHEDULER).Schedule" >
<strong>SCHEDULER:Schedule(SchedulerObject, SchedulerFunction, SchedulerArguments, Start, Repeat, RandomizeFactor, Stop)</strong>
</a>
</dt>
<dd>
<p>Schedule a new time event.</p>
<p>Note that the schedule will only take place if the scheduler is <em>started</em>. Even for a single schedule event, the scheduler needs to be started also.</p>
<h3>Parameters</h3>
<ul>
<li>
<p><code><em>#table SchedulerObject </em></code>:
Specified for which Moose object the timer is setup. If a value of nil is provided, a scheduler will be setup without an object reference.</p>
</li>
<li>
<p><code><em>#function SchedulerFunction </em></code>:
The event function to be called when a timer event occurs. The event function needs to accept the parameters specified in SchedulerArguments.</p>
</li>
<li>
<p><code><em>#table SchedulerArguments </em></code>:
Optional arguments that can be given as part of scheduler. The arguments need to be given as a table { param1, param 2, ... }.</p>
</li>
<li>
<p><code><em>#number Start </em></code>:
Specifies the amount of seconds that will be waited before the scheduling is started, and the event function is called.</p>
</li>
<li>
<p><code><em>#number Repeat </em></code>:
Specifies the interval in seconds when the scheduler will call the event function.</p>
</li>
<li>
<p><code><em>#number RandomizeFactor </em></code>:
Specifies a randomization factor between 0 and 1 to randomize the Repeat.</p>
</li>
<li>
<p><code><em>#number Stop </em></code>:
Specifies the amount of seconds when the scheduler will be stopped.</p>
</li>
</ul>
<h3>Return value</h3>
<p><em>#number:</em>
The ScheduleID of the planned schedule.</p>
</dd>
</dl>
<dl class="function">
<dt>
<em>#number</em>
<a id="#(SCHEDULER).ScheduleID" >
<strong>SCHEDULER.ScheduleID</strong>
</a>
</dt>
<dd>
<p>the ID of the scheduler.</p>
</dd>
</dl>
<dl class="function">
<dt>
<em></em>
<a id="#(SCHEDULER).SchedulerObject" >
<strong>SCHEDULER.SchedulerObject</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<em></em>
<a id="#(SCHEDULER).Schedules" >
<strong>SCHEDULER.Schedules</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(SCHEDULER).Start" >
<strong>SCHEDULER:Start(ScheduleID)</strong>
</a>
</dt>
<dd>
<p>(Re-)Starts the schedules or a specific schedule if a valid ScheduleID is provided.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em>#number ScheduleID </em></code>:
(optional) The ScheduleID of the planned (repeating) schedule.</p>
</li>
</ul>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(SCHEDULER).Stop" >
<strong>SCHEDULER:Stop(ScheduleID)</strong>
</a>
</dt>
<dd>
<p>Stops the schedules or a specific schedule if a valid ScheduleID is provided.</p>
<h3>Parameter</h3>
<ul>
<li>
<p><code><em>#number ScheduleID </em></code>:
(optional) The ScheduleID of the planned (repeating) schedule.</p>
</li>
</ul>
</dd>
</dl>
</div>
</div>
</body>
</html>