| 1 | /*************************************************************************** |
| 2 | stack.h - description |
| 3 | ------------------- |
| 4 | begin : Sat Mar 16 2002 |
| 5 | copyright : (C) 2002 by Michael Bridak |
| 6 | email : [email protected] |
| 7 | $Id: stack.h,v 1.4 2003/04/14 05:51:04 mbridak Exp $ |
| 8 | ***************************************************************************/ |
| 9 | |
| 10 | /*************************************************************************** |
| 11 | * * |
| 12 | * This program is free software; you can redistribute it and/or modify * |
| 13 | * it under the terms of the GNU General Public License as published by * |
| 14 | * the Free Software Foundation; either version 2 of the License. * |
| 15 | * . * |
| 16 | * * |
| 17 | ***************************************************************************/ |
| 18 | |
| 19 | #ifndef STACK_H |
| 20 | #define STACK_H |
| 21 | |
| 22 | /**Holds sound information for the SONAR |
| 23 | *@author Michael Bridak |
| 24 | * Re-written to use linked list instead of array |
| 25 | * by Jesse |
| 26 | */ |
| 27 | |
| 28 | |
| 29 | #ifndef TRUE |
| 30 | #define TRUE 1 |
| 31 | #endif |
| 32 | #ifndef FALSE |
| 33 | #define FALSE 0 |
| 34 | #endif |
| 35 | |
| 36 | typedef struct |
| 37 | { |
| 38 | int direction, ship_type; |
| 39 | float signal_strength; |
| 40 | void *next; |
| 41 | } STACK_DATA; |
| 42 | |
| 43 | class Stack { |
| 44 | public: |
| 45 | /** how many events for this second*/ |
| 46 | int counter; |
| 47 | /** storage space */ |
| 48 | STACK_DATA *stack, *top_of_stack; |
| 49 | /** Advance sound history, drop old events */ |
| 50 | void AdvanceSonarHistory(); |
| 51 | /** Place a sound event on in the Queue */ |
| 52 | int RegisterEvent(int direction, float signalstrength, int ship_type); |
| 53 | /** Get how many events are in the Queue for a particular second */ |
| 54 | int GetCount(); |
| 55 | /** Get sound information */ |
| 56 | int GetEvent(int event, int *Direction, float *SignalStrength, int *ship_type); |
| 57 | Stack(); |
| 58 | ~Stack(); |
| 59 | }; |
| 60 | |
| 61 | #endif |