void QueueVoid::QueueImplementation:: onBack(void *dtAdress) const { if(end) { for(int i = 0; i < end->size; ++i) *((unsigned char *) dtAdress + i) = * ((unsigned char *) end->datum + i); } else throw QueueException(); }
void QueueVoid::QueueImplementation:: onFront(void *dtAdress) const { if(beg) { for(int i = 0; i < beg->size; ++i) *((unsigned char *) dtAdress + i) = * ((unsigned char *) beg->datum + i); } else throw QueueException(); }
Queue(const unsigned int size) : capacity_(size) { if (!size) throw QueueException("Queue size has to be at least 1."); memset(&lock_, 0, sizeof(pthread_mutex_t)); memset(&space_available_, 0, sizeof(pthread_cond_t)); memset(&data_available_, 0, sizeof(pthread_cond_t)); }
Item Get() { if (Empty()) { throw QueueException("QueueException: get - queue empty"); } else { Element *t = head; Item i = t->inf; head = t->next; if (head == 0) tail = 0; delete t; return i; } }