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