00001 /*************************************************************************** 00002 LOW_portUsb_Factory.h - description 00003 ------------------- 00004 begin : Sun Oct 12 2003 00005 copyright : (C) 2003 by Harald Roelle 00006 email : roelle@informatik.uni-muenchen.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef LOW_PORTUSB_FACTORY_H 00019 #define LOW_PORTUSB_FACTORY_H 00020 00021 00022 #include <string> 00023 00024 00025 #include "LOW_portUsbDevice.h" 00026 00027 00028 /** Factory class for platform specific objects related to USB devices. 00029 00030 This class also contains platform specific type definitions. 00031 00032 This class is thread-safe. 00033 00034 @see LOW_portUsbDevice 00035 00036 @author Harald Roelle 00037 */ 00038 class LOW_portUsb_Factory { 00039 00040 //======================================================================================= 00041 public: 00042 00043 //===================================================================================== 00044 // 00045 // type definitions 00046 // 00047 00048 #ifdef __linux__ 00049 00050 /** Linux specific type to identify a specific USB device. */ 00051 typedef std::string usbDeviceSpecifier_t; 00052 00053 #endif 00054 00055 00056 //===================================================================================== 00057 // 00058 // static factory 00059 // 00060 00061 /** Platform aware replacement for creating dynamic instances of LOW_portUsbDevice. 00062 @param inPortSpec Unique identifier for new USB device instance. 00063 @return Pointer to new instance of LOW_portUsbDevice. 00064 */ 00065 static LOW_portUsbDevice* new_portUsbDevice( const usbDeviceSpecifier_t inUsbDevSpec); 00066 00067 /** Platform aware replacement for creating dynamic instances of LOW_portUsbDevice. 00068 If more than one device with the same vendor/product id is present, the first 00069 device found is used. 00070 @param inVendorID Vendor for new USB device instance. 00071 @param inProductID Product for new USB device instance. 00072 @return Pointer to new instance of LOW_portUsbDevice. 00073 */ 00074 static LOW_portUsbDevice* new_portUsbDevice( const LOW_portUsbDevice::usbVendorID_t inVendorID, 00075 const LOW_portUsbDevice::usbProductID_t inProductID); 00076 00077 00078 //======================================================================================= 00079 private: 00080 00081 //===================================================================================== 00082 // 00083 // constructors 00084 // 00085 00086 /** Constructor. 00087 Private to prevent instaciation as this is a static factory. 00088 */ 00089 LOW_portUsb_Factory(); 00090 00091 /** Destructor. 00092 Private to prevent instaciation as this is a static factory. 00093 */ 00094 virtual ~LOW_portUsb_Factory(); 00095 00096 }; 00097 00098 #endif 00099