您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ valueAt函数代码示例

51自学网 2021-06-03 09:33:05
  C++
这篇教程C++ valueAt函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中valueAt函数的典型用法代码示例。如果您正苦于以下问题:C++ valueAt函数的具体用法?C++ valueAt怎么用?C++ valueAt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了valueAt函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: findPivotColumn

/*!  /internal  Does one iteration towards a better solution for the problem.  See 'solveMaxHelper'.*/bool QSimplex::iterate(){    // Find Pivot column    int pivotColumn = findPivotColumn();    if (pivotColumn == -1)        return false;    // Find Pivot row for column    int pivotRow = pivotRowForColumn(pivotColumn);    if (pivotRow == -1) {        qWarning() << "QSimplex: Unbounded problem!";        return false;    }    // Normalize Pivot Row    qreal pivot = valueAt(pivotRow, pivotColumn);    if (pivot != 1.0)        combineRows(pivotRow, pivotRow, (qreal(1.0) - pivot) / pivot);    // Update other rows    for (int row=0; row < rows; ++row) {        if (row == pivotRow)            continue;        combineRows(row, pivotRow, -1 * valueAt(row, pivotColumn));    }    // Update first column    setValueAt(pivotRow, 0, pivotColumn);    //    dumpMatrix();    //    qDebug("------------ end of iteration --------------/n");    return true;}
开发者ID:TriggeredMessaging,项目名称:phantomjs,代码行数:40,


示例2: valueAt

float HotPlate::valueAt(Point p, int offset_x, int offset_y) {    Point np = p;    np.x += offset_x;    np.y += offset_y;    // cover the edges.    if(np.x<0 || np.y<0 || np.x >= width || np.y >= height) {        if(p.x != np.x && p.y != np.y) {            // If we are diagonal, let's try to get the point on the same            // axis.            if(np.y < 0) {                return valueAt(p,offset_x,offset_y+1);            } else if(np.y >= height) {                return valueAt(p,offset_x,offset_y-1);            } else if(np.x < 0) {                return valueAt(p,offset_x+1,offset_y);            } else if(np.x >= width) {                return valueAt(p,offset_x-1,offset_y);            }        }        // Arbitrary factor of 1.5 on edges        if(swap) return temp2[p]/1.5;        else return temp1[p]/1.5;    }    // cover the hot positions    if(isLocked(np)) return 1;    // Use the value listed in the screen pixel    if(swap) return temp2[np];    else return temp1[np];}
开发者ID:LeviSchuck,项目名称:glowy-triangle,代码行数:29,


示例3: address

status_t AudioPolicyMixCollection::getInputMixForAttr(audio_attributes_t attr, AudioMix **policyMix){    if (strncmp(attr.tags, "addr=", strlen("addr=")) != 0) {        return BAD_VALUE;    }    String8 address(attr.tags + strlen("addr="));#ifdef LOG_NDEBUG    ALOGV("getInputMixForAttr looking for address %s/n  mixes available:", address.string());    for (size_t i = 0; i < size(); i++) {            sp<AudioPolicyMix> policyMix = valueAt(i);            AudioMix *mix = policyMix->getMix();            ALOGV("/tmix %zu address=%s", i, mix->mDeviceAddress.string());    }#endif    ssize_t index = indexOfKey(address);    if (index < 0) {        ALOGW("getInputMixForAttr() no policy for address %s", address.string());        return BAD_VALUE;    }    sp<AudioPolicyMix> audioPolicyMix = valueAt(index);    AudioMix *mix = audioPolicyMix->getMix();    if (mix->mMixType != MIX_TYPE_PLAYERS) {        ALOGW("getInputMixForAttr() bad policy mix type for address %s", address.string());        return BAD_VALUE;    }    *policyMix = mix;    return NO_ERROR;}
开发者ID:android-source,项目名称:platform_frameworks_av,代码行数:31,


示例4: p

bool HotPlate::stepHP() {    float newValue;    float n,s,e,w,here;    bool changes = false;    float epsilon = 1.0/512.0;    for(int x = 0; x < width; x++) {        for(int y = 0; y < height; y++) {            Point p(x,y);            here = valueAt(p,0,0);            n = valueAt(p, 0,-1);            s = valueAt(p, 0, 1);            e = valueAt(p,-1, 0);            w = valueAt(p, 1, 0);            newValue = (here+n+s+e+w)/5;            if(isLocked(p)) newValue = here;            if(fabs(newValue - here) > epsilon) changes = true;            if(swap) temp2[p] = newValue;            else temp1[p] = newValue;        }    }    swap = !swap;    return changes;}
开发者ID:LeviSchuck,项目名称:glowy-triangle,代码行数:26,


示例5: valueAt

void AutomationPattern::processMidiTime( const MidiTime & time ){	if( ! isRecording() )	{		if( time >= 0 && hasAutomation() )		{			const float val = valueAt( time );			for( objectVector::iterator it = m_objects.begin();							it != m_objects.end(); ++it )			{				if( *it )				{					( *it )->setAutomatedValue( val );				}			}			}	}	else	{		if( time >= 0 && ! m_objects.isEmpty() )		{			const float value = static_cast<float>( firstObject()->value<float>() );			if( value != m_lastRecordedValue ) 			{				putValue( time, value, true );				m_lastRecordedValue = value;			}			else if( valueAt( time ) != value )			{				removeValue( time, false );			}		}	}}
开发者ID:Cubiicle,项目名称:lmms,代码行数:35,


示例6: valueAt

void AutomationPattern::flipY( int min, int max ){	timeMap tempMap = m_timeMap;	timeMap::ConstIterator iterate = m_timeMap.lowerBound(0);	float tempValue = 0;	int numPoints = 0;	for( int i = 0; ( iterate + i + 1 ) != m_timeMap.end() && ( iterate + i ) != m_timeMap.end() ; i++)	{		numPoints++;	}	for( int i = 0; i <= numPoints; i++ )	{		if ( min < 0 )		{			tempValue = valueAt( ( iterate + i ).key() ) * -1;			putValue( MidiTime( (iterate + i).key() ) , tempValue, false);		}		else		{			tempValue = max - valueAt( ( iterate + i ).key() );			putValue( MidiTime( (iterate + i).key() ) , tempValue, false);		}	}	generateTangents();	emit dataChanged();}
开发者ID:Lukas-W,项目名称:lmms,代码行数:31,


示例7: valueAt

/*!  /internal*/void QSimplex::reducedRowEchelon(){    for (int i = 1; i < rows; ++i) {        int factorInObjectiveRow = valueAt(i, 0);        combineRows(0, i, -1 * valueAt(0, factorInObjectiveRow));    }}
开发者ID:TriggeredMessaging,项目名称:phantomjs,代码行数:10,


示例8: project

int SymbolInfoJob::execute(){    int ret = 1;    int idx = -1;    if (end.isNull()) {        auto symbol = project()->findSymbol(start, &idx);        if (!symbol.isNull()) {            write(symbol);            ret = 0;        }    } else {        assert(start.fileId() == end.fileId());        auto symbols = project()->openSymbols(start.fileId());        if (symbols && symbols->count()) {            bool exact = false;            uint32_t idx = symbols->lowerBound(start, &exact);            if (exact) {                write("(list");                write(symbols->valueAt(idx++));                ret = 0;            } else {                switch (idx) {                case 0:                    break;                case std::numeric_limits<uint32_t>::max():                    idx = symbols->count() - 1;                    break;                default:                    --idx;                    break;                }            }            const uint32_t count = symbols->count();            while (idx < count) {                const Location loc = symbols->keyAt(idx);                if (loc > end)                    break;                if (loc >= start) {                    if (ret)                        write("(list");                    write(symbols->valueAt(idx));                    ret = 0;                }                ++idx;            }            if (!ret)                write(")");        }    }    return ret;}
开发者ID:gordonmcshane,项目名称:rtags,代码行数:51,


示例9: odeFunc

void odeFunc( double time, double * u, double * du, void * udata ){	int i,j;	TCpropensity(time, u, rates, udata);	for (i=0; i < TCvars; ++i)	{		du[i] = 0;		for (j=0; j < TCreactions; ++j)		{			if (valueAt(TCstoic,TCreactions,i,j) != 0)			du[i] += rates[j]*valueAt(TCstoic,TCreactions,i,j);		}	}}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:14,


示例10: projectedBBox

double Mesh::valueAt(const Output* output, double xCoord, double yCoord) const{  if (!output)    return -9999.0; // We want to find the value at the given coordinate // Loop through all the elements in the dataset and make a list of those  std::vector<uint> candidateElementIds;  for (int i = 0; i < mElems.count(); i++)  {    const BBox& bbox = projectedBBox(i);    if (bbox.isPointInside(xCoord, yCoord))      candidateElementIds.push_back(i);  }  if( candidateElementIds.size() == 0 )      return -9999.0;  double value;  for (uint i=0; i < candidateElementIds.size(); i++)  {    uint elemIndex = candidateElementIds.at(i);    if (!output->isActive(elemIndex))      continue;    if (valueAt(elemIndex, xCoord, yCoord, &value, output))      // We successfully got a value, return it and leave      return value;  }  return -9999.0;}
开发者ID:aaschwanden,项目名称:qgis-crayfish-plugin,代码行数:34,


示例11: return

float AutomationPattern::valueAt( const MidiTime & _time ) const{	if( m_timeMap.isEmpty() )	{		return 0;	}	if( m_timeMap.contains( _time ) )	{		return m_timeMap[_time];	}	// lowerBound returns next value with greater key, therefore we take	// the previous element to get the current value	timeMap::ConstIterator v = m_timeMap.lowerBound( _time );	if( v == m_timeMap.begin() )	{		return 0;	}	if( v == m_timeMap.end() )	{		return (v-1).value();	}	return valueAt( v-1, _time - (v-1).key() );}
开发者ID:Lukas-W,项目名称:lmms,代码行数:27,


示例12: valueAt

audio_devices_t AudioPolicyMixCollection::getDeviceAndMixForInputSource(audio_source_t inputSource,                                                                        audio_devices_t availDevices,                                                                        AudioMix **policyMix){    for (size_t i = 0; i < size(); i++) {        AudioMix *mix = valueAt(i)->getMix();        if (mix->mMixType != MIX_TYPE_RECORDERS) {            continue;        }        for (size_t j = 0; j < mix->mCriteria.size(); j++) {            if ((RULE_MATCH_ATTRIBUTE_CAPTURE_PRESET == mix->mCriteria[j].mRule &&                    mix->mCriteria[j].mValue.mSource == inputSource) ||               (RULE_EXCLUDE_ATTRIBUTE_CAPTURE_PRESET == mix->mCriteria[j].mRule &&                    mix->mCriteria[j].mValue.mSource != inputSource)) {                if (availDevices & AUDIO_DEVICE_IN_REMOTE_SUBMIX) {                    if (policyMix != NULL) {                        *policyMix = mix;                    }                    return AUDIO_DEVICE_IN_REMOTE_SUBMIX;                }                break;            }        }    }    return AUDIO_DEVICE_NONE;}
开发者ID:android-source,项目名称:platform_frameworks_av,代码行数:27,


示例13: key_type

const MemoryTablePrivate::value_type MemoryTablePrivate::valueAtIndex(size_t index, const TableMetadata *table){    if (index >= table->count)        return key_type();    return valueAt(table->index[index].offset, table);}
开发者ID:amtep,项目名称:qtcontacts-sqlite,代码行数:7,


示例14: add_stack

int add_stack(int depth) {  int i, j;  int old = swapSize;  for(j = 0;j < MATRIX_SIZE;++j)	  for(i = 0;i < MATRIX_SIZE;++i)		  arr[i][j] = valueAt(i, j);  swapSize = getSwapSize();  assertTrue(swapSize >= old);  if (depth > 1)    if(add_stack(depth - 1) == -1)		fail();  for(j = 0;j < MATRIX_SIZE;++j)	  for(i = 0;i < MATRIX_SIZE;++i)		  if(!arr[i][j] == valueAt(i, j)) {			  printf("incorrect value!/n");			  fail();		  }}
开发者ID:cheezer,项目名称:nachos2014,代码行数:18,


示例15: end

const MemoryTablePrivate::value_type MemoryTablePrivate::value(const key_type &key, const TableMetadata *table){    const IndexElement *tableEnd = end(table);    const IndexElement *position = std::lower_bound(begin(table), tableEnd, key);    if (position == tableEnd || position->key != key)        return value_type();    return valueAt(position->offset, table);}
开发者ID:amtep,项目名称:qtcontacts-sqlite,代码行数:9,


示例16: addBinary

    string addBinary(string a, string b) {        int m = a.size(), n = b.size();        if (m == 0) { return b; }        if (n == 0) { return a; }                int carry = 0;        string c = "";        for (int i = 0; i < max(m, n); ++i) {            int cur = valueAt(a, m-i-1) + valueAt(b, n-i-1) + carry;            carry = cur / 2;            if (cur % 2 == 0) { c.append("0"); }            else { c.append("1"); }        }        if (carry) { c.append("1"); }        return string(c.rbegin(), c.rend());    }
开发者ID:ChunHungLiu,项目名称:LeetCode-8,代码行数:18,


示例17: locationToStringFlags

bool QueryJob::locationToString(Location location,                                const std::function<void(LocationPiece, const String &)> &cb,                                Flags<WriteFlag> writeFlags){    if (location.isNull())        return false;    Flags<Location::ToStringFlag> kf = locationToStringFlags();    kf &= ~Location::ShowContext;    cb(Piece_Location, location.toString(kf, &mContextCache));    if (!(writeFlags & NoContext) && !(queryFlags() & QueryMessage::NoContext))        cb(Piece_Context, location.context(kf, &mContextCache));    const bool containingFunction = queryFlags() & QueryMessage::ContainingFunction;    const bool containingFunctionLocation = queryFlags() & QueryMessage::ContainingFunctionLocation;    const bool cursorKind = queryFlags() & QueryMessage::CursorKind;    const bool displayName = queryFlags() & QueryMessage::DisplayName;    if (containingFunction || containingFunctionLocation || cursorKind || displayName || !mKindFilters.isEmpty()) {        int idx;        Symbol symbol = project()->findSymbol(location, &idx);        if (symbol.isNull()) {            error() << "Somehow can't find" << location << "in symbols";        } else {            if (!mKindFilters.filter(symbol))                return false;            if (displayName)                cb(Piece_SymbolName, symbol.displayName());            if (cursorKind)                cb(Piece_Kind, symbol.kindSpelling());            if (containingFunction || containingFunctionLocation) {                const uint32_t fileId = location.fileId();                const unsigned int line = location.line();                const unsigned int column = location.column();                auto fileMap = project()->openSymbols(location.fileId());                if (fileMap) {                    while (idx > 0) {                        symbol = fileMap->valueAt(--idx);                        if (symbol.location.fileId() != fileId)                            break;                        if (symbol.isDefinition()                            && RTags::isContainer(symbol.kind)                            && comparePosition(line, column, symbol.startLine, symbol.startColumn) >= 0                            && comparePosition(line, column, symbol.endLine, symbol.endColumn) <= 0) {                            if (containingFunction)                                cb(Piece_ContainingFunctionName, symbol.symbolName);                            if (containingFunctionLocation)                                cb(Piece_ContainingFunctionLocation, symbol.location.toString(locationToStringFlags() & ~Location::ShowContext));                            break;                        }                    }                }            }        }    }    return true;}
开发者ID:bbannier,项目名称:rtags,代码行数:55,


示例18: indexOfKey

status_t AudioPolicyMixCollection::getAudioPolicyMix(const String8& address,                                                     sp<AudioPolicyMix> &policyMix) const{    ssize_t index = indexOfKey(address);    if (index < 0) {        ALOGE("unregisterPolicyMixes(): mix for address %s not registered", address.string());        return BAD_VALUE;    }    policyMix = valueAt(index);    return NO_ERROR;}
开发者ID:android-source,项目名称:platform_frameworks_av,代码行数:11,


示例19: putValue

void AutomationPattern::recordValue(MidiTime time, float value){	if( value != m_lastRecordedValue )	{		putValue( time, value, true );		m_lastRecordedValue = value;	}	else if( valueAt( time ) != value )	{		removeValue( time );	}}
开发者ID:Lukas-W,项目名称:lmms,代码行数:12,


示例20: index

/*!  /internal  For a given pivot column, find the pivot row. That is, the row with the  minimum associated "quotient" where:  - quotient is the division of the value in the last column by the value    in the pivot column.  - rows with value less or equal to zero are ignored  - if two rows have the same quotient, lines are chosen based on the    highest variable index (value in the first column)  The last condition avoids a bug where artificial variables would be  left behind for the second-phase simplex, and with 'good'  constraints would be removed before it, what would lead to incorrect  results.*/int QSimplex::pivotRowForColumn(int column){    qreal min = qreal(999999999999.0); // ###    int minIndex = -1;    for (int i = 1; i < rows; ++i) {        qreal divisor = valueAt(i, column);        if (divisor <= 0)            continue;        qreal quotient = valueAt(i, columns - 1) / divisor;        if (quotient < min) {            min = quotient;            minIndex = i;        } else if ((quotient == min) && (valueAt(i, 0) > valueAt(minIndex, 0))) {            minIndex = i;        }    }    return minIndex;}
开发者ID:TriggeredMessaging,项目名称:phantomjs,代码行数:38,


示例21: insert

MemoryTablePrivate::Error MemoryTablePrivate::migrateTo(TableMetadata *other, const TableMetadata *table){    // Copy all live elements to the other table    const IndexElement *tableEnd(end(table));    for (const IndexElement *it = begin(table); it != tableEnd; ++it) {        MemoryTable::Error error = insert((*it).key, valueAt((*it).offset, table), other);        if (error != MemoryTable::NoError)            return error;    }    return MemoryTable::NoError;}
开发者ID:amtep,项目名称:qtcontacts-sqlite,代码行数:12,


示例22: QL_REQUIRE

    Real FdmHestonSolver::thetaAt(Real s, Real v) const {        QL_REQUIRE(condition_->stoppingTimes().front() > 0.0,                   "stopping time at zero-> can't calculate theta");        calculate();        Matrix thetaValues(resultValues_.rows(), resultValues_.columns());        const Array& rhs = thetaCondition_->getValues();        std::copy(rhs.begin(), rhs.end(), thetaValues.begin());        return (BicubicSpline(x_.begin(), x_.end(), v_.begin(), v_.end(),                              thetaValues)(std::log(s), v) - valueAt(s, v))              / thetaCondition_->getTime();    }
开发者ID:derekcameron,项目名称:quantlibcl,代码行数:14,


示例23: testInlineAutomation

	void testInlineAutomation()	{		auto song = Engine::getSong();		InstrumentTrack* instrumentTrack =				dynamic_cast<InstrumentTrack*>(Track::create(Track::InstrumentTrack, song));		Pattern* notePattern = dynamic_cast<Pattern*>(instrumentTrack->createTCO(0));		notePattern->changeLength(MidiTime(4, 0));		Note* note = notePattern->addNote(Note(MidiTime(4, 0)), false);		note->createDetuning();		DetuningHelper* dh = note->detuning();		auto pattern = dh->automationPattern();		pattern->setProgressionType( AutomationPattern::LinearProgression );		pattern->putValue(MidiTime(0, 0), 0.0);		pattern->putValue(MidiTime(4, 0), 1.0);		QCOMPARE(pattern->valueAt(MidiTime(0, 0)), 0.0f);		QCOMPARE(pattern->valueAt(MidiTime(1, 0)), 0.25f);		QCOMPARE(pattern->valueAt(MidiTime(2, 0)), 0.5f);		QCOMPARE(pattern->valueAt(MidiTime(4, 0)), 1.0f);	}
开发者ID:JohannesLorenz,项目名称:lmms,代码行数:23,


示例24: pathFilters

Set<String> ListSymbolsJob::imenu(const std::shared_ptr<Project> &project){    Set<String> out;    const List<String> paths = pathFilters();    if (paths.isEmpty()) {        error() << "--imenu must take path filters";        return out;    }    for (int i=0; i<paths.size(); ++i) {        const Path file = paths.at(i);        if (!file.isFile()) {            error() << "Invalid path filter for --imenu" << file;            continue;        }        const uint32_t fileId = Location::fileId(file);        if (!fileId)            continue;        auto symbols = project->openSymbols(fileId);        if (!symbols)            continue;        const int count = symbols->count();        for (int j=0; j<count; ++j) {            const Symbol &symbol = symbols->valueAt(j);            if (RTags::isReference(symbol.kind))                continue;            switch (symbol.kind) {            case CXCursor_VarDecl:            case CXCursor_ParmDecl:            case CXCursor_InclusionDirective:            case CXCursor_EnumConstantDecl:                break;            case CXCursor_ClassDecl:            case CXCursor_StructDecl:            case CXCursor_ClassTemplate:                if (!symbol.isDefinition())                    break;                // fall through            default: {                const String &symbolName = symbol.symbolName;                if (!string.isEmpty() && !symbolName.contains(string))                    continue;                out.insert(symbolName);                break; }            }        }    }    return out;}
开发者ID:HackerFoo,项目名称:rtags,代码行数:49,



注:本文中的valueAt函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ valueChanged函数代码示例
C++ valueAllocator函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。