Mesh::Mesh(Resources::IndicesPtr indexBuffer, Type type, GeometrySetPtr geom, MaterialPtr mat, unsigned int indexOffset, unsigned int drawRange) : indexBuffer(indexBuffer), type(type), mat(mat), geom(geom), indexOffset(indexOffset), drawRange(drawRange) { #ifdef OE_SAFE unsigned int size = indexBuffer->GetSize(); if (indexOffset > size) throw IndexOutOfBounds(indexOffset, 0, size); if (indexOffset + drawRange > size) throw IndexOutOfBounds(indexOffset + drawRange, 0, size); #endif }
int Map::GetTileAtPosition(uint x, uint y) { if(x >= width || y >= height) throw IndexOutOfBounds(); return map[x][y]; }
size_t Matrix<T,rank>::size(int dim) const { if(dim < 0 || dim >= rank) throw IndexOutOfBounds("Dimension out of bounds"); return this->_size[dim]; }
T& ArrayVector<T>::at(int i) throw (IndexOutOfBounds) { if (i < 0 || i >= size()) throw IndexOutOfBounds("Illegal index in function at()"); return A[i]; }
A& Array2d<A>::operator()(size_t ix, size_t iy) { //if(x < 0 || y < 0) throw "Index out of bounds"; if(ix >= this->_len[0] || iy >= this->_len[1]) throw IndexOutOfBounds("Index out of bounds"); return this->_data[this->_len[1] * iy + ix]; }
void Array2d<A>::set(size_t ix, size_t iy, const A &value) { //if(x < 0 || y < 0) throw "Index out of bounds"; if(ix >= this->_len[0] || iy >= this->_len[1]) throw IndexOutOfBounds("Index out of bounds"); this->_data[this->_len[1] * iy + ix] = value; }
void Array1d<A>::set(size_t index, const A &value) { // if(index < 0) throw "Index below range"; if(index >= this->_size) throw IndexOutOfBounds("Index out of range"); this->_data[index] = value; }
A Array1d<A>::get(size_t index) const { // if(index < 0) throw "Index below range"; if(index >= this->_size) throw IndexOutOfBounds("Index out of range"); return this->_data[index]; }
A& Array1d<A>::operator()(size_t index) { // if(index < 0) throw "Index below range"; if(index >= this->_size) throw IndexOutOfBounds("Index out of range"); return this->_data[index]; }
void set(Owner o, std::size_t row, std::size_t col) { if (row >= nRows || col >= nCols) { throw IndexOutOfBounds(); } array[row * nCols + col] = o; }