From 31d0913410bf15af9b0277b2ad7b5197d1200edf Mon Sep 17 00:00:00 2001 From: William Woodall Date: Sun, 15 Jan 2012 16:18:42 -0600 Subject: [PATCH] Removing dead code. --- include/serial/serial_listener.h | 133 ------------------------------- src/serial_listener.cc | 19 ----- 2 files changed, 152 deletions(-) diff --git a/include/serial/serial_listener.h b/include/serial/serial_listener.h index ba274aa..938054e 100644 --- a/include/serial/serial_listener.h +++ b/include/serial/serial_listener.h @@ -113,22 +113,6 @@ typedef boost::function ComparatorType; typedef boost::function&)> 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 setHandler - * functions. - * - * \see SerialListener::setInfoHandler, SerialListener::setDebugHandler, - * SerialListener::setWarningHandler - */ -typedef boost::function LoggingCallback; -#endif - /*! * This function type describes the prototype for the exception callback. * @@ -474,116 +458,6 @@ public: /***** Hooks and Handlers ******/ -#if 0 - /*! - * Sets the handler to be called when a lines is not caught by a filter. - * - * This allows you to set a catch all function that will get called - * everytime a line is not matched by a filter and the ttl expires. - * - * Setting the callbacks works just like SerialListener::setInfoHandler. - * - * \param default_handler A function pointer to the callback to handle - * unmatched and expired messages. - * - * \see serial::DataCallback, SerialListener::setInfoHandler - */ - void - setDefaultHandler (DataCallback default_handler) { - this->_default_handler = default_handler; - } - - /*! - * Sets the function to be called when an info logging message occurs. - * - * This allows you to hook into the message reporting of the library and use - * your own logging facilities. - * - * The provided function must follow this prototype: - *
-   *    void yourInfoCallback(const std::string &msg)
-   * 
- * Here is an example: - *
-   *    void yourInfoCallback(const std::string &msg) {
-   *        std::cout << "SerialListener Info: " << msg << std::endl;
-   *    }
-   * 
- * And the resulting call to make it the callback: - *
-   *    serial::SerialListener listener;
-   *    listener.setInfoCallback(yourInfoCallback);
-   * 
- * Alternatively you can use a class method as a callback using boost::bind: - *
-   *    #include 
-   *    
-   *    #include "serial/serial_listener.h"
-   *    
-   *    class MyClass
-   *    {
-   *    public:
-   *     MyClass () {
-   *      listener.setInfoHandler(
-   *          boost::bind(&MyClass::handleInfo, this, _1));
-   *     }
-   *    
-   *     void handleInfo(const std::string &msg) {
-   *       std::cout << "MyClass Info: " << msg << std::endl;
-   *     }
-   *    
-   *    private:
-   *     serial::SerialListener listener;
-   *    };
-   * 
- * - * \param info_handler A function pointer to the callback to handle new - * Info messages. - * - * \see serial::LoggingCallback - */ - void - setInfoHandler (LoggingCallback info_handler) { - this->info = info_handler; - } - - /*! - * Sets the function to be called when a debug logging message occurs. - * - * This allows you to hook into the message reporting of the library and use - * your own logging facilities. - * - * This works just like SerialListener::setInfoHandler. - * - * \param debug_handler A function pointer to the callback to handle new - * Debug messages. - * - * \see serial::LoggingCallback, SerialListener::setInfoHandler - */ - void - setDebugHandler (LoggingCallback debug_handler) { - this->debug = debug_handler; - } - - /*! - * Sets the function to be called when a warning logging message occurs. - * - * This allows you to hook into the message reporting of the library and use - * your own logging facilities. - * - * This works just like SerialListener::setInfoHandler. - * - * \param warning_handler A function pointer to the callback to handle new - * Warning messages. - * - * \see serial::LoggingCallback, SerialListener::setInfoHandler - */ - void - setWarningHandler (LoggingCallback warning_handler) { - this->warn = warning_handler; - } -#endif - /*! * Sets the function to be called when an exception occurs internally. * @@ -792,13 +666,6 @@ private: // Tokenizer TokenizerType tokenize; -#if 0 - // Logging handlers - LoggingCallback warn; - LoggingCallback info; - LoggingCallback debug; -#endif - // Exception handler ExceptionCallback handle_exc; diff --git a/src/serial_listener.cc b/src/serial_listener.cc index 599ee88..e3af13a 100644 --- a/src/serial_listener.cc +++ b/src/serial_listener.cc @@ -2,20 +2,6 @@ /***** Inline Functions *****/ -#if 0 -inline void defaultWarningCallback(const std::string& msg) { - std::cout << "SerialListener Warning: " << msg << std::endl; -} - -inline void defaultDebugCallback(const std::string& msg) { - std::cout << "SerialListener Debug: " << msg << std::endl; -} - -inline void defaultInfoCallback(const std::string& msg) { - std::cout << "SerialListener Info: " << msg << std::endl; -} -#endif - inline void defaultExceptionCallback(const std::exception &error) { std::cerr << "SerialListener Unhandled Exception: " << error.what(); std::cerr << std::endl; @@ -38,11 +24,6 @@ SerialListener::default_handler(const std::string &token) { SerialListener::SerialListener() : listening(false), chunk_size_(5) { // Set default callbacks this->handle_exc = defaultExceptionCallback; -#if 0 - this->info = defaultInfoCallback; - this->debug = defaultDebugCallback; - this->warn = defaultWarningCallback; -#endif // Default handler stuff this->_default_handler = NULL;