aboutsummaryrefslogtreecommitdiff
path: root/src/programchain.cpp
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/programchain.cpp
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/programchain.cpp')
-rw-r--r--src/programchain.cpp96
1 files changed, 0 insertions, 96 deletions
diff --git a/src/programchain.cpp b/src/programchain.cpp
deleted file mode 100644
index 6120d58..0000000
--- a/src/programchain.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
1#include <stdlib.h>
2#include "programchain.h"
3
4ProgramChain::ProgramChain() :
5 xLog( MultiLog::getInstance() )
6{
7 xLog.LineLog( MultiLog::LStatus, "Program Chain Initialized." );
8}
9
10ProgramChain::~ProgramChain()
11{
12}
13
14bool ProgramChain::addLink( ProgramLink *pLink )
15{
16 if( pLink->init() == false )
17 {
18 emergencyShutdown();
19 return false;
20 }
21
22 lLink.append( pLink );
23
24 pLink->setChain( this );
25
26 return true;
27}
28
29ProgramLink *ProgramChain::getLink( const char *lpName )
30{
31 char a;
32 a = lpName[0];
33 return NULL;
34}
35
36ProgramLink *ProgramChain::getBaseLink()
37{
38 return NULL;
39}
40
41bool ProgramChain::execChainOnce()
42{
43 int nLen = lLink.getSize();
44 for( int j = 0; j < nLen; j++ )
45 {
46 if( ((ProgramLink *)lLink[j])->timeSlice() == false )
47 {
48 xLog.LineLog( MultiLog::LInfo, "Shutting down due to signal from link #%d", j );
49 emergencyShutdown();
50 return false;
51 }
52 }
53
54 return true;
55}
56
57bool ProgramChain::enterChainLoop()
58{
59 for(;;)
60 {
61 if( execChainOnce() == false )
62 {
63 return false;
64 }
65 }
66
67 return true;
68}
69
70void ProgramChain::emergencyShutdown()
71{
72 int nLen = lLink.getSize();
73 for( int j = 0; j < nLen; j++ )
74 {
75 ((ProgramLink *)lLink[j])->deInit();
76 delete (ProgramLink *)lLink[j];
77 }
78 lLink.empty();
79}
80
81LinkMessage *ProgramChain::broadcastIRM( LinkMessage *pMsgOut, ProgramLink *pSender )
82{
83 int nLen = lLink.getSize();
84 for( int j = 0; j < nLen; j++ )
85 {
86 LinkMessage *pMsg = ((ProgramLink *)lLink[j])->processIRM( pMsgOut );
87 if( pMsg != NULL )
88 {
89 delete pMsgOut;
90 return pMsg;
91 }
92 }
93
94 delete pMsgOut;
95 return NULL;
96}