当前位置: 首页>>代码示例>>C++>>正文


C++ intVector::push_back方法代码示例

本文整理汇总了C++中intVector::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ intVector::push_back方法的具体用法?C++ intVector::push_back怎么用?C++ intVector::push_back使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在intVector的用法示例。


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

示例1:

/**********************************************************************************
* AUTHOR        : Naveen Sundar G.
* DATE          : 10-AUGUST-2007
* NAME          : toIntVector
* DESCRIPTION   : This method converts the feature instance to an intVector.
* ARGUMENTS     : The integer vector passed by reference
* RETURNS       : 0 on success.
* NOTES         :
* CHANGE HISTROY
* Author            Date                Description of change
*************************************************************************************/
int L7ShapeFeature::toIntVector(intVector& intVec)
{
	intVec.push_back(m_x);
	intVec.push_back(m_y);
	intVec.push_back(m_xFirstDerv);
	intVec.push_back(m_yFirstDerv);
	intVec.push_back(m_xSecondDerv);
	intVec.push_back(m_ySecondDerv);
	intVec.push_back(m_curvature);
	intVec.push_back(m_penUp);

	return SUCCESS;
}
开发者ID:amitdo,项目名称:Lipitk,代码行数:24,代码来源:L7ShapeFeature.cpp

示例2:

void
Dyna3DFile::GetMaterials(intVector &matnos, stringVector &matnames, doubleVector &matdens)
{
    for(int i = 0; i < materialCards.size(); ++i)
    {
        matnos.push_back(materialCards[i].materialNumber);
        matnames.push_back(materialCards[i].materialName);
        matdens.push_back(materialCards[i].density);
    }
}
开发者ID:EricAlex,项目名称:ThirdParty-dev,代码行数:10,代码来源:Dyna3DFile.cpp

示例3:

bool
DatabaseCorrelation::GetCorrelatedTimeStates(int state, intVector &states) const
{
    bool retval = false;

    if(state >= 0 && state < numStates)
    {
        states.clear();
        int index = state;
        for(size_t i = 0; i < databaseNames.size(); ++i)
        {
            states.push_back(indices[index]);
            index += numStates;
        }
        retval = true;
    }

    return retval;
}
开发者ID:HarinarayanKrishnan,项目名称:VisIt26RC_Trunk,代码行数:19,代码来源:DatabaseCorrelation.C

示例4: SM_ComputeDistribution

// compute the distribution of correspondence statuses in this order:
// connected, paused, observed, expected, blacklisted, alternate, silent
void SM_ComputeDistribution( intVector &dist )
{
    // reset the distribution
    dist.clear();
    for (int i=0; i<3; i++)
        dist.push_back( 0 );

    // populate the distribution
    for ( corresVector::iterator iter = cq.begin(); iter != cq.end(); iter++ ) {
        switch ( iter->status() ) {
        case _CONNECTED:
            dist[0]++;
            break;
        case _EXPECTED:
            dist[1]++;
            break;
        case _BLACKLISTED:
            dist[2]++;
            break;
        default:
            assert( false );
        }
    }
}
开发者ID:oakfr,项目名称:omni3d,代码行数:26,代码来源:state.cpp

示例5: if

void
avtFVCOMParticleFileFormat::GetCycles(intVector &cyc)
{
    const char *mName = "avtFVCOMParticleFileObject::GetCycles: ";

    debug4 << mName << endl;

    int ncid;
    ncid=fileObject->GetFileHandle(); 

    size_t ntimesteps;
    int time_id;
    int status = nc_inq_dimid(ncid, "time", &time_id);
    if (status != NC_NOERR) fileObject-> HandleError(status);


    status = nc_inq_dimlen(ncid, time_id, &ntimesteps);
    if (status != NC_NOERR) fileObject-> HandleError(status);


    char varname[NC_MAX_NAME+1];
    nc_type vartype;
    int  varndims;
    int  vardims[NC_MAX_VAR_DIMS];
    int  varnatts;
    int cycle_id;
    status = nc_inq_varid (ncid, "cycle", &cycle_id);
    if (status != NC_NOERR) 
      {
        fileObject-> HandleError(status);
        debug4 << "Could not find variable: cycle" << endl;
        return;
      }

    // Now get variable type!
    status = nc_inq_var(ncid, cycle_id, varname, &vartype, &varndims, 
            vardims, &varnatts);
    if (status != NC_NOERR) fileObject-> HandleError(status);

    if (varndims != 1 )
    {
        debug4 << mName << "Cycles has the wrong dimensions" << endl; 
    
    }

    else if (varndims == 1)
    {
        if(vartype == NC_INT)
        {
            debug4 << "IINT returned to cyc as NC_INT" << endl;
        int *ci = new int[ntimesteps+1];
            fileObject->ReadVariableInto("iint", INTEGERARRAY_TYPE, ci);
        for(int n=0; n<ntimesteps; ++n)
            {
                cyc.push_back(ci[n]);
            }
            delete [] ci;
        }
        else if(vartype == NC_FLOAT )
        { 
            debug4 << "iint is float: Returned to cyc as INT" << endl;

            float *cf = new float[ntimesteps+1];
            fileObject->ReadVariableInto("cycle", FLOATARRAY_TYPE, cf);
   
            for(int n=0; n<ntimesteps; ++n)
            {
                cyc.push_back(int(cf[n]));
            }

            delete [] cf;
        }
    }
    else    
    {
        debug4 << "Could not return cycles: Wrong variable type" << endl;
    }
}
开发者ID:EricAlex,项目名称:ThirdParty-dev,代码行数:78,代码来源:avtFVCOMParticleFileFormat.C


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