diff options
Diffstat (limited to 'src/programchain.h')
| -rw-r--r-- | src/programchain.h | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/src/programchain.h b/src/programchain.h deleted file mode 100644 index 2bdfeee..0000000 --- a/src/programchain.h +++ /dev/null | |||
| @@ -1,95 +0,0 @@ | |||
| 1 | #ifndef PROGRAMCHAIN_H | ||
| 2 | #define PROGRAMCHAIN_H | ||
| 3 | |||
| 4 | #include "linkedlist.h" | ||
| 5 | #include "multilog.h" | ||
| 6 | #include "programlink.h" | ||
| 7 | |||
| 8 | /** | ||
| 9 | * The Program Chain links together program "chunks" to more easily facilitate | ||
| 10 | * a generalized program loop with modular extensions. | ||
| 11 | *@author Mike Buland | ||
| 12 | */ | ||
| 13 | class ProgramChain | ||
| 14 | { | ||
| 15 | public: | ||
| 16 | /** | ||
| 17 | * Construct an empty chain. | ||
| 18 | */ | ||
| 19 | ProgramChain(); | ||
| 20 | |||
| 21 | /** | ||
| 22 | * Destroy your chain. | ||
| 23 | */ | ||
| 24 | virtual ~ProgramChain(); | ||
| 25 | |||
| 26 | /** | ||
| 27 | * Adds a link to the end of the chain. | ||
| 28 | *@param pLink A pointer to the link to add to the chain. | ||
| 29 | *@returns True if adding the link was successful, otherwise false | ||
| 30 | *@author Mike Buland | ||
| 31 | */ | ||
| 32 | bool addLink( ProgramLink *pLink ); | ||
| 33 | |||
| 34 | /** | ||
| 35 | * Gets a link by name. | ||
| 36 | *@param lpName The name of the link you're looking for. Every link has a | ||
| 37 | * name, apparently. | ||
| 38 | *@returns A pointer to the specified ProgramLink, or NULL if none were | ||
| 39 | * found matching your criteria. | ||
| 40 | *@author Mike Buland | ||
| 41 | */ | ||
| 42 | class ProgramLink *getLink( const char *lpName ); | ||
| 43 | |||
| 44 | /** | ||
| 45 | * Gets the very first link in the chain. | ||
| 46 | *@returns A pointer to the first link in the chain. | ||
| 47 | *@author Mike Buland | ||
| 48 | */ | ||
| 49 | class ProgramLink *getBaseLink(); | ||
| 50 | |||
| 51 | /** | ||
| 52 | * Runs through the chain once. Useful if you want to have more control | ||
| 53 | * over the operation of the chain. | ||
| 54 | *@returns true if every link returned true. If at least one link returns | ||
| 55 | * false, then returns false. | ||
| 56 | *@author Mike Buland | ||
| 57 | */ | ||
| 58 | bool execChainOnce(); | ||
| 59 | |||
| 60 | /** | ||
| 61 | * Enters the master chain loop, looping over the entire chain and | ||
| 62 | * executing every link's TimeSlice routine in order, over and over, until | ||
| 63 | * a link returns a false value. | ||
| 64 | *@returns False, always. It returns true unless a link returned false, | ||
| 65 | * but loops until a link does return false. | ||
| 66 | *@author Mike Buland | ||
| 67 | **/ | ||
| 68 | bool enterChainLoop(); | ||
| 69 | |||
| 70 | /** | ||
| 71 | * Broadcasts an Immediate Response Message to all active links, save the | ||
| 72 | * sender. Whatever link first responds with a non-null response message | ||
| 73 | * will have it's messages sent back to the broadcasting link as the returns | ||
| 74 | * of this function call. Therefore it is very important that all message | ||
| 75 | * processing code is handled in a fairly timely fasion. | ||
| 76 | *@param pMsgOut The message to broadcast in hopes of a response. | ||
| 77 | *@param pSender The message that sent out the message and doesn't want to | ||
| 78 | * receive it's own message. This should always just be "this". | ||
| 79 | *@returns The message that was returned by the first link to return a | ||
| 80 | * non-null response. If all messages return null responses then this also | ||
| 81 | * returns null. Please note that whoever calls this will be responsible | ||
| 82 | * for deleting the message returned by it, if non-null. | ||
| 83 | */ | ||
| 84 | class LinkMessage *broadcastIRM( LinkMessage *pMsgOut, ProgramLink *pSender ); | ||
| 85 | |||
| 86 | private: | ||
| 87 | /** | ||
| 88 | * Shuts down all operation no matter what point in the operation we were. | ||
| 89 | */ | ||
| 90 | void emergencyShutdown(); | ||
| 91 | MultiLog &xLog; /**< A reference to the log. */ | ||
| 92 | LinkedList lLink; /**< The linked list that contains all of the links. */ | ||
| 93 | }; | ||
| 94 | |||
| 95 | #endif | ||
