aboutsummaryrefslogtreecommitdiff
path: root/src/programlink.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-04-03 03:49:53 +0000
committerMike Buland <eichlan@xagasoft.com>2007-04-03 03:49:53 +0000
commitf4c20290509d7ed3a8fd5304577e7a4cc0b9d974 (patch)
tree13cdf64f7cf134f397a7165b7a3fe0807e37026b /src/programlink.h
parent74d4c8cd27334fc7204d5a8773deb3d424565778 (diff)
downloadlibbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.gz
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.bz2
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.xz
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.zip
Ok, no code is left in src, it's all in src/old. We'll gradually move code back
into src as it's fixed and re-org'd. This includes tests, which, I may write a unit test system into libbu++ just to make my life easier.
Diffstat (limited to 'src/programlink.h')
-rw-r--r--src/programlink.h99
1 files changed, 0 insertions, 99 deletions
diff --git a/src/programlink.h b/src/programlink.h
deleted file mode 100644
index f93edcc..0000000
--- a/src/programlink.h
+++ /dev/null
@@ -1,99 +0,0 @@
1#ifndef PROGRAMLINK_H
2#define PROGRAMLINK_H
3
4class ProgramLink;
5#include "queue.h"
6#include "linkmessage.h"
7#include "programchain.h"
8
9/**
10 * Program Link is the base class for any object that will be a piece of the
11 * main program chain loop.
12 *@author Mike Buland
13 */
14class ProgramLink
15{
16friend class ProgramChain;
17public:
18 /**
19 * Construct a program link.
20 */
21 ProgramLink();
22
23 /**
24 * Deconstruct.
25 */
26 virtual ~ProgramLink();
27
28 /**
29 * Initialization code required for a link that wasn't performed in the
30 * constructor.
31 *@returns true if initialization was successful. A false value will halt
32 * the chain.
33 */
34 virtual bool init()=0;
35
36 /**
37 * DeInitialization code that should happen, but doesn't belong in the
38 * destructor.
39 *@returns true means everything worked, false means failure, but is
40 * meaningless.
41 */
42 virtual bool deInit()=0;
43
44 /**
45 * Executed once per link per chain pass. Contains the guts of the program.
46 *@returns true if everything went well. A false value will halt the chain.
47 */
48 virtual bool timeSlice()=0;
49
50 /**
51 * This must be handled in order to process Instant Response Messages.
52 * This function should return null on all messages that it doesn't
53 * understand how to handle, and construct new messages to return to sender
54 * in the cases where it does understand.
55 *@param pMsgIn The message that must be processed.
56 *@returns Either a new message in cases where a response is required,
57 * or null if nothing needs to be done by this link.
58 */
59 virtual LinkMessage *processIRM( LinkMessage *pMsgIn ) = 0;
60
61 /**
62 * Broadcast a LinkMessage to all other links in the system. Each other
63 * link will get a call of their processIRM function. If the message gets
64 * a response then you will regain control immediately, otherwise the system
65 * will give all other Links a chance to respond before returning NULL.
66 *@param pMsgOut The message to broadcast.
67 *@returns The message response, or NULL if no Link understood your message.
68 */
69 LinkMessage *sendIRM( LinkMessage *pMsgOut );
70
71private:
72 /**
73 * Set which chain we're assosiated with. This is how IRM messages make
74 * it out to the rest of the world.
75 *@param pNewChain A pointer to the containing program chain.
76 */
77 void setChain( class ProgramChain *pNewChain );
78
79 /**
80 * The pointer to the containing chain.
81 */
82 class ProgramChain *pChain;
83/*
84 void postMessage( LinkMessage *pMsg, int nLvl );
85 LinkMessage *getMessage( int nLvl );
86
87 enum
88 {
89 msgToChain,
90 msgToLink
91 };
92
93private:
94 Queue qMsgToChain;
95 Queue qMsgToLink;
96*/
97};
98
99#endif