summaryrefslogtreecommitdiff
path: root/src/programchain.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-10-27 04:44:46 +0000
committerMike Buland <eichlan@xagasoft.com>2011-10-27 04:44:46 +0000
commit9906ffe3c54875133448134c09ec12a0949d48cd (patch)
tree0542fef3d27e796700b87b44394a3ad31dd5b852 /src/programchain.cpp
parent411f240da34bab53cd18aa8b7ba09834ede49b1c (diff)
parent029b5d159023f4dad607359dbfaa2479e21fe9e5 (diff)
downloadlibbu++-9906ffe3c54875133448134c09ec12a0949d48cd.tar.gz
libbu++-9906ffe3c54875133448134c09ec12a0949d48cd.tar.bz2
libbu++-9906ffe3c54875133448134c09ec12a0949d48cd.tar.xz
libbu++-9906ffe3c54875133448134c09ec12a0949d48cd.zip
Reorg'd! I merged in the release-fixup branch and fixed all random warnings.
I also cleaned up the build script, the symlink generation is faster and looks nicer, there's one think left to fix there, but it's not too bad.
Diffstat (limited to 'src/programchain.cpp')
-rw-r--r--src/programchain.cpp104
1 files changed, 0 insertions, 104 deletions
diff --git a/src/programchain.cpp b/src/programchain.cpp
deleted file mode 100644
index ce0c9cc..0000000
--- a/src/programchain.cpp
+++ /dev/null
@@ -1,104 +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#include <stdlib.h>
9#include "bu/programchain.h"
10#include "bu/programlink.h"
11
12using namespace Bu;
13
14Bu::ProgramChain::ProgramChain()
15{
16}
17
18Bu::ProgramChain::~ProgramChain()
19{
20}
21
22bool Bu::ProgramChain::addLink( ProgramLink *pLink )
23{
24 if( pLink->init() == false )
25 {
26 emergencyShutdown();
27 return false;
28 }
29
30 lLink.append( pLink );
31
32 pLink->setChain( this );
33
34 return true;
35}
36
37ProgramLink *Bu::ProgramChain::getLink( const char *lpName )
38{
39 char a;
40 a = lpName[0];
41 return NULL;
42}
43
44ProgramLink *Bu::ProgramChain::getBaseLink()
45{
46 return NULL;
47}
48
49bool Bu::ProgramChain::execChainOnce()
50{
51 for( Bu::List<Bu::ProgramLink *>::iterator i = lLink.begin();
52 i != lLink.end(); i++ )
53 {
54 if( (*i)->timeSlice() == false )
55 {
56 emergencyShutdown();
57 return false;
58 }
59 }
60
61 return true;
62}
63
64bool Bu::ProgramChain::enterChainLoop()
65{
66 for(;;)
67 {
68 if( execChainOnce() == false )
69 {
70 return false;
71 }
72 }
73
74 return true;
75}
76
77void Bu::ProgramChain::emergencyShutdown()
78{
79 for( Bu::List<Bu::ProgramLink *>::iterator i = lLink.begin();
80 i != lLink.end(); i++ )
81 {
82 (*i)->deInit();
83 delete *i;
84 }
85 lLink.clear();
86}
87
88LinkMessage *Bu::ProgramChain::broadcastIRM( LinkMessage *pMsgOut, ProgramLink * /*pSender*/ )
89{
90 for( Bu::List<Bu::ProgramLink *>::iterator i = lLink.begin();
91 i != lLink.end(); i++ )
92 {
93 LinkMessage *pMsg = (*i)->processIRM( pMsgOut );
94 if( pMsg != NULL )
95 {
96 delete pMsgOut;
97 return pMsg;
98 }
99 }
100
101 delete pMsgOut;
102 return NULL;
103}
104