summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-10-31 00:31:43 +0000
committerMike Buland <eichlan@xagasoft.com>2006-10-31 00:31:43 +0000
commit58cccdbe67f6e1966116b3d2f4c83d77863daadc (patch)
tree1b8f82cfc0e986dacb504818052ef13bc4b55bcf /src
parentfa6e658f87726b4108e8019805a2b3387d6d8517 (diff)
downloadlibbu++-58cccdbe67f6e1966116b3d2f4c83d77863daadc.tar.gz
libbu++-58cccdbe67f6e1966116b3d2f4c83d77863daadc.tar.bz2
libbu++-58cccdbe67f6e1966116b3d2f4c83d77863daadc.tar.xz
libbu++-58cccdbe67f6e1966116b3d2f4c83d77863daadc.zip
Added the new linkmessenger class that will act as a base-class for anything
that wants to send messages to a containing programlink. Also fiddled with other things...aparently.
Diffstat (limited to 'src')
-rw-r--r--src/connection.cpp2
-rw-r--r--src/connectionmonitor.cpp17
-rw-r--r--src/linkedlist.cpp17
-rw-r--r--src/linkmessage.cpp9
-rw-r--r--src/linkmessenger.cpp41
-rw-r--r--src/linkmessenger.h32
-rw-r--r--src/list.cpp17
-rw-r--r--src/programlink.cpp17
-rw-r--r--src/protocol.cpp9
-rw-r--r--src/tokenstring.cpp9
10 files changed, 74 insertions, 96 deletions
diff --git a/src/connection.cpp b/src/connection.cpp
index 3d3c094..748d56d 100644
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -311,7 +311,7 @@ void Connection::waitForInput( int nBytesIn, int nSec, int nUSec )
311 { 311 {
312 if( nSec == 0 && nUSec == 0 ) 312 if( nSec == 0 && nUSec == 0 )
313 { 313 {
314 throw ConnectionException( excodeSocketTimeout, "Socket Timeout"); 314 throw ConnectionException( excodeSocketTimeout, "Timed out while waiting for %d bytes.", nBytesIn );
315 } 315 }
316 readInput( nSec, nUSec, &nSec, &nUSec ); 316 readInput( nSec, nUSec, &nSec, &nUSec );
317 rlen = getInputAmnt(); 317 rlen = getInputAmnt();
diff --git a/src/connectionmonitor.cpp b/src/connectionmonitor.cpp
index 1b49f5d..14e46f7 100644
--- a/src/connectionmonitor.cpp
+++ b/src/connectionmonitor.cpp
@@ -1,20 +1,3 @@
1/***************************************************************************
2 connectionmonitor.cpp - description
3 -------------------
4 begin : Mon Sep 8 2003
5 copyright : (C) 2003 by Mike Buland
6 email : eichlan@yf-soft.com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#include "connectionmonitor.h" 1#include "connectionmonitor.h"
19 2
20ConnectionMonitor::ConnectionMonitor(){ 3ConnectionMonitor::ConnectionMonitor(){
diff --git a/src/linkedlist.cpp b/src/linkedlist.cpp
index 78a615a..a9902bc 100644
--- a/src/linkedlist.cpp
+++ b/src/linkedlist.cpp
@@ -1,20 +1,3 @@
1/***************************************************************************
2 linkedlist.cpp - description
3 -------------------
4 begin : Sun Oct 19 2003
5 copyright : (C) 2003 by Mike Buland
6 email : eichlan@yf-soft.com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#include "linkedlist.h" 1#include "linkedlist.h"
19 2
20LinkedList::LinkedList( ) 3LinkedList::LinkedList( )
diff --git a/src/linkmessage.cpp b/src/linkmessage.cpp
index ce838f5..cf3df42 100644
--- a/src/linkmessage.cpp
+++ b/src/linkmessage.cpp
@@ -1,12 +1,3 @@
1/***************************************************************************
2 * Copyright (C) 2003 by Mike Buland *
3 * eichlan@yf-soft.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 ***************************************************************************/
10#include "linkmessage.h" 1#include "linkmessage.h"
11#include <string.h> 2#include <string.h>
12 3
diff --git a/src/linkmessenger.cpp b/src/linkmessenger.cpp
new file mode 100644
index 0000000..3bd401a
--- /dev/null
+++ b/src/linkmessenger.cpp
@@ -0,0 +1,41 @@
1#include "linkmessenger.h"
2
3LinkMessenger::LinkMessenger() :
4 pFirst( NULL ),
5 pLast( NULL )
6{
7}
8
9LinkMessenger::~LinkMessenger()
10{
11}
12
13void LinkMessenger::enqueueMessage( LinkMessage *pMsg )
14{
15 if( pLast == NULL )
16 {
17 pFirst = pLast = new Link;
18 pLast->pMsg = pMsg;
19 pLast->pNext = NULL;
20 }
21 else
22 {
23 pLast->pNext = new Link;
24 pLast = pLast->pNext;
25 pLast->pMsg = pMsg;
26 pLast->pNext = NULL;
27 }
28}
29
30LinkMessage *LinkMessenger::dequeueMessage()
31{
32 if( pFirst == NULL )
33 return NULL;
34
35 Link *pTmp = pFirst;
36 pFirst = pFirst->pNext;
37 LinkMessage *pRet = pTmp->pMsg;
38 delete pTmp;
39 return pRet;
40}
41
diff --git a/src/linkmessenger.h b/src/linkmessenger.h
new file mode 100644
index 0000000..ed52639
--- /dev/null
+++ b/src/linkmessenger.h
@@ -0,0 +1,32 @@
1#ifndef LINK_MESSENGER_H
2#define LINK_MESSENGER_H
3
4#include <stdlib.h>
5#include <stdint.h>
6#include "linkmessage.h"
7
8class LinkMessenger
9{
10public:
11 LinkMessenger();
12 virtual ~LinkMessenger();
13
14 void enqueueMessage( LinkMessage *pMsg );
15 LinkMessage *dequeueMessage();
16 bool hasMessages()
17 {
18 return (pFirst != NULL);
19 }
20
21private:
22 typedef struct Link
23 {
24 LinkMessage *pMsg;
25 Link *pNext;
26 };
27 Link *pFirst;
28 Link *pLast;
29
30};
31
32#endif
diff --git a/src/list.cpp b/src/list.cpp
index c8b88c1..18f1a66 100644
--- a/src/list.cpp
+++ b/src/list.cpp
@@ -1,20 +1,3 @@
1/***************************************************************************
2 list.cpp - description
3 -------------------
4 begin : Sun Oct 19 2003
5 copyright : (C) 2003 by Mike Buland
6 email : eichlan@yf-soft.com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#include "list.h" 1#include "list.h"
19 2
20List::List( ) 3List::List( )
diff --git a/src/programlink.cpp b/src/programlink.cpp
index de13be8..21c6fe4 100644
--- a/src/programlink.cpp
+++ b/src/programlink.cpp
@@ -1,20 +1,3 @@
1/***************************************************************************
2 programlink.cpp - description
3 -------------------
4 begin : Sat Sep 6 2003
5 copyright : (C) 2003 by Mike Buland
6 email : eichlan@yf-soft.com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#include "programlink.h" 1#include "programlink.h"
19#include "programchain.h" 2#include "programchain.h"
20 3
diff --git a/src/protocol.cpp b/src/protocol.cpp
index 1b2621f..70c8a02 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -1,12 +1,3 @@
1/***************************************************************************
2 * Copyright (C) 2003 by Mike Buland *
3 * eichlan@yf-soft.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 ***************************************************************************/
10#include "protocol.h" 1#include "protocol.h"
11 2
12Protocol::Protocol() 3Protocol::Protocol()
diff --git a/src/tokenstring.cpp b/src/tokenstring.cpp
index 0c861ac..e57ba69 100644
--- a/src/tokenstring.cpp
+++ b/src/tokenstring.cpp
@@ -1,12 +1,3 @@
1/***************************************************************************
2 * Copyright (C) 2003 by Mike Buland *
3 * eichlan@Xagafinelle *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 ***************************************************************************/
10#include "tokenstring.h" 1#include "tokenstring.h"
11#include <string.h> 2#include <string.h>
12 3