1
0
mirror of https://github.com/wjwwood/serial.git synced 2026-01-22 11:44:53 +08:00

Some small changes to fix things discovered while testing serial listener.

This commit is contained in:
William Woodall 2012-01-28 14:39:55 -06:00
parent f610fb79ff
commit c3a82750e6
2 changed files with 15 additions and 3 deletions

View File

@ -159,6 +159,12 @@ public:
ComparatorType comparator_; ComparatorType comparator_;
DataCallback callback_; DataCallback callback_;
private:
// Disable copy constructors
Filter(const Filter&);
void operator=(const Filter&);
const Filter& operator=(Filter);
}; };
/*! /*!
@ -173,7 +179,7 @@ public:
*/ */
typedef boost::shared_ptr<Filter> FilterPtr; typedef boost::shared_ptr<Filter> FilterPtr;
class BlockingFilter; class BlockingFilter; // Forward declaration
/*! /*!
* Shared Pointer of BlockingFilter, returned by * Shared Pointer of BlockingFilter, returned by
@ -183,7 +189,7 @@ class BlockingFilter;
*/ */
typedef boost::shared_ptr<BlockingFilter> BlockingFilterPtr; typedef boost::shared_ptr<BlockingFilter> BlockingFilterPtr;
class BufferedFilter; class BufferedFilter; // Forward declaration
/*! /*!
* Shared Pointer of BufferedFilter, returned by * Shared Pointer of BufferedFilter, returned by
@ -637,6 +643,10 @@ public:
} }
private: private:
// Disable copy constructors
SerialListener(const SerialListener&);
void operator=(const SerialListener&);
const SerialListener& operator=(SerialListener);
// delimeter tokenizer function // delimeter tokenizer function
static void static void
_delimeter_tokenizer (const std::string &data, _delimeter_tokenizer (const std::string &data,

View File

@ -52,7 +52,9 @@ SerialListener::callback() {
if (this->callback_queue.timed_wait_and_pop(pair, 10)) { if (this->callback_queue.timed_wait_and_pop(pair, 10)) {
if (this->listening) { if (this->listening) {
try { try {
pair.first->callback_((*pair.second)); if (pair.first != NULL && pair.second != NULL) {
pair.first->callback_((*pair.second));
}
} catch (std::exception &e) { } catch (std::exception &e) {
this->handle_exc(e); this->handle_exc(e);
}// try callback }// try callback