diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-10-31 00:31:43 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-10-31 00:31:43 +0000 |
commit | 58cccdbe67f6e1966116b3d2f4c83d77863daadc (patch) | |
tree | 1b8f82cfc0e986dacb504818052ef13bc4b55bcf | |
parent | fa6e658f87726b4108e8019805a2b3387d6d8517 (diff) | |
download | libbu++-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.
-rw-r--r-- | src/connection.cpp | 2 | ||||
-rw-r--r-- | src/connectionmonitor.cpp | 17 | ||||
-rw-r--r-- | src/linkedlist.cpp | 17 | ||||
-rw-r--r-- | src/linkmessage.cpp | 9 | ||||
-rw-r--r-- | src/linkmessenger.cpp | 41 | ||||
-rw-r--r-- | src/linkmessenger.h | 32 | ||||
-rw-r--r-- | src/list.cpp | 17 | ||||
-rw-r--r-- | src/programlink.cpp | 17 | ||||
-rw-r--r-- | src/protocol.cpp | 9 | ||||
-rw-r--r-- | src/tokenstring.cpp | 9 |
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 | ||
20 | ConnectionMonitor::ConnectionMonitor(){ | 3 | ConnectionMonitor::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 | ||
20 | LinkedList::LinkedList( ) | 3 | LinkedList::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 | |||
3 | LinkMessenger::LinkMessenger() : | ||
4 | pFirst( NULL ), | ||
5 | pLast( NULL ) | ||
6 | { | ||
7 | } | ||
8 | |||
9 | LinkMessenger::~LinkMessenger() | ||
10 | { | ||
11 | } | ||
12 | |||
13 | void 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 | |||
30 | LinkMessage *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 | |||
8 | class LinkMessenger | ||
9 | { | ||
10 | public: | ||
11 | LinkMessenger(); | ||
12 | virtual ~LinkMessenger(); | ||
13 | |||
14 | void enqueueMessage( LinkMessage *pMsg ); | ||
15 | LinkMessage *dequeueMessage(); | ||
16 | bool hasMessages() | ||
17 | { | ||
18 | return (pFirst != NULL); | ||
19 | } | ||
20 | |||
21 | private: | ||
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 | ||
20 | List::List( ) | 3 | List::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 | ||
12 | Protocol::Protocol() | 3 | Protocol::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 | ||