本文整理汇总了C++中ParamList::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ ParamList::Add方法的具体用法?C++ ParamList::Add怎么用?C++ ParamList::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParamList
的用法示例。
在下文中一共展示了ParamList::Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
CoreModule::BroadcastParameterChanges()
{
ParamList changedParameters;
for( int i = 0; i < mParamlist.Size(); ++i )
if( mParamlist[ i ].Changed() )
changedParameters.Add( mParamlist[ i ] );
if( !changedParameters.Empty() )
{
mOperator.Send( changedParameters );
if( !mOperator.Send( SysCommand::EndOfParameter ) )
bcierr << "Could not publish changed parameters" << endl;
}
}
示例2: bciexception
mxArray*
StringsToStruct( const mxArray* inStrings )
{
ParamList params;
mwSize numStrings = mxGetNumberOfElements( inStrings );
for( mwSize i = 0; i < numStrings; ++i )
{
const mxArray* cell = mxGetCell( inStrings, i );
if( mxGetClassID( cell ) == mxCHAR_CLASS )
{
char* line = mxArrayToString( cell );
params.Add( Param( line ) );
mxFree( line );
}
else
throw bciexception( "Expected a cell array of strings as input." );
}
return ParamlistToStruct( params );
}
示例3: main
int main( int argc, char** argv )
{
const char* hostname = "localhost";
if( argc > 1 )
hostname = argv[ 1 ];
if( hostname[ 0 ] == '-' )
{
cout << usage << endl;
return noError;
}
RDA::Connection connection;
if( !connection.Open( hostname ) )
{
cerr << "Could not open connection to host \"" << hostname << "\".\n\n"
<< "Hint: " << usage << endl;
return generalError;
}
const RDA::Info& info = connection.Info();
ParamList paramlist;
const char* params[] =
{
"RDA string HostName= % ",
"RDA int SourceCh= 0 ",
"RDA stringlist ChannelNames= 0 ",
"RDA floatlist SourceChOffset= 0 ",
"RDA floatlist SourceChGain= 0 ",
"RDA float SamplingRate= 1 ",
"RDA int SampleBlockSize= 1 ",
"RDA intlist TransmitChList= 0 ",
"RDA matrix SpatialFilter= 0 1 ",
"RDA int SpatialFilterType= 0 ",
"RDA float SourceMax= 300muV ",
"RDA float SourceMin= -300muV ",
};
for( size_t i = 0; i < sizeof( params ) / sizeof( *params ); ++i )
paramlist.Add( ( string( params[ i ] ) + " // getparams " + hostname ).c_str() );
paramlist[ "HostName" ].Value() = hostname;
size_t numInputChannels = info.numChannels + 1;
paramlist[ "SourceCh" ].Value() = str( numInputChannels );
paramlist[ "ChannelNames" ].SetNumValues( numInputChannels );
paramlist[ "SourceChOffset" ].SetNumValues( numInputChannels );
paramlist[ "SourceChGain" ].SetNumValues( numInputChannels );
paramlist[ "TransmitChList" ].SetNumValues( numInputChannels - 1 );
paramlist[ "SpatialFilter" ].SetDimensions( numInputChannels - 1, numInputChannels - 1 );
for( size_t i = 0; i < numInputChannels - 1; ++i )
{
paramlist[ "ChannelNames" ].Value( i ) = info.channelNames[i];
paramlist[ "SourceChOffset" ].Value( i ) = "0";
paramlist[ "SourceChGain" ].Value( i ) = str( info.channelResolutions[ i ] );
paramlist[ "TransmitChList" ].Value( i ) = str( i + 1 );
paramlist[ "SpatialFilter" ].Value( i, i ) = "1";
}
paramlist[ "ChannelNames" ].Value( numInputChannels - 1 ) = "T";
paramlist[ "SourceChOffset" ].Value( numInputChannels - 1 ) = "0";
paramlist[ "SourceChGain" ].Value( numInputChannels - 1 ) = "1";
paramlist[ "SamplingRate" ].Value() = str( 1e6 / info.samplingInterval );
paramlist[ "SampleBlockSize" ].Value() = str( info.blockDuration / info.samplingInterval );
cout << paramlist;
return noError;
}