aboutsummaryrefslogtreecommitdiff
path: root/src/programchain.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-07-03 00:28:59 +0000
committerMike Buland <eichlan@xagasoft.com>2007-07-03 00:28:59 +0000
commitac517a2b7625e0aa0862679e961c6349f859ea3b (patch)
treee3e27a6b9bd5e2be6150088495c91fc91786ad9d /src/programchain.cpp
parentf8d4301e9fa4f3709258505941e37fab2eadadc6 (diff)
parentbd865cee5f89116c1f054cd0e5c275e97c2d0a9b (diff)
downloadlibbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.gz
libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.bz2
libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.xz
libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.zip
The reorg is being put in trunk, I think it's ready. Now we just get to find
out how many applications won't work anymore :)
Diffstat (limited to 'src/programchain.cpp')
-rw-r--r--src/programchain.cpp49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/programchain.cpp b/src/programchain.cpp
index 6120d58..0bb7a77 100644
--- a/src/programchain.cpp
+++ b/src/programchain.cpp
@@ -1,17 +1,18 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include "programchain.h" 2#include "bu/programchain.h"
3#include "bu/programlink.h"
3 4
4ProgramChain::ProgramChain() : 5using namespace Bu;
5 xLog( MultiLog::getInstance() ) 6
7Bu::ProgramChain::ProgramChain()
6{ 8{
7 xLog.LineLog( MultiLog::LStatus, "Program Chain Initialized." );
8} 9}
9 10
10ProgramChain::~ProgramChain() 11Bu::ProgramChain::~ProgramChain()
11{ 12{
12} 13}
13 14
14bool ProgramChain::addLink( ProgramLink *pLink ) 15bool Bu::ProgramChain::addLink( ProgramLink *pLink )
15{ 16{
16 if( pLink->init() == false ) 17 if( pLink->init() == false )
17 { 18 {
@@ -26,26 +27,25 @@ bool ProgramChain::addLink( ProgramLink *pLink )
26 return true; 27 return true;
27} 28}
28 29
29ProgramLink *ProgramChain::getLink( const char *lpName ) 30ProgramLink *Bu::ProgramChain::getLink( const char *lpName )
30{ 31{
31 char a; 32 char a;
32 a = lpName[0]; 33 a = lpName[0];
33 return NULL; 34 return NULL;
34} 35}
35 36
36ProgramLink *ProgramChain::getBaseLink() 37ProgramLink *Bu::ProgramChain::getBaseLink()
37{ 38{
38 return NULL; 39 return NULL;
39} 40}
40 41
41bool ProgramChain::execChainOnce() 42bool Bu::ProgramChain::execChainOnce()
42{ 43{
43 int nLen = lLink.getSize(); 44 for( Bu::List<Bu::ProgramLink *>::iterator i = lLink.begin();
44 for( int j = 0; j < nLen; j++ ) 45 i != lLink.end(); i++ )
45 { 46 {
46 if( ((ProgramLink *)lLink[j])->timeSlice() == false ) 47 if( (*i)->timeSlice() == false )
47 { 48 {
48 xLog.LineLog( MultiLog::LInfo, "Shutting down due to signal from link #%d", j );
49 emergencyShutdown(); 49 emergencyShutdown();
50 return false; 50 return false;
51 } 51 }
@@ -54,7 +54,7 @@ bool ProgramChain::execChainOnce()
54 return true; 54 return true;
55} 55}
56 56
57bool ProgramChain::enterChainLoop() 57bool Bu::ProgramChain::enterChainLoop()
58{ 58{
59 for(;;) 59 for(;;)
60 { 60 {
@@ -67,23 +67,23 @@ bool ProgramChain::enterChainLoop()
67 return true; 67 return true;
68} 68}
69 69
70void ProgramChain::emergencyShutdown() 70void Bu::ProgramChain::emergencyShutdown()
71{ 71{
72 int nLen = lLink.getSize(); 72 for( Bu::List<Bu::ProgramLink *>::iterator i = lLink.begin();
73 for( int j = 0; j < nLen; j++ ) 73 i != lLink.end(); i++ )
74 { 74 {
75 ((ProgramLink *)lLink[j])->deInit(); 75 (*i)->deInit();
76 delete (ProgramLink *)lLink[j]; 76 delete *i;
77 } 77 }
78 lLink.empty(); 78 lLink.clear();
79} 79}
80 80
81LinkMessage *ProgramChain::broadcastIRM( LinkMessage *pMsgOut, ProgramLink *pSender ) 81LinkMessage *Bu::ProgramChain::broadcastIRM( LinkMessage *pMsgOut, ProgramLink *pSender )
82{ 82{
83 int nLen = lLink.getSize(); 83 for( Bu::List<Bu::ProgramLink *>::iterator i = lLink.begin();
84 for( int j = 0; j < nLen; j++ ) 84 i != lLink.end(); i++ )
85 { 85 {
86 LinkMessage *pMsg = ((ProgramLink *)lLink[j])->processIRM( pMsgOut ); 86 LinkMessage *pMsg = (*i)->processIRM( pMsgOut );
87 if( pMsg != NULL ) 87 if( pMsg != NULL )
88 { 88 {
89 delete pMsgOut; 89 delete pMsgOut;
@@ -94,3 +94,4 @@ LinkMessage *ProgramChain::broadcastIRM( LinkMessage *pMsgOut, ProgramLink *pSen
94 delete pMsgOut; 94 delete pMsgOut;
95 return NULL; 95 return NULL;
96} 96}
97