30 #include <lusb0_usb.h> 46 inline T
MIN(
const T& v1,
const T& v2)
48 return((v1<v2) ? v1 : v2);
58 memset(&ini, 0,
sizeof(T));
59 memset(&end, 0,
sizeof(T));
70 fprintf(stdout,
"WARNING: Copy-constructin from a non-empty QuickList!\n");
73 memset(&ini, 0,
sizeof(T));
74 memset(&end, 0,
sizeof(T));
83 return(ini.next == &end);
89 fprintf(stdout,
"WARNING: Appending non-orphan node to list...\n");
92 end.prev->next = node;
93 node->prev = end.prev;
114 return(
this == node->list);
119 if (NULL != node->prev->prev)
126 if (NULL != node->next->next)
134 node->prev->next = node->next;
135 node->next->prev = node->prev;
145 node->list->Remove(node);
149 return(NULL == node->list);
229 return(chomp.
Check());
267 typedef std::map<usb_dev_handle*, libusb_device_handle>
TMapHandles;
285 #define LIBUSBEMU_ERROR(msg) libusbemu_report_error(__FILE__, __LINE__, msg) 286 #define LIBUSBEMU_ERROR_LIBUSBWIN32() LIBUSBEMU_ERROR(usb_strerror()) 293 int i = strlen(file);
295 if ((file[i] ==
'/') || (file[i] ==
'\\'))
299 fprintf(stderr,
"ERROR in libusbemu -- source file '%s' at line %d -- %s\n", file, line, msg);
304 char* raw_address ((
char*)transfer);
314 libusb_context::TMapDevices::iterator it = ctx->
devices.insert(std::make_pair(dev,dummy)).first;
319 assert(record.
ctx == ctx);
320 assert(record.
device == dev);
321 return(&(it->second));
338 while (!allTransfers.empty())
340 libusb_device::TMapIsocTransfers::iterator it (allTransfers.begin());
342 while (!listTransfers.
Empty())
346 listTransfers.
Remove(transfer);
350 allTransfers.erase(it);
360 void*& context = wrapper->
usb;
370 switch(transfer->
type)
struct usb_device * device
const bool Remove(T *node)
std::map< struct usb_device *, libusb_device > TMapDevices
TListTransfers listTransfers
#define LIBUSBEMU_ERROR_LIBUSBWIN32()
QuickList(const QuickList &rhs)
void libusbemu_unregister_device(libusb_device *dev)
const bool Remove(T *node)
QuickList< transfer_wrapper > TListTransfers
EventList hDoneDeliveringPool
const bool Member(T *node) const
void libusbemu_report_error(const char *file, const int line, const char *msg)
QuickMutex mutDeliveryPool
const bool WaitUntilTimeout(const unsigned int milliseconds)
unsigned int actual_length
void libusbemu_clear_transfer(transfer_wrapper *wrapper)
libusb_device * libusbemu_register_device(libusb_context *ctx, struct usb_device *dev)
EventList hAllowDeliveryPool
const bool WaitUntilTimeout(unsigned int milliseconds) const
std::map< usb_dev_handle *, libusb_device_handle > TMapHandles
void libusb_free_transfer(struct libusb_transfer *transfer)
QuickListMutexed(const QuickListMutexed &rhs)
struct libusb_iso_packet_descriptor * iso_packet_desc
libusb_device_handle * dev_handle
int libusbemu_setup_transfer(transfer_wrapper *wrapper)
static freenect_context * ctx
static const bool Orphan(T *node)
T MIN(const T &v1, const T &v2)
transfer_wrapper * libusbemu_get_transfer_wrapper(libusb_transfer *transfer)
const bool Member(T *node) const
EventList hWantToDeliverPool
QuickList< transfer_wrapper > * list
QuickThread * poReapThread
TMapIsocTransfers * isoTransfers
std::map< int, isoc_handle > TMapIsocTransfers
static const bool Orphan(T *node)
static void RemoveNode(T *node)