本文整理汇总了C++中IDList类的典型用法代码示例。如果您正苦于以下问题:C++ IDList类的具体用法?C++ IDList怎么用?C++ IDList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IDList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//------------------------------------------------------------------------------
void Solver::HashTable::Fill
(
const IDList& particleIDs
)
{
// clear all buckets
for (unsigned int i = 0; i < mDomain.Dimensions.X*mDomain.Dimensions.Y; i++)
{
mBuckets[i].clear();
}
// fill buckets
IDList::const_iterator i = particleIDs.begin();
IDList::const_iterator e = particleIDs.end();
for (; i != e; i++)
{
unsigned int hash = computeHash
(
Vector2f(&mPositions[2*(*i)]),
mDomain
);
mBuckets[hash].push_back(*i);
}
}
示例2: EditList
bool QueueEditor::EditEntry(int ID, bool bSmartOrder, EEditAction eAction, int iOffset, const char* szText)
{
IDList cIDList;
cIDList.clear();
cIDList.push_back(ID);
return EditList(&cIDList, NULL, mmID, bSmartOrder, eAction, iOffset, szText);
}
示例3: InternEditList
bool QueueEditor::LockedEditEntry(DownloadQueue* pDownloadQueue, int ID, bool bSmartOrder, EEditAction eAction, int iOffset, const char* szText)
{
IDList cIDList;
cIDList.clear();
cIDList.push_back(ID);
return InternEditList(pDownloadQueue, &cIDList, bSmartOrder, eAction, iOffset, szText);
}
示例4: loadConversionTable
void UnitsDialog::loadConversionTable( ConversionTable *table, Unit::Type type )
{
UnitList unitList;
database->loadUnits( &unitList, type );
QStringList unitNames;
IDList unitIDs; // We need to store these in the table, so rows and cols are identified by unitID, not name.
table->clear();
for ( UnitList::const_iterator unit_it = unitList.constBegin(); unit_it != unitList.constEnd(); ++unit_it ) {
unitNames.append( ( *unit_it ).name() );
unitIDs.append( ( *unit_it ).id() ); // append the element
}
// Resize the table
table->resize( unitNames.count(), unitNames.count() );
// Set the table labels, and id's
table->setRowLabels( unitNames );
table->setColumnLabels( unitNames );
table->setUnitIDs( unitIDs );
// Load and Populate the data into the table
UnitRatioList ratioList;
database->loadUnitRatios( &ratioList, type );
for ( UnitRatioList::const_iterator ratio_it = ratioList.constBegin(); ratio_it != ratioList.constEnd(); ++ratio_it ) {
table->setRatio( ( *ratio_it ).unitId1(), ( *ratio_it ).unitId2(), ( *ratio_it ).ratio() );
}
}
示例5: FindInIDList
// searches IDList idL for std::string s, returns its position, -1 if not found
inline int FindInIDList(IDList& idL,const std::string& s)
{
// int ix=0;
for(IDList::iterator i=idL.begin(); i != idL.end(); ++i)//, ++ix)
if( *i==s)
{
return i - idL.begin();
}
return -1;
}
示例6: allIDs
static IDList allIDs(QSqlDatabase db, const QString& tableName)
{
IDList ret;
QSqlQuery query(QString("SELECT id FROM %1").arg(tableName), db);
while(query.next()) {
ret.append(query.record().value("id").toULongLong());
}
return ret;
}
示例7: capabilityParameters
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
AmplitudeProcessor::IDList
AmplitudeProcessor_Md::capabilityParameters(Capability cap) const {
if ( cap == MeasureType ) {
IDList params;
params.push_back("AbsMax");
params.push_back("MinMax");
return params;
}
return AmplitudeProcessor::capabilityParameters(cap);
}
示例8: qWarning
void CSVPointListExporter::exportFromDataBase()
{
if(!QFile::exists(sourseDataBaseFile_))
{
qWarning() << sourseDataBaseFile_ << "not exists";
return;
}
SqlPointListReader reader(sourseDataBaseFile_, sourseTableName_);
if(!reader.open())
{
qWarning() << sourseDataBaseFile_ << "not open";
return;
}
QFile targetFile(targetFileName_);
if(!targetFile.open(QFile::WriteOnly | QIODevice::Text))
{
qWarning() << targetFileName_ << "can't open for writing";
}
QTextStream targetFileStream(&targetFile);
const IDList idList = reader.readAllItems();
for(int i = 0; i < idList.count(); i++)
{
const ID& id = idList.at(i);
const PointList pointList = reader.read(id);
for(int j = 0; j < pointList.count(); j++)
{
const Point& point = pointList.at(j);
targetFileStream << pointList.id() << ";" << point;
const bool isLast = ((i + 1) == idList.count())
&& ((j + 1) == pointList.count());
if(!isLast)
{
targetFileStream << '\n';
}
}
}
targetFile.flush();
targetFile.close();
}
示例9: declare
void BaseSemanticWalker::declare(const IDList& ids, Type* type) {
IDList::const_iterator it;
for (it = ids.begin(); it != ids.end(); ++it) {
try {
_symtable->insertSymbol(
Symbol((*it)->getText(),
type,
_symtable->currentScope(),
_symtable->unit(),
(*it)->getLine(),
(*it)->getColumn()));
} catch (RedeclarationException e) {
report((*it)->getLine(), (*it)->getColumn(),
std::string("redeclaração: ") + e.symbol().lexeme());
}
}
}
示例10: estimateExternalWrenchAndInternalJoints
void ExternalWrenchesAndTorquesEstimator::estimateExternalWrenchAndInternalJoints(RobotJointStatus & joint_status, RobotSensorStatus & sensor_status)
{
//Temporary workaround: wholeBodyDynamicsStatesInterface needs all the DOF present in the dynamical model
if( sensors->getSensorNumber(wbi::SENSOR_ENCODER) != robot_estimation_model->getNrOfDOFs() )
{
IDList list = sensors->getSensorList(wbi::SENSOR_ENCODER);
std::cerr << "Available encoders: " << list.toString() << std::endl;
std::cerr << "yarpWholeBodyDynamicsEstimator::run() error: " <<
sensors->getSensorNumber(wbi::SENSOR_ENCODER) << " joint sensors are available, while " <<
robot_estimation_model->getNrOfDOFs() << " joints are present in the model " << std::endl;
assert(false);
return;
}
///< \todo improve robustness: what if a sensor dies or stop working? interface should warn the user
{
resizeAll(sensors->getSensorNumber(SENSOR_ENCODER));
resizeFTs(sensors->getSensorNumber(SENSOR_FORCE_TORQUE));
resizeIMUs(sensors->getSensorNumber(SENSOR_IMU));
///< Read encoders
omega_used_IMU = sensor_status.omega_imu;
domega_used_IMU = sensor_status.domega_imu;
ddp_used_IMU = sensor_status.proper_ddp_imu;
///< Read skin contacts
readSkinContacts();
///< Estimate joint torque sensors from force/torque measurements
estimateExternalForcesAndJointTorques(joint_status,sensor_status);
///< Filter obtained joint torque measures
// \todo reintroduce the filter ?
joint_status.setJointTorquesYARP(tauJ);// tauJFilt->filt(tauJ); ///< low pass filter
}
return;
}
示例11: GetAttr
int CacheBase::Truncate(std::string path, off_t offset)
{
pf_log[W_DEBUG] << "Truncating \"" << path << "\" at " << offset;
pf_stat stat = GetAttr(path);
stat.size = (size_t)offset;
stat.ctime = time(NULL);
stat.mtime = stat.ctime;
stat.meta_mtime = stat.ctime;
IDList idlist;
idlist.insert(environment.my_id.Get());
SetAttr(path, stat, idlist);
FileContent& file = content_list.GetFile(path);
file.Truncate(offset);
return 0;
}
示例12: Find
int Find( const std::string& name)
{
String_abbref_eq strAbbrefEq_name(name);
// search keyword
IDList::iterator f=std::find_if(listName.begin(),
listName.end(),
strAbbrefEq_name);
if( f == listName.end()) return -1;
// Note: there might be duplicate extra keyword names, return first one
// // continue search (for ambiguity)
// IDList::iterator ff=std::find_if(f+1,
// listName.end(),
// strAbbrefEq_name);
// if( ff != listName.end())
// {
// throw GDLException("Ambiguous keyword abbreviation in _EXTRA: "+name);
// }
return std::distance( listName.begin(),f);
}
示例13: chunk
void CacheBase::Write(std::string path, const char* buf, size_t size, off_t off)
{
FileContent& file = content_list.GetFile(path);
FileChunk chunk(buf, off, size);
file.SetChunk(chunk);
/* No need to lock cache, we don't touch its members */
pf_stat stat = GetAttr(path);
time_t now = time(NULL);
stat.meta_mtime = now;
stat.mtime = now;
stat.ctime = now;
IDList idlist;
idlist.insert(environment.my_id.Get());
if(off + (off_t)size > (off_t)stat.size)
{
stat.size = (size_t)off + size;
SetAttr(path, stat, idlist);
}
//content_list.RefreshPeersRef(path);
}
示例14: MergeGroups
NZBInfo* PrePostProcessor::MergeGroups(DownloadQueue* pDownloadQueue, NZBInfo* pNZBInfo)
{
int iAddedGroupID = 0;
// merge(1): find ID of any file in new nzb-file
for (FileQueue::iterator it = pDownloadQueue->GetFileQueue()->begin(); it != pDownloadQueue->GetFileQueue()->end(); it++)
{
FileInfo* pFileInfo = *it;
if (pFileInfo->GetNZBInfo() == pNZBInfo)
{
iAddedGroupID = pFileInfo->GetID();
break;
}
}
// merge(2): check if queue has other nzb-files with the same name
if (iAddedGroupID > 0)
{
for (FileQueue::iterator it = pDownloadQueue->GetFileQueue()->begin(); it != pDownloadQueue->GetFileQueue()->end(); it++)
{
FileInfo* pFileInfo = *it;
if (pFileInfo->GetNZBInfo() != pNZBInfo &&
!strcmp(pFileInfo->GetNZBInfo()->GetName(), pNZBInfo->GetName()))
{
// file found, do merging
IDList cIDList;
cIDList.push_back(pFileInfo->GetID());
cIDList.push_back(iAddedGroupID);
g_pQueueCoordinator->GetQueueEditor()->LockedEditList(pDownloadQueue, &cIDList, false, QueueEditor::eaGroupMerge, 0, NULL);
return pFileInfo->GetNZBInfo();
}
}
}
return pNZBInfo;
}
示例15: CanCharacterControlObject
bool CKeyMgr::CanCharacterControlObject( HOBJECT hChar, HOBJECT hObj )
{
#ifndef _CLIENTBUILD
if( !hChar || !hObj || !IsCharacter( hChar ))
return false;
// If there are no keys that control this object the Character shouldn't be able to control it.
KeyControlMap::iterator iter = m_mapKeyControl.find( hObj );
if( iter == m_mapKeyControl.end() )
return false;
CCharacter *pChar = (CCharacter*)g_pLTServer->HandleToObject( hChar );
if( !pChar )
return false;
IDList *pCharKeyList = pChar->GetKeyList();
uint8 nDummy;
IDList& idList = (*iter).second.m_IDList;
// Make sure the character has all the keys that are needed to control the object...
for( uint8 i = 0; i < idList.m_IDArray.size(); ++i )
{
if( !pCharKeyList->Have( idList.m_IDArray[i], nDummy ))
{
return false;
}
}
#endif
return true;
}