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