summaryrefslogtreecommitdiff
path: root/src/programlink.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/programlink.h')
-rw-r--r--src/programlink.h106
1 files changed, 0 insertions, 106 deletions
diff --git a/src/programlink.h b/src/programlink.h
deleted file mode 100644
index 36a605e..0000000
--- a/src/programlink.h
+++ /dev/null
@@ -1,106 +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_PROGRAMLINK_H
9#define BU_PROGRAMLINK_H
10
11#include "bu/linkmessage.h"
12#include "bu/programchain.h"
13
14namespace Bu
15{
16 /**
17 * Program Link is the base class for any object that will be a piece of the
18 * main program chain loop.
19 */
20 class ProgramLink
21 {
22 friend class Bu::ProgramChain;
23 public:
24 /**
25 * Construct a program link.
26 */
27 ProgramLink();
28
29 /**
30 * Deconstruct.
31 */
32 virtual ~ProgramLink();
33
34 /**
35 * Initialization code required for a link that wasn't performed in the
36 * constructor.
37 *@returns true if initialization was successful. A false value will halt
38 * the chain.
39 */
40 virtual bool init()=0;
41
42 /**
43 * DeInitialization code that should happen, but doesn't belong in the
44 * destructor.
45 *@returns true means everything worked, false means failure, but is
46 * meaningless.
47 */
48 virtual bool deInit()=0;
49
50 /**
51 * Executed once per link per chain pass. Contains the guts of the program.
52 *@returns true if everything went well. A false value will halt the chain.
53 */
54 virtual bool timeSlice()=0;
55
56 /**
57 * This must be handled in order to process Instant Response Messages.
58 * This function should return null on all messages that it doesn't
59 * understand how to handle, and construct new messages to return to sender
60 * in the cases where it does understand.
61 *@param pMsgIn The message that must be processed.
62 *@returns Either a new message in cases where a response is required,
63 * or null if nothing needs to be done by this link.
64 */
65 virtual LinkMessage *processIRM( LinkMessage *pMsgIn ) = 0;
66
67 /**
68 * Broadcast a LinkMessage to all other links in the system. Each other
69 * link will get a call of their processIRM function. If the message gets
70 * a response then you will regain control immediately, otherwise the system
71 * will give all other Links a chance to respond before returning NULL.
72 *@param pMsgOut The message to broadcast.
73 *@returns The message response, or NULL if no Link understood your message.
74 */
75 LinkMessage *sendIRM( LinkMessage *pMsgOut );
76
77 private:
78 /**
79 * Set which chain we're assosiated with. This is how IRM messages make
80 * it out to the rest of the world.
81 *@param pNewChain A pointer to the containing program chain.
82 */
83 void setChain( class ProgramChain *pNewChain );
84
85 /**
86 * The pointer to the containing chain.
87 */
88 class ProgramChain *pChain;
89 /*
90 void postMessage( LinkMessage *pMsg, int nLvl );
91 LinkMessage *getMessage( int nLvl );
92
93 enum
94 {
95 msgToChain,
96 msgToLink
97 };
98
99 private:
100 Queue qMsgToChain;
101 Queue qMsgToLink;
102 */
103 };
104}
105
106#endif