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


C++ ParamList::Size方法代码示例

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


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

示例1: file

// **************************************************************************
// Function:   LoadParameterList
// Purpose:    Loads the current list of parameters from a parameter file
//             It does NOT load system critical dynamic parameters (e.g., ports,
//             IP addresses)
// Parameters: char *filename - filename of the parameterlist
//             nonexisting - if true, load parameters, even if they currently do
//                       not exist in the list
// Returns:    true - successful
//             false - error
// **************************************************************************
bool
ParamList::Load( const string& inFileName, bool inImportNonexisting )
{
  ifstream file( inFileName.c_str() );
  ParamList paramsFromFile;
  file >> paramsFromFile;
  if( file.fail() )
    return false;

  // If desired, exclude parameters missing from the main parameter list.
  typedef set<string> NameSet;
  NameSet unwantedParams;
  if( !inImportNonexisting )
    for( int i = 0; i < paramsFromFile.Size(); ++i )
      if( !Exists( paramsFromFile[i].Name() ) )
        unwantedParams.insert( paramsFromFile[i].Name() );

  for( NameSet::const_iterator i = unwantedParams.begin(); i != unwantedParams.end(); ++i )
    paramsFromFile.Delete( *i );

  for( int i = 0; i < paramsFromFile.Size(); ++i )
  {
    Param &p = paramsFromFile[i], &q = ByName( p.Name() );
    if( !q.Readonly() )
      q.AssignValues( p, true );
  }
  return true;
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:39,代码来源:ParamList.cpp

示例2: input

int
OperatorUtils::LoadMatrix( const QString& inFileName, Param& outParam )
{
  if( inFileName.isEmpty() )
    return MatNotFound;

  if( QFileInfo( inFileName ).suffix() == MATRIX_EXTENSION )
  {
    ParamList paramsFromFile;
    paramsFromFile.Load( inFileName.toLocal8Bit().constData(), true );
    if( paramsFromFile.Size() == 0 )
      return MatNotFound;
    if( paramsFromFile.Size() > 1 )
      return MatMultipleParams;
    Param p = paramsFromFile[0];
    outParam.SetDimensions( p.NumRows(), p.NumColumns() );
    for( int row = 0; row < p.NumRows(); ++row )
      for( int col = 0; col < p.NumColumns(); ++col )
        outParam.Value( row, col ) = p.Value( row, col );
    outParam.RowLabels() = p.RowLabels();
    outParam.ColumnLabels() = p.ColumnLabels();
  }
  else
  {
    ifstream input( inFileName.toLocal8Bit() );
    input.clear();
    vector<vector<string> > matrix;
    string line;
    while( getline( input, line ) )
    {
      istringstream is( line );
      vector<string> row;
      string value;
      while( getline( is, value, '\t' ) )
        row.push_back( value );
      if( !row.empty() )
        matrix.push_back( row );
    }
    if( matrix.empty() )
      return MatNotFound;

    size_t numRows = matrix.size(),
    numCols = matrix[ 0 ].size();
    for( size_t row = 1; row < numRows; ++row )
      if( matrix[ row ].size() != numCols )
        return MatLoadColsDiff;

    outParam.SetDimensions( numRows, numCols );
    for( size_t row = 0; row < numRows; ++row )
      for( size_t col = 0; col < numCols; ++col )
      {
        istringstream iss( matrix[ row ][ col ] );
        iss >> outParam.Value( row, col );
      }
  }
  return NoError;
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:57,代码来源:OperatorUtils.cpp

示例3: StructToParamlist

mxArray*
StructToStrings( const mxArray* inStruct )
{
    ParamList params;
    StructToParamlist( inStruct, params );
    size_t numParams = params.Size();
    mxArray* strings = mxCreateCellMatrix( numParams, 1 );
    for( size_t i = 0; i < numParams; ++i )
    {
        ostringstream oss;
        oss << params[ i ];
        mxSetCell( strings, i, mxCreateString( oss.str().c_str() ) );
    }
    return strings;
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:15,代码来源:convert_bciprm.cpp

示例4: Output

void
CoreModule::AutoConfigFilters()
{
  for( int i = 0; i < mParamlist.Size(); ++i )
    mParamlist[i].Unchanged();

  ParamList restoreParams;
  if( !mAutoConfig )
  {
    restoreParams = mParamlist;
    if( restoreParams.Exists( "SubjectRun" ) )
      restoreParams.Delete( "SubjectRun" ); // special case for backward compatibility reasons
  }

  EnvironmentBase::EnterPreflightPhase( &mParamlist, &mStatelist, &mStatevector );
  SignalProperties Output( 0, 0 );
  GenericFilter::PreflightFilters( mInputSignal.Properties(), Output );
  EnvironmentBase::EnterNonaccessPhase();
  mOutputSignal = GenericSignal( Output );

  ModuleConnection& conn = IsLastModule() ? mOperator : mNextModule;
  if( conn.IsLocal() && conn.Protocol().Provides( ProtocolVersion::SharedSignalStorage ) )
    mOutputSignal.ShareAcrossModules();

  for( int i = 0; i < restoreParams.Size(); ++i )
  {
    const Param& r = restoreParams[i];
    Param& p = mParamlist[r.Name()];
    if( p.Changed() )
    {
      p = r;
      p.Unchanged();
    }
  }
  if( mParamlist.Exists( "DebugLevel" ) && ::atoi( mParamlist["DebugLevel"].Value().c_str() ) )
  {
    for( int i = 0; i < mParamlist.Size(); ++i )
      if( mParamlist[i].Changed() )
        bciout << "AutoConfig: " << mParamlist[i];
  }
  if( mAutoConfig && bcierr__.Empty() )
  {
    BroadcastParameterChanges();
    if( !mOperator.Send( Output ) )
      bcierr << "Could not send output properties to Operator module" << endl;
  }
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:47,代码来源:CoreModule.cpp


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