本文整理汇总了C++中LabelList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ LabelList::push_back方法的具体用法?C++ LabelList::push_back怎么用?C++ LabelList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LabelList
的用法示例。
在下文中一共展示了LabelList::push_back方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: labelParam
void
BCI2000Viewer::UpdateChannelLabels()
{
if( mFile.IsOpen() )
{
vector<string> signalLabels;
if( mFile.Parameters()->Exists( "ChannelNames" ) )
{
ParamRef labelParam = mFile.Parameter( "ChannelNames" );
for( int k = 0; k < labelParam->NumValues(); ++k )
signalLabels.push_back( labelParam( k ) );
}
for( int i = static_cast<int>( signalLabels.size() ); i < mFile.SignalProperties().Channels(); ++i )
{
ostringstream oss;
oss << i + 1;
signalLabels.push_back( oss.str() );
}
LabelList channelLabels;
int numMarkerChannels = 0;
int j = 1;
while( j < ui->channelList->count()
&& ( ui->channelList->item( j )->flags() & Qt::ItemIsUserCheckable ) )
++j;
int chBase = ++j;
for( ; j < ui->channelList->count()
&& ( ui->channelList->item( j )->flags() & Qt::ItemIsUserCheckable ); ++j )
if( ui->channelList->item( j )->checkState() == Qt::Checked )
channelLabels.push_back(
Label(
static_cast<int>( channelLabels.size() ),
signalLabels[ j - chBase ]
)
);
for( int i = 1; i < ui->channelList->count()
&& ( ui->channelList->item( i )->flags() & Qt::ItemIsUserCheckable ); ++i )
if( ui->channelList->item( i )->checkState() == Qt::Checked )
{
channelLabels.push_back(
Label(
static_cast<int>( channelLabels.size() ),
ui->channelList->item( i )->text().toLocal8Bit().constData()
)
);
++numMarkerChannels;
}
mNumSignalChannels = static_cast<int>( channelLabels.size() ) - numMarkerChannels;
ui->signalDisplay->Display().SetNumMarkerChannels( numMarkerChannels )
.SetChannelLabels( channelLabels )
.SetChannelLabelsVisible( true );
}
else
{
mNumSignalChannels = 0;
ui->signalDisplay->Display().SetNumMarkerChannels( 0 )
.SetChannelLabels( LabelList() );
}
}
示例2: GetCharSetNames
/**
* @method GetCharSetNames [void:public]
* @param names [LabelList&] the vector in which to store the names
*
* Erases names, then fills names with the names of all stored
* character sets.
*/
void AssumptionsBlock::GetCharSetNames( LabelList& names )
{
names.erase( names.begin(), names.end() );
IntSetMap::const_iterator i;
for( i = charsets.begin(); i != charsets.end(); i++ )
names.push_back( (*i).first );
}
示例3: sizeof
std::auto_ptr<OfflineJob> qmimap4::SetLabelOfflineJob::create(InputStream* pStream)
{
wstring_ptr wstrFolder;
READ_STRING(WSTRING, wstrFolder);
if (!wstrFolder.get())
return std::auto_ptr<OfflineJob>(0);
unsigned int nSize = 0;
READ(&nSize, sizeof(nSize));
if (nSize == 0)
return std::auto_ptr<OfflineJob>(0);
UidList listUid;
listUid.resize(nSize);
READ(&listUid[0], nSize*sizeof(UidList::value_type));
wstring_ptr wstrLabel;
READ_STRING(WSTRING, wstrLabel);
unsigned int nLabelSize = 0;
READ(&nLabelSize, sizeof(nLabelSize));
LabelList listLabel;
listLabel.reserve(nLabelSize);
CONTAINER_DELETER(free, listLabel, &freeWString);
for (unsigned int n = 0; n < nLabelSize; ++n) {
wstring_ptr wstrLabel;
READ_STRING(WSTRING, wstrLabel);
listLabel.push_back(wstrLabel.release());
}
return std::auto_ptr<OfflineJob>(new SetLabelOfflineJob(wstrFolder.get(), listUid,
wstrLabel.get(), const_cast<const WCHAR**>(&listLabel[0]), listLabel.size()));
}
示例4:
void
X86CodeGen::munchJUMP(Label *lab)
{
LabelList targets;
targets.push_back(lab);
assem::OPER *op = _aOPER("jmp", "'j0", NULL, NULL);
op->setJumpTargets(targets);
emit(op);
}
示例5: format
void
X86CodeGen::munchCJUMP(tree::CJUMP *cj)
{
tree::CONST *konst;
std::string assem;
TempList tsrc;
const char *cond[] = {"e", "ne",
"l", "g",
"le", "ge"
};
//reverse condition for less or greater
const char *cond_r[] = {"e", "ne",
"ge", "le",
"g", "l"
};
bool reverse = false;
if (_M0(CONST_T, konst) == cj->l) {
assem = format("$%d, 's0", konst->value);
tsrc.push_back(munchExp(cj->r));
reverse = true;
} else if (_M0(CONST_T, konst) == cj->r) {
assem = format("$%d, 's0", konst->value);
tsrc.push_back(munchExp(cj->l));
} else {
assem = "'s1, 's0";
tsrc.push_back(munchExp(cj->l));
tsrc.push_back(munchExp(cj->r));
}
emit(_aOPER("cmpl", assem, TempList(), tsrc));
LabelList targets;
targets.push_back(cj->truelab);
targets.push_back(cj->falselab);
assem = format("j%s", reverse ? cond_r[cj->relop] : cond[cj->relop]);
assem::OPER *op = _aOPER(assem, "'j0", NULL, NULL);
op->setJumpTargets(targets);
emit(op);
}
示例6: channelColors
void
AverageDisplay::Initialize( const SignalProperties&, const SignalProperties& )
{
for( size_t i = 0; i < mVisualizations.size(); ++i )
mVisualizations[ i ].Send( CfgID::Visible, false );
mVisualizations.clear();
mChannelIndices.clear();
mPowerSums.clear();
mTargetCodes.clear();
mSignalOfCurrentRun.clear();
#ifdef SET_BASELINE
mBaselines.clear();
mBaselineSamples.clear();
#endif // SET_BASELINE
LabelList markerLabels;
for( int i = 0; i < Parameter( "AvgDisplayMarkers" )->NumRows(); ++i )
{
string markerName = Parameter( "AvgDisplayMarkers" )( i, 0 );
int position =
MeasurementUnits::ReadAsTime( OptionalParameter( markerName, -1 ) )
* Parameter( "SampleBlockSize" );
if( position >= 0 )
markerLabels.push_back( Label( position, markerName ) );
}
int numChannels = Parameter( "AvgDisplayCh" )->NumRows();
mPowerSums.resize( maxPower + 1, vector<vector<vector<float> > >( numChannels ) );
for( int i = 0; i < numChannels; ++i )
{
ostringstream oss;
oss << "AVG" << i;
mVisualizations.push_back( GenericVisualization( oss.str() ) );
GenericVisualization& vis = mVisualizations[ i ];
string windowTitle = Parameter( "AvgDisplayCh" )( i, 1 );
if( windowTitle == "" )
windowTitle = "unknown";
windowTitle += " Average";
vis.Send( CfgID::WindowTitle, windowTitle );
// Note min and max value are interchanged to account for EEG display direction.
vis.Send( CfgID::MinValue, int( Parameter( "AvgDisplayMin" ) ) );
vis.Send( CfgID::MaxValue, int( Parameter( "AvgDisplayMax" ) ) );
vis.Send( CfgID::NumSamples, 0 );
vis.Send( CfgID::GraphType, CfgID::Polyline );
if( !markerLabels.empty() )
vis.Send( CfgID::XAxisMarkers, markerLabels );
ColorList channelColors( sChannelColors );
vis.Send( CfgID::ChannelColors, channelColors );
vis.Send( CfgID::ChannelGroupSize, 0 );
vis.Send( CfgID::ShowBaselines, 1 );
vis.Send( CfgID::Visible, true );
mChannelIndices.push_back( Parameter( "AvgDisplayCh" )( i, 0 ) - 1 );
}
mSignalOfCurrentRun.resize( numChannels );
#ifdef SET_BASELINE
mBaselines.resize( numChannels );
mBaselineSamples.resize( numChannels );
#endif // SET_BASELINE
mLastTargetCode = 0;
}
示例7: average
void
AverageDisplay::Process( const GenericSignal& Input, GenericSignal& Output )
{
size_t targetCode = State( "TargetCode" );
if( targetCode == 0 && targetCode != mLastTargetCode )
{
size_t targetIndex = find( mTargetCodes.begin(), mTargetCodes.end(), mLastTargetCode ) - mTargetCodes.begin();
if( targetIndex == mTargetCodes.size() )
mTargetCodes.push_back( mLastTargetCode );
// End of the current target code run.
for( size_t i = 0; i < mChannelIndices.size(); ++i )
{
for( int power = 0; power <= maxPower; ++power )
{
// - If the target code occurred for the first time, adapt the power sums.
if( mPowerSums[ power ][ i ].size() <= targetIndex )
mPowerSums[ power ][ i ].resize( targetIndex + 1 );
// - Update power sum sizes.
if( mPowerSums[ power ][ i ][ targetIndex ].size() < mSignalOfCurrentRun[ i ].size() )
mPowerSums[ power ][ i ][ targetIndex ].resize( mSignalOfCurrentRun[ i ].size(), 0 );
}
#ifdef SET_BASELINE
if( mBaselineSamples[ i ] > 0 )
mBaselines[ i ] /= mBaselineSamples[ i ];
#endif // SET_BASELINE
// - Compute the power sum entries.
for( size_t j = 0; j < mSignalOfCurrentRun[ i ].size(); ++j )
{
#ifdef SET_BASELINE
mSignalOfCurrentRun[ i ][ j ] -= mBaselines[ i ];
#endif // SET_BASELINE
float summand = 1.0;
for( size_t power = 0; power < maxPower; ++power )
{
mPowerSums[ power ][ i ][ targetIndex ][ j ] += summand;
summand *= mSignalOfCurrentRun[ i ][ j ];
}
mPowerSums[ maxPower ][ i ][ targetIndex ][ j ] += summand;
}
}
// - Clear target run buffer.
for( size_t i = 0; i < mSignalOfCurrentRun.size(); ++i )
mSignalOfCurrentRun[ i ].clear();
#ifdef SET_BASELINE
for( size_t i = 0; i < mBaselines.size(); ++i )
{
mBaselineSamples[ i ] = 0;
mBaselines[ i ] = 0;
}
#endif // SET_BASELINE
// - Compute and display the averages.
for( size_t channel = 0; channel < mVisualizations.size(); ++channel )
{
size_t numTargets = mPowerSums[ maxPower ][ channel ].size(),
numSamples = numeric_limits<size_t>::max();
for( size_t target = 0; target < numTargets; ++target )
if( mPowerSums[ maxPower ][ channel ][ target ].size() < numSamples )
numSamples = mPowerSums[ maxPower ][ channel ][ target ].size();
// To minimize user confusion, always send target averages in ascending order
// of target codes. This ensures that colors in the display don't depend
// on the order of target codes in the task sequence once all target codes
// occurred.
// We cannot, however, avoid color changes when yet unknown target codes
// occur.
//
// The map is automatically sorted by its "key", so all we need to do
// is to put the target codes and their indices into it, using the
// target code as "key" and the index as "value", and later iterate over
// the map to get the indices sorted by their associated target code.
map<int, int> targetCodesToIndex;
for( size_t target = 0; target < numTargets; ++target )
targetCodesToIndex[ mTargetCodes[ target ] ] = target;
GenericSignal average( numTargets, numSamples );
LabelList labels;
for( map<int, int>::const_iterator target = targetCodesToIndex.begin();
target != targetCodesToIndex.end(); ++target )
{
for( size_t sample = 0; sample < numSamples; ++sample )
// If everything behaves as we believe it will,
// a division by zero is impossible.
// If it occurs nevertheless, the logic is messed up.
average( target->second, sample ) =
mPowerSums[ 1 ][ channel ][ target->second ][ sample ] /
mPowerSums[ 0 ][ channel ][ target->second ][ sample ];
ostringstream oss;
oss << "Target " << target->first;
string targetName = OptionalParameter( "TargetNames", target->first );
if( targetName != "" )
oss << " (" << targetName << ")";
labels.push_back( Label( target->second, oss.str() ) );
}
mVisualizations[ channel ].Send( CfgID::ChannelLabels, labels );
ostringstream oss;
oss << ( Parameter( "SampleBlockSize" ) / Input.Elements() / Parameter( "SamplingRate" ) ) << "s";
mVisualizations[ channel ].Send( CfgID::SampleUnit, oss.str() );
mVisualizations[ channel ].Send( average );
}
}
//.........这里部分代码省略.........