Ejemplo n.º 1
0
void Gear_UnpackList::clearList()
{
  ListType *listType = _LIST_OUT->type();
  for(ListType::iterator it=listType->begin(); it!=listType->end(); ++it)
    delete (*it);
  listType->clear();
}
Ejemplo n.º 2
0
	void addToList(const typename ListType::value_type &data, ListType &list) const {
		if (length()<=0) {
			// Ensure that no dummy data will get added. Shouldn't get here.
			return;
		}
		if (startbyte()==0 && goesToEndOfFile()) {
			// favor a single chunk covering the whole file.
			list.clear();
			list.insert(list.end(), data);
			return;
		}

		typename ListType::iterator endIter=list.end(), iter=list.begin();
		Range::base_type startdata = startbyte();
		Range::base_type maxend = startdata;
		bool includeseof = false;
		while (iter != endIter) {
			// maxend is not relevant for ranges strictly above us.
			if ((*iter).startbyte() > startdata) {
				break;
			}
			if ((*iter).endbyte() > maxend) {
				maxend = (*iter).endbyte();
			}
			if ((*iter).goesToEndOfFile()) {
				includeseof = true;
			}
			// we do not want to allow for more than one
			// range starting at the same start byte--
			// If this is the case, one is guaranteed to overlap.
			if ((*iter).startbyte() >= startdata) {
				break;
			}
			++iter;
		}
		if (includeseof || (maxend > endbyte() && !goesToEndOfFile())) {
			return; // already included by another range.
		}
		iter = list.insert(iter, data);
		++iter;
		while (iter != endIter) {
			typename ListType::iterator nextIter = iter;
			++nextIter;

			if (goesToEndOfFile() ||
					(!(*iter).goesToEndOfFile() && (*iter).endbyte() <= endbyte())) {
				list.erase(iter);
			}

			iter = nextIter;
		}
	}
Ejemplo n.º 3
0
inline void HapList::RemoveAll(){ haplist.clear();}