<commit_before>/*!
 * \file SickException.hh
 * \brief Contains some simple exception classes.
 *
 * Code by <NAME> and <NAME>.
 * Contact derenick(at)lehigh(dot)edu
 *
 * The Sick LIDAR Matlab/C++ Toolbox
 * Copyright (c) 2008, <NAME> and <NAME>
 * All rights reserved.
 *
 * This software is released under a BSD Open-Source License.
 * See http://sicktoolbox.sourceforge.net
 */

#ifndef SICK_EXCEPTION
#define SICK_EXCEPTION

/* Definition dependencies */
#include <string>
#include <exception>

/* Associate the namespace */
namespace SickToolbox {

  /** \class SickException
   *  \brief Provides a base exception class from
   *         which to derive other Sick exceptions
   */
  class SickException : std::exception {

  public:

    /**
     * \brief A standard constructor
     * \param general_str A descriptive "general" string
     */
    SickException( const std::string general_str ) :
      _general_str(general_str), _detailed_str("") { }

    /**
     * \brief A standard constructor
     * \param general_str A descriptive "general" string
     * \param detailed_str A more detailed description
     */
    SickException( const std::string general_str, const std::string detailed_str ) :
      _general_str(general_str), _detailed_str(detailed_str) { }
    
    /**
     * \brief From the standard exception library 
     */
    virtual const char* what( ) const throw() {
      std::string result = _general_str + " " + _detailed_str;
      return result.c_str();
    }

    /**
     * \brief A destructor
     */
    ~SickException() throw() {}

  private:

    /** The string identifier */
    std::string _general_str;

    /** For each sub-class to give more details */
    std::string _detailed_str;
    
  };

  /**
   * \class SickTimeoutException
   * \brief Makes handling timeouts much easier
   */
  class SickTimeoutException : public SickException {
<commit_msg>Fixed a bug concerning dynamically allocating strings on the stack of an active exception. Thanks to <NAME> and <NAME> for their original patch, which motivated this fix.<commit_after>/*!
 * \file SickException.hh
 * \brief Contains some simple exception classes.
 *
 * Code by <NAME> and <NAME>.
 * Contact derenick(at)lehigh(dot)edu
 *
 * The Sick LIDAR Matlab/C++ Toolbox
 * Copyright (c) 2008, <NAME> and <NAME>
 * All rights reserved.
 *
 * This software is released under a BSD Open-Source License.
 * See http://sicktoolbox.sourceforge.net
 */

#ifndef SICK_EXCEPTION
#define SICK_EXCEPTION

/* Definition dependencies */
#include <string>
#include <exception>

/* Associate the namespace */
namespace SickToolbox {

  /** \class SickException
   *  \brief Provides a base exception class from
   *         which to derive other Sick exceptions
   */
  class SickException : std::exception {

  public:

    /**
     * \brief A standard constructor
     * \param general_str A descriptive "general" string
     */
    SickException( const std::string general_str ) { 
      _detailed_msg = general_str;
    }

    /**
     * \brief A standard constructor
     * \param general_str A descriptive "general" string
     * \param detailed_str A more detailed description
     */
    SickException( const std::string general_str, const std::string detailed_str ) {
      _detailed_msg = general_str + " " + detailed_str;
    }
    
    /**
     * \brief From the standard exception library 
     */
    virtual const char* what( ) const throw() {
      return _detailed_msg.c_str();
    }

    /**
     * \brief A destructor
     */
    ~SickException() throw() {}

  private:

    /** The string identifier */
    std::string _detailed_msg;
    
  };

  /**
   * \class SickTimeoutException
   * \brief Makes handling timeouts much easier
   */
  class SickTimeoutException : public SickException {

{'fraction_non_alphanumeric': 0.10418310970797158, 'fraction_numerical': 0.002104709287029729, 'mean_word_length': 2.8677517802644963, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4609840', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1094, 'n_words': 346}