1
0
mirror of https://github.com/wjwwood/serial.git synced 2026-01-23 04:04:54 +08:00

Fixing Findserial.cmake and updating serial_listener.h to remove unused functions.

This commit is contained in:
William Woodall 2012-01-14 20:52:50 -06:00
parent dc53f3d132
commit 4afa6e2e7c
2 changed files with 49 additions and 27 deletions

View File

@ -1,6 +1,8 @@
find_path(serial_INCLUDE_DIRS serial.h serial_listener.h /usr/include/serial "$ENV{NAMER_ROOT}") find_path(serial_INCLUDE_DIRS serial.h serial_listener.h /usr/include/serial
/usr/local/include/serial "$ENV{NAMER_ROOT}")
find_library(serial_LIBRARIES serial /usr/lib "$ENV{NAMER_ROOT}") find_library(serial_LIBRARIES serial /usr/lib /usr/local/lib
"$ENV{NAMER_ROOT}")
set(serial_FOUND TRUE) set(serial_FOUND TRUE)

View File

@ -90,31 +90,6 @@ typedef boost::function<void(const std::string&)> DataCallback;
*/ */
typedef boost::function<bool(const std::string&)> ComparatorType; typedef boost::function<bool(const std::string&)> ComparatorType;
/*!
* This function type describes the prototype for the logging callbacks.
*
* The function takes a std::string reference and returns nothing. It is
* called from the library when a logging message occurs. This
* allows the library user to hook into this and integrate it with their own
* logging system. It can be set with any of the set<log level>Handler
* functions.
*
* \see SerialListener::setInfoHandler, SerialListener::setDebugHandler,
* SerialListener::setWarningHandler
*/
typedef boost::function<void(const std::string&)> LoggingCallback;
/*!
* This function type describes the prototype for the exception callback.
*
* The function takes a std::exception reference and returns nothing. It is
* called from the library when an exception occurs in a library thread.
* This exposes these exceptions to the user so they can to error handling.
*
* \see SerialListener::setExceptionHandler
*/
typedef boost::function<void(const std::exception&)> ExceptionCallback;
/*! /*!
* This function type describes the prototype for the tokenizer callback. * This function type describes the prototype for the tokenizer callback.
* *
@ -138,6 +113,33 @@ typedef boost::function<void(const std::exception&)> ExceptionCallback;
typedef boost::function<void(const std::string&, std::vector<TokenPtr>&)> typedef boost::function<void(const std::string&, std::vector<TokenPtr>&)>
TokenizerType; TokenizerType;
#if 0
/*!
* This function type describes the prototype for the logging callbacks.
*
* The function takes a std::string reference and returns nothing. It is
* called from the library when a logging message occurs. This
* allows the library user to hook into this and integrate it with their own
* logging system. It can be set with any of the set<log level>Handler
* functions.
*
* \see SerialListener::setInfoHandler, SerialListener::setDebugHandler,
* SerialListener::setWarningHandler
*/
typedef boost::function<void(const std::string&)> LoggingCallback;
#endif
/*!
* This function type describes the prototype for the exception callback.
*
* The function takes a std::exception reference and returns nothing. It is
* called from the library when an exception occurs in a library thread.
* This exposes these exceptions to the user so they can to error handling.
*
* \see SerialListener::setExceptionHandler
*/
typedef boost::function<void(const std::exception&)> ExceptionCallback;
/*! /*!
* Represents a filter which new data is passed through. * Represents a filter which new data is passed through.
* *
@ -472,6 +474,7 @@ public:
/***** Hooks and Handlers ******/ /***** Hooks and Handlers ******/
#if 0
/*! /*!
* Sets the handler to be called when a lines is not caught by a filter. * Sets the handler to be called when a lines is not caught by a filter.
* *
@ -579,6 +582,23 @@ public:
setWarningHandler (LoggingCallback warning_handler) { setWarningHandler (LoggingCallback warning_handler) {
this->warn = warning_handler; this->warn = warning_handler;
} }
#endif
/*!
* Sets the function to be called when an exception occurs internally.
*
* This allows you to hook into the exceptions that occur in threads inside
* the serial listener library.
*
* \param exception_handler A function pointer to the callback to handle new
* interal exceptions.
*
* \see serial::ExceptionCallback
*/
void
setWarningHandler (ExceptionCallback exception_handler) {
this->handle_exc = exception_handler;
}
/***** Static Functions ******/ /***** Static Functions ******/