/* Network-Integrated Multimedia Middleware (NMM)
 * http://www.motama.com/nmm.html
 *  
 * Copyright (C) 2006-2007
 * Motama GmbH, Saarbruecken, Germany
 * http://www.motama.com
 *  
 * This file is part of NMM. 
 * 
 * NMM is free software; you can redistribute it and/or modify it    
 * under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; only version 2 of the License.      
 * 
 * NMM is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 
 * License for more details.  
 * 
 * You should have received a copy of the GNU General Public License 
 * along with NMM; if not, write to the Free Software Foundation,    
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

#ifndef NMM_DEVICE_NOT_FOUND_EXCEPTION_HPP
#define NMM_DEVICE_NOT_FOUND_EXCEPTION_HPP NMM_DEVICE_NOT_FOUND_EXCEPTION_HPP

#include "nmm/nmm_prefix.hpp"

#include "nmm/comm/serialize/SerializedException.hpp"

#include "visibility.hpp"

namespace NMM {

  class InputJack;
  class OutputJack;
  class IInputJack;
  class IOutputJack;

  /** A device was not found.
   * This exception is thrown if a device was selected for a node using the IDevice::setDevice method,
   * and the device could not be opened. This may mean that the device does not exist or is not accessible.
   */
  class DLLEXPORT DeviceNotFoundException : public SerializedException {
  public:
    /** Create an exception.
     *
     * @param device Device name of the device which was not found
     */
    DeviceNotFoundException(const string& device = "")
      : SerializedException("DeviceNotFoundException"), __device(device) { setTypeName("DeviceNotFoundException"); registerAttributes(); }

    /** Create an exception.
     *
     * @param message Additional exception comment (a brief error description)
     * @param device Device name of the device which was not found
     */
    DeviceNotFoundException(const string& message, const string& device)
      : SerializedException("DeviceNotFoundException : " + message), __device(device) { setTypeName("DeviceNotFoundException"); registerAttributes();}

    /** Create an exception within a method of a NamedObject.
     *
     * @param parent NamedObject from which the exception is thrown
     * @param device Device name of the device which was not found
     */
    DeviceNotFoundException(const NamedObject* parent, const string& device)
      : SerializedException(parent, "DeviceNotFoundException"), __device(device) { setTypeName("DeviceNotFoundException"); registerAttributes();};

    /** Create an exception within a method of a NamedObject.
     *
     * @param parent NamedObject from which the exception is thrown
     * @param message Additional exception comment (a brief error description)
     * @param device Device name of the device which was not found
     */
    DeviceNotFoundException(const NamedObject* parent, const string& message, const string& device)
      : SerializedException(parent, ((message == "") ? "DeviceNotFoundException" : "DeviceNotFoundException : " + message)), __device(device) { setTypeName("DeviceNotFoundException"); registerAttributes();};

    /** Virtual copy constructor.
     *
     * @return A copy of this exception which has the same type as this exception
     */
    DeviceNotFoundException* copy() const { return new DeviceNotFoundException(*this); }

    /** Get the device ID.
     *
     * @return The device ID of the device which was not found
     */
    const string& getDevice()       const { return __device.getRValue(); }
  private: //method
    /** Register all serialized attributes.
     */
    void registerAttributes();
  private:
    TValue<string> __device;
  };
  
}

#include "nmm/nmm_suffix.hpp"

#endif
