DLLEXPORT double MADX9_SurfaceUpdate(double dest, double src) { if (!isValidIndex((uint) dest, mamain->Surfaces) || !isValidIndex((uint) src, mamain->Surfaces)) return 0; return mamain->Surfaces[(uint) dest]->update(*mamain->Surfaces[(uint) src]); }
void XmlUniformiser::skipComment() { while ( isValidIndex() && !startsWith( "-->" ) ) skipNext(); if ( isValidIndex() ) skipNext( 3 ); }
void XmlUniformiser::skipProcessed() { while ( isValidIndex() && !startsWith( "?>" ) ) skipNext(); if ( isValidIndex() ) skipNext( 2 ); }
/* Returns the index for the first token after lexerTokenIndex that is not a whitespace or comment token. */ inline int Preprocessor::skipWhiteSpaceAndComments() const { int index = lexerTokenIndex; if(!isValidIndex(index)) return -1; while(m_tokenTypeList.at(index) == Token_whitespaces || m_tokenTypeList.at(index) == Token_comment || m_tokenTypeList.at(index) == Token_line_comment || m_tokenTypeList.at(index) == Token_multiline_comment ) { ++index; if(!isValidIndex(index)) return -1; } return index; }
//-------------------------------------------------------------- float ofxMuiNumberData::getRangeMax(int index) const{ if(isValidIndex(index)) { return ranges[index].getMax(); } else { return 0; } }
//-------------------------------------------------------------- float ofxMuiNumberData::getBoundsMax(int index) const { if(isValidIndex(index)) { return bounds[index].getMax(); } else { return 0; } }
//-------------------------------------------------------------- ofxMuiRange ofxMuiNumberData::getBounds(int index) const { if(isValidIndex(index)) { return bounds[index]; } else { return ofxMuiRange(); } }
//-------------------------------------------------------------- float ofxMuiNumberData::rangeDenormalize(float _value, int index) { if(isValidIndex(index)) { return ranges[index].denormalize(_value); } else { return 0; } }
uint8_t const* Zip::cacheLump(int lumpIdx) { LOG_AS("Zip::cacheLump"); if(!isValidIndex(lumpIdx)) throw NotFoundError("Zip::cacheLump", invalidIndexMessage(lumpIdx, lastIndex())); ZipFile& file = reinterpret_cast<ZipFile&>(lump(lumpIdx)); LOG_TRACE("\"%s:%s\" (%u bytes%s)") << de::NativePath(composePath()).pretty() << de::NativePath(file.composePath()).pretty() << (unsigned long) file.info().size << (file.info().isCompressed()? ", compressed" : ""); // Time to create the cache? if(!d->lumpCache) { d->lumpCache = new LumpCache(lumpCount()); } uint8_t const* data = d->lumpCache->data(lumpIdx); if(data) return data; uint8_t* region = (uint8_t*) Z_Malloc(file.info().size, PU_APPSTATIC, 0); if(!region) throw Error("Zip::cacheLump", QString("Failed on allocation of %1 bytes for cache copy of lump #%2").arg(file.info().size).arg(lumpIdx)); readLump(lumpIdx, region, false); d->lumpCache->insert(lumpIdx, region); return region; }
//-------------------------------------------------------------- ofxMuiRange ofxMuiNumberData::getRange(int index) const { if(isValidIndex(index)) { return ranges[index]; } else { return ofxMuiRange(-1,-1); } }
//-------------------------------------------------------------- float ofxMuiNumberData::getIncrementValue(int index) const { if(isValidIndex(index)) { return incrementValues[index]; } else { return 0; } }
void InputHandler::setMoveLeftKey(const unsigned int keyIndex) { if(isValidIndex(keyIndex, sf::Keyboard::KeyCount)) { this->moveLeftKey = static_cast<sf::Keyboard::Key>(keyIndex); } }
void HeightmapTimeAccumulation::accumulate( const sensor_msgs::Image::ConstPtr& msg) { boost::mutex::scoped_lock lock(mutex_); if (!config_) { JSK_NODELET_ERROR("no ~input/config is yet available"); return; } tf::StampedTransform tf_transform; tf_->lookupTransform(fixed_frame_id_, center_frame_id_, msg->header.stamp, tf_transform); Eigen::Affine3f from_center_to_fixed; tf::transformTFToEigen(tf_transform, from_center_to_fixed); cv::Mat new_heightmap = cv_bridge::toCvShare( msg, sensor_msgs::image_encodings::TYPE_32FC1)->image; // Transform prev_cloud_ to current frame Eigen::Affine3f from_prev_to_current = prev_from_center_to_fixed_.inverse() * from_center_to_fixed; pcl::PointCloud<pcl::PointXYZ> transformed_pointcloud; pcl::transformPointCloud(prev_cloud_, transformed_pointcloud, from_prev_to_current.inverse()); for (size_t i = 0; i < transformed_pointcloud.points.size(); i++) { pcl::PointXYZ p = transformed_pointcloud.points[i]; if (isValidPoint(p)) { cv::Point index = toIndex(p, new_heightmap); if (isValidIndex(index, new_heightmap)) { if (!isValidCell(index, new_heightmap)) { new_heightmap.at<float>(index.y, index.x) = p.z; } } } } publishHeightmap(new_heightmap, msg->header); prev_from_center_to_fixed_ = from_center_to_fixed; }
void XmlUniformiser::copyElementContent() { while ( isValidIndex() && !startsWith( "<" ) ) copyNext(); removeTrailingSpaces(); }
void InputHandler::setTrapButton(const unsigned int buttonIndex) { if(isValidIndex(buttonIndex, sf::Mouse::ButtonCount)) { this->trapButton = static_cast<sf::Mouse::Button>(buttonIndex); } }
DLLEXPORT double MADX9_SurfaceSetDepthBuffer(double ind) { if (!isValidIndex((uint) ind, mamain->Surfaces)) return 0; return mamain->Surfaces[(uint) ind]->setDepthBuffer(); }
DLLEXPORT double MADX9_SurfaceSetRenderTarget(double ind, double level) { if (!isValidIndex((uint) ind, mamain->Surfaces)) return 0; return mamain->Surfaces[(uint) ind]->setRenderTarget((uint) level); }
QVariant PlaylistModel::data(const QModelIndex &idx, int role) const { int row = idx.row(); if (!idx.isValid() || !isValidIndex(row) || !files[row]) { return QVariant(); } switch (role) { case Qt::DisplayRole: return files[row]->logicalFileName(); case Qt::ToolTipRole: return files[row]->physicalFilePath(); case Qt::BackgroundRole: if (isCurrentIndex(row)) { return QBrush(Qt::lightGray); } break; } return QVariant(); }
//-------------------------------------------------------------- float ofxMuiNumberData::getNormalizedRangeMax(int index) const { if(isValidIndex(index)) { return bounds[index].normalize(ranges[index].getMax()); } else { return 0; } }
int32_t Animation::getFrameDuration(int32_t index) const{ if (isValidIndex(index)) { return m_frames[index].duration; } else { return -1; } }
//-------------------------------------------------------------- bool ofxMuiNumberData::setRange(ofxMuiRange _range, int index) { if(isValidIndex(index)) { if(hasRange && _range == ranges[index]) return; //cout << "in range " << _range.getMin() << "/" << _range.getMax() << endl; hasRange = true; ranges[index] = _range; bool _boundsChanged = false; bool _rangeChanged = false; bool _valueChanged = false; checkRange(_boundsChanged, _rangeChanged, index); constrainValue(_valueChanged, index); // callbacks if(_valueChanged) dataChanged(index); rangeChanged(index); if(_boundsChanged) boundsChanged(index); // cout << "out range " << _range.getMin() << "/" << _range.getMax() << endl; return true; } else { return false; } }
bool Query::set(int index, Search::Operator op) { if (!isValidIndex(index)) return false; int subindex = m_operatorMap.indexOf(index); if (subindex >= 0) { // In this case the given index is already an operator, so we just replace it m_operator[subindex] = op; return true; } else { subindex = m_searchMap.indexOf(index); if (subindex >= 0) { // Here the given index is a search, so we have to remove the search, // and add a operator at that position. If autodelete is set, the memory // for the search will be deallocated. m_searchMap.removeAt(m_searchMap.at(subindex)); delete m_search.at(subindex); m_search.removeAt(subindex); m_operator.append(op); m_operatorMap.append(index); m_elementType[index] = OperatorElement; return true; } else { // The index could not be found in the search or operator lists. Strange!? return false; } } }
//-------------------------------------------------------------- float ofxMuiNumberData::getDisplayPrecision(int index) const { if(isValidIndex(index)) { return displayPrecision[index]; } else { return 0; } }
void XmlUniformiser::copyUntilDoubleQuote() { while ( isValidIndex() && !startsWith("\"") ) copyNext(); copyNext(); // '"' }
//-------------------------------------------------------------- float ofxMuiNumberData::normalize(float _value, int index) { if(isValidIndex(index)) { return bounds[index].normalize(_value); } else { return 0; } }
//-------------------------------------------------------------- int ofxMuiNumberData::getHistoryLength(int index) const { if(isValidIndex(index)) { return historyLength[index]; } else { return -1; } }
//-------------------------------------------------------------- // TO STRING /////////////////////////////////////////////////// //-------------------------------------------------------------- string ofxMuiNumberData::toString(int index) { if(isValidIndex(index)) { return ofToString(values[index].back(),displayPrecision[index]); } else { return "INVALID INDEX"; } }
File1& Zip::lump(int lumpIdx) { LOG_AS("Zip"); if(!isValidIndex(lumpIdx)) throw NotFoundError("Zip::lump", invalidIndexMessage(lumpIdx, lastIndex())); d->buildLumpNodeLut(); return *reinterpret_cast<ZipFile*>((*d->lumpNodeLut)[lumpIdx]->userPointer()); }
bool Query::set(int index, const Search& search) { if (!isValidIndex(index)) return false; int subindex = m_searchMap.indexOf(index); if (subindex >= 0) { delete m_search.at(subindex); m_search.replace(subindex, search.clone()); return true; } else { subindex = m_operatorMap.indexOf(index); if (subindex >= 0) { // Here the given index is a operator, so we have to remove the operator, // and add a search at that position m_operatorMap.removeAt(m_operatorMap.at(subindex)); m_operator.removeAt(m_operator.at(subindex)); m_search.append(search.clone()); m_searchMap.append(index); m_elementType[index] = SearchElement; return true; } else { // The index could not be found in the operator or search lists return false; } } }
//-------------------------------------------------------------- // HISTORY //////////////////////////////////////////////////// //-------------------------------------------------------------- bool ofxMuiNumberData::setHistoryLength(int length, int index) { if(isValidIndex(index)) { if(length >= 2) { historyLength[index] = length; if(values[index].size() > length) { // if there are too many, prune while(values[index].size() > historyLength[index]) { values[index].pop_front(); } } else { // if there aren't enough, copy float v = values[index].back(); while(values[index].size() < historyLength[index]) { values[index].push_back(v); } } return true; } else { ofLog(OF_LOG_ERROR, "ofxMuiNumberData:: Invalid history length value. HistoryLength value must be >= 2."); return false; } } else { ofLog(OF_LOG_ERROR, "ofxMuiNumberData:: Attempted to get an invalid value."); return 0; } }