aboutsummaryrefslogtreecommitdiff
path: root/src/programchain.cpp
diff options
context:
space:
mode:
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