本文整理汇总了C++中CList::RemoveAll方法的典型用法代码示例。如果您正苦于以下问题:C++ CList::RemoveAll方法的具体用法?C++ CList::RemoveAll怎么用?C++ CList::RemoveAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CList
的用法示例。
在下文中一共展示了CList::RemoveAll方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vIDCopy
/******************************************************************************
Function Name : vIDCopy
Input(s) : omDestMap, omSrcMap of IDs
Output : -
Functionality : Copies the source ID map values into destination.
Member of : CMessageAttrib
Author(s) : Arunkumar K
Date Created : 08-03-2011
Modifications :
******************************************************************************/
void CMessageAttrib::vIDCopy(CList <UINT, UINT&>& omDestMap,
CList <UINT, UINT&>& omSrcMap)
{
UINT unMsgID;
omDestMap.RemoveAll();
POSITION psCurrPos = omSrcMap.GetHeadPosition();
while (psCurrPos != NULL)
{
unMsgID = omSrcMap.GetNext(psCurrPos);
omDestMap.AddTail(unMsgID);
}
}
示例2: mpc_filehash
void mpc_filehash(CPlaylist& pl, CList<filehash>& fhs)
{
fhs.RemoveAll();
POSITION pos = pl.GetHeadPosition();
while (pos) {
CString fn = pl.GetNext(pos).m_fns.GetHead();
if (AfxGetAppSettings().m_Formats.FindExt(CPath(fn).GetExtension().MakeLower(), true)) {
continue;
}
filehash fh;
if (!mpc_filehash(fn, fh)) {
continue;
}
fhs.AddTail(fh);
}
}
示例3: AssignRankAndCrowdingDistance
void CPopulation::AssignRankAndCrowdingDistance()
{
ASSERT(individuals != NULL);
ASSERT(pProblem != NULL);
int front_size = 0;
int rank = 1;
int orig_index, cur_index;
POSITION pos1, pos2, tmp_pos;
CList<int, int> orig;
CList<int, int> cur;
for (int i=0; i<pProblem->popsize; i++)
orig.AddTail(i);
while (!orig.IsEmpty())
{
pos1 = orig.GetHeadPosition();
orig_index = orig.GetNext(pos1);
if (pos1 == NULL)
{
individuals[orig_index].rank = rank;
individuals[orig_index].crowd_dist = INF;
break;
}
cur.AddHead(orig_index);
front_size = 1;
orig.RemoveHead();
pos1 = orig.GetHeadPosition();
while (pos1 != NULL)
{
int flag = -1;
orig_index = orig.GetAt(pos1);
pos2 = cur.GetHeadPosition();
while (pos2 != NULL)
{
cur_index = cur.GetAt(pos2);
flag = individuals[orig_index].CheckDominance(individuals[cur_index]);
if (flag == 1)
{
orig.AddHead(cur_index);
front_size--;
tmp_pos = pos2;
cur.GetNext(pos2);
cur.RemoveAt(tmp_pos);
}
else if (flag == 0)
{
cur.GetNext(pos2);
}
else if (flag == -1)
{
break;
}
}
if (flag != -1)
{
cur.AddHead(orig_index);
front_size++;
tmp_pos = pos1;
orig.GetNext(pos1);
orig.RemoveAt(tmp_pos);
}
else
{
orig.GetNext(pos1);
}
}
pos2 = cur.GetHeadPosition();
while (pos2 != NULL)
{
cur_index = cur.GetNext(pos2);
individuals[cur_index].rank = rank;
}
AssignCrowdingDistanceList((void*) &cur, front_size);
cur.RemoveAll();
rank++;
}
}
示例4: DetectEvents
// --------------------------------------------------------------------------
int GroupingEventDetector::DetectEvents(int nFrame, CNewVisionDoc* doc) {
/*
The fitness of body Bi in group Gj can be determined as
f(Bi, Gj) = W_dwell * f_dwell +
W_alignment * f_alignment +
W_cohesion * f_cohesion
Where f_* are functions that compute ( Co-dwelling: dwell near the same or nearby fixture as swarm-mates
Alignment: align towards the average heading of the local swarm-mates
Cohesion: position itself close to the average position of local swarm-mates )
and W_* are respective weights
f_dwell(Bi, Gj) = || Bi_dwell_fixture_xy && mean(Gj_dwell_fixture_xy) ||
f_alignment(Bi, Gj) = (Bi_velocity, mean(Gj_velocity))
f_cohesion(Bi, Gj) = 1 / || Bi_xy, mean(Gj_xy) ||
*/
if (nFrame % m_everyNframe)
return -1;
// --------- At each frame perfom a mapping of Bi (bodies) to Gi (groups)------------
// Create a temporary queue of recent events
CList<SwarmEvent*, SwarmEvent*> recentEvents;
SmartPtrArray<BodyCluster> cl;
SmartPtrArray<BodyCluster> cl_copy;
BodyCluster all;
for (POSITION pos = doc->m_TrackingData.data.GetStartPosition();pos;) {
int id; BodyPath *bp;
doc->m_TrackingData.data.GetNextAssoc(pos, id, bp);
if (nFrame < bp->startFrame || nFrame > bp->startFrame+bp->GetUpperBound())
continue;
Step s = bp->GetAt(nFrame-bp->startFrame);
if (!s.visible)
continue;
bool dwell = bp->ComputeDwellingState(nFrame,
doc->bodyactivitymodel.m_pathSmoothSigma,
doc->bodyactivitymodel.m_dwellTime,
doc->bodyactivitymodel.m_dwellAreaRadius);
double orientation = bp->GetMotionAngle(nFrame, doc->bodyactivitymodel.m_pathSmoothSigma);
BodyClusterElement *bce = new BodyClusterElement(id, cvPoint3D32f(s.p.x, s.p.y, 0), s.orientation, dwell);
cl.Add(new BodyCluster(bce));
all.Add(bce);
}
// (1.0) Prepare a set of N singleton clusters and NxN distance matrix
int N = cl.GetCount();
if (N < 2)
return 0;
CvMat* D = cvCreateMat(N, N, CV_64FC1); // lower-left diagonal matrix
cvSet(D, cvScalar(FLT_MAX));
for (int i = 0;i < N;i++)
for (int j = 0;j < i;j++) {
double d = ComputeDistance(cl[i], cl[j]);
cvSetReal2D(D, i, j, d);
cvSetReal2D(D, j, i, d);
}
CvMat* D_elements = (CvMat*)cvClone(D);
// (2.0) Perform agglomerative clustering
double kValidityNow = ComputeGroupClusteringValidity(doc, cl, &all, D_elements); // to determine the optimal number of clusters compute clustering validity index
double kValidityBefore = 0;
int step=0;
String ^msg = gcnew String("");
do {
double min_val, max_val;
CvPoint min_loc, max_loc;
cl_copy.Copy(cl);
cvMinMaxLoc(D, &min_val, &max_val, &min_loc, &max_loc);
if (min_val == FLT_MAX)
break;
BodyCluster *b1 = cl[min_loc.x], *b2= cl[min_loc.y];
// break if no more close bodies
if (d(b1->bot, b2->bot) > m_maxGroupDiameter )
break;
// merge
//doc->Message(String::Concat("Add ", b2->id, " at [", b2->bot.x, ", ", b2->bot.y, "] to ", b1->id, " at [", b1->bot.x, ", ", b1->bot.y, "]"));
b1->Add(b2);
//doc->Message(String::Concat("Result at [", b1->bot.x, ", ", b1->bot.y, "] "));
b2->sub.RemoveAllPointers();
// change row and col 'min_loc.x'
for (int i=0;i<N;i++) {
if (i == min_loc.x)
continue;
double dist = ComputeDistance(cl[i], b1);
cvSetReal2D(D, i, min_loc.x, dist);
cvSetReal2D(D, min_loc.x, i, dist);
}
// erase row and col 'min_loc.y'
for (int i=0;i<N;i++) {
cvSetReal2D(D, i, min_loc.y, FLT_MAX);
cvSetReal2D(D, min_loc.y, i, FLT_MAX);
}
msg += String::Format("{0:f2}:{1:f2} ", isolation, compactness);
//.........这里部分代码省略.........
示例5: types
void CHello2Dlg::OnProcessSel(int id)
{
int curch = m_chlist.GetCurSel();
if(m_cmdbase == ID_32773) //data operation
{
CList<double,double> *data = &m_ridlgs[curch]->m_data;
if(m_ridlgs[curch]->show_type == SHOW_ORGDATA)
data = &m_ridlgs[curch]->m_output;
if(id == 1) //show converted result
{
m_ridlgs[curch]->show_type = SHOW_MAINDATA;
}
if(id == 2) //show raw result
{
m_ridlgs[curch]->show_type = SHOW_ORGDATA;
}
if(id == 3) //delete the current record
{
int pos = m_history.GetCurSel();
if((pos >= 0) && (data))
{
POSITION p = data->GetHeadPosition();
while(pos-- > 0 )
data->GetNext(p);
data->RemoveAt(p);
}
}
if(id == 4) //delete all the record
{
data->RemoveAll();
}
if(id == 5) //export all the record
{
CFile cf;
if(!cf.Open(DATAOUT_NAME,CFile::modeCreate|CFile::modeWrite))
return;
//write to txt and open with notepad
if(data && (data->GetCount() > 0))
{
POSITION pos = data->GetHeadPosition();
char r[50];
do{
double v = data->GetAt(pos);
sprintf(r,"%8f\r\n",v);
cf.Write(r,strlen(r));
if(pos == data->GetTailPosition())
break;
data->GetNext(pos);
}while(1);
}
cf.Close();
SHELLEXECUTEINFO execInf;
ZeroMemory (&execInf, sizeof (execInf));
execInf.cbSize = sizeof (SHELLEXECUTEINFO);
execInf.fMask = SEE_MASK_NOCLOSEPROCESS;
execInf.nShow = SW_SHOWNORMAL;
execInf.lpFile = _T("\\windows\\pword.exe");
execInf.lpVerb = _T("open");
execInf.lpParameters = DATAOUT_NAME;
ShellExecuteEx (&execInf);
}
}
if(m_cmdbase == ID_32772)
{
if(id == 1)
{
m_ridlgs[curview]->sidedata = NULL;
}else{
m_ridlgs[curview]->sidedata = &m_ridlgs[id-2]->m_data;
m_ridlgs[curview]->side_ch = id-2;
}
m_ridlgs[curview]->SaveLastConfig();
}
if(m_cmdbase == ID_32771) //channel config
{
if(m_cfgtype == CFGTYPE_BORE)
{
CSetting<PROBECFG> prbset;
prbset.InstallFromFile(PRB_DEFINFO);
if(id == 1)//just close it
{
m_ridlgs[curch]->cfg_now = CFGTYPE_NONE;
for(int i=0;i<sizeof(m_ridlgs)/sizeof(CRunitemDialog*);i++){
if((m_ridlgs[i]->cfg_now == CFGTYPE_BORE) && (i != curch) && (m_ridlgs[i]->side_ch == curch))
{
m_ridlgs[i]->sidedata = NULL;
}
}
}else{
m_ridlgs[curch]->m_prbid = prbset.GetNameAt(id-2);
m_ridlgs[curch]->cfg_now = CFGTYPE_BORE;
//.........这里部分代码省略.........
示例6: SetShowPlayWin
int CScreenPannel::SetShowPlayWin(int nMain, int nSub)
{
if (nSub < 0 || nSub > 16)
{
nSub = 0;
}
int nNum = 16;
int nBegin = 0;
switch(nMain)
{
case SCREEN_1MODE:
nNum = 1;
nBegin = nSub;
break;
case SCREEN_4MODE:
nNum = 4;
if (nSub >= 12)
{
nBegin = 12;
}
else if (nSub >= 8)
{
nBegin = 8;
}
else if (nSub >= 4)
{
nBegin = 4;
}
else
{
nBegin = 0;
}
break;
case SCREEN_9MODE:
nNum = 9;
if (nSub >= 10)
{
nBegin = 7;
}
else
{
nBegin = 0;
}
break;
case SCREEN_16MODE:
nNum = 16;
nBegin = 0;
break;
default:
break;
}
CList<CWnd*, CWnd*> templist;
POSITION pos = m_PageList.GetHeadPosition();
while(pos != NULL)
{
CWnd* pWnd = m_PageList.GetNext(pos);
if (pWnd)
{
templist.AddTail(pWnd);
}
}
m_PageList.RemoveAll();
/*
while(m_PageList.GetCount())
{
DelPage(GetTailPage());
}
*/
for(int i=nBegin; i < (nBegin+nNum); i++)
{
AddPage(&m_wndVideo[i], TRUE);
}
SetActivePage(&m_wndVideo[nSub], TRUE);
pos = templist.GetHeadPosition();
while(pos != NULL)
{
CWnd* pWnd = templist.GetNext(pos);
if (pWnd)
{
pWnd->ShowWindow(SW_HIDE);
}
}
templist.RemoveAll();
return m_PageList.GetCount();
/*
if (m_PageList.GetCount() > nNum)
{
//.........这里部分代码省略.........