Exemplo n.º 1
0
    int tcpCommandQueue::pushLast(QByteArray cmd, tcpDriverDataTypes::dataType type)
    {
        tcpCommand* tmpCmd = new tcpCommand(cmd,type);
        pushLast(tmpCmd);

        return 0;
    }
Exemplo n.º 2
0
void Liste::add(void *obj, int index){
	if(index < 0){
		index = (_len + 1) + index;
	}
	
	if(index < 0 || index > _len){
		//TODO TROW ERR
		cout << "ERROR _getItem index out of range" << endl;
		return;
	}
	
	if(index == 0){
		//if its the first item
		pushFirst(obj);
	} else if(index == _len) {
		//if its the last item
		pushLast(obj);		
	} else {
		//if its not first or last
		ListeItem *f = _getItem(index);
		ListeItem *b = f->_back;
		
		ListeItem *newL = new ListeItem(b, f, obj);
		b->_front = newL;
		f->_back = newL;
		
		_len++;
	}
}