Example #1
0
bitset& bitset::operator-=(const bitset& b)
{
    if (b.size() != this->size()) throw InvalidSizeException();

    for (unsigned int i = 0; i < b.size(); i++)
        bits[i] -= b[i];
    return *this;
}
Example #2
0
void Array<T>::setSize(int newSize){
	if (newSize < 0){
		throw InvalidSizeException();
	}
	T* temp_ptr_to_data = new T[size];
	int oldSize = size;
	size = newSize;
	int sizeLimit = (oldSize < newSize ? oldSize : newSize);
	temp_ptr_to_data = new T[size];
	for (int i=0; i< sizeLimit; ++i){
		temp_ptr_to_data[i] = ptr_to_data[i];
	}
	delete[] ptr_to_data;
	ptr_to_data = temp_ptr_to_data;
}
Example #3
0
Packet2Blob::Packet2Blob(char const* blob, uint16_t length)
	: Packet(mId), blob(NULL), blobLength(length)
{
	if (length > Packet::MAX_LOAD_SIZE)
	{
		throw InvalidSizeException("Blob to big", Packet::ptr());
	}

	dataLength = blobLength + Packet::MIN_SIZE;
	packedData = new char[dataLength];
	
	this->blob = packedData + OFFSET_DATA;

	packHeader();
	util::pack(blob, dataLength, this->blob);

	packed = true;
	unpacked = true;
}