#include <Simulation/Arbitrator.h>
Inheritance diagram for Arbitrator:

Public Types | |
| enum | State { ARB_STARTING, ARB_ENDING, ARB_WAITING, ARB_RUNNING } |
| enum defining the current current state of the arbitrator | |
Public Member Functions | |
| Arbitrator (const ConStruct &con) | |
| create's an arbitror, spawning off the other threads. | |
| virtual | ~Arbitrator () |
| Destructor Makes sure the thread exits and such like stuff. | |
| virtual void | Render ()=0 |
| Render function may be useful for displaying states, possible paths etc. Should be overridden in subclass. | |
| std::vector< Robot * > & | GetRobots () |
| gets the list of robots that this Arbitrator controls | |
| void | WakeUp () |
| Wakes the Arbitrator's thread up. | |
| void | Wait (const int cond_id) |
| Tell's the arbitrator to stop it's thread for a bit. | |
| virtual void | Execute ()=0 |
| Main execution function of arbitrator. This function is run in it's own thread in an arbitrator, and should therefore probobly contains an infinite loop. | |
| virtual bool | ConditionHandler ()=0 |
| All wait conditions are defined in a big switch statement in this function. | |
| virtual void | OnWakeUp ()=0 |
| Will be executed in the simulation thread (not the Arbitrator's thread) when the Simulation wake's the thread up after having put it to sleep. | |
Public Attributes | |
| State | state |
| This is basically the current state of the Arbitrator, waiting, running, exiting, etc. | |
Protected Attributes | |
| std::vector< Robot * > | robots |
| ordered list of robots arbitrator controls | |
| int | cur_cond_id |
| cond_id ConditionHandler is using. TODO: what is this? | |
To create you're own classes that use the Simulator, derive from Arbitrator. Think of it like co-operative multitasking.
|
|
create's an arbitror, spawning off the other threads.
|
|
|
All wait conditions are defined in a big switch statement in this function. If it returns false, then we don't we stop the Execute thread. If it returns true then we we run the Execute thread. It should not contain a loop. OVERRIDE THIS FUNCTION! |
|
|
Main execution function of arbitrator. This function is run in it's own thread in an arbitrator, and should therefore probobly contains an infinite loop. OVERRIDE THIS FUNCTION! |
|
|
Tell's the arbitrator to stop it's thread for a bit.
|
|
|
Wakes the Arbitrator's thread up. This would be called from the main thread to wakup the Arbitrator thread. Presumably after Wait() has been called. |
|
|
ordered list of robots arbitrator controls necessary so that Simulation can access robot data |
1.4.3-20050530