本文整理汇总了C++中Iterate函数的典型用法代码示例。如果您正苦于以下问题:C++ Iterate函数的具体用法?C++ Iterate怎么用?C++ Iterate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Iterate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Iterate
CFileNodePackFileNode* CPackFiles::Iterate(CPackFileIterator* psIter)
{
SPackFileIteratorPosition* psCurrent;
int iDirectoryElements;
CFileNodePackFileNode* pcChild;
psCurrent = psIter->Peek();
if (!psCurrent)
{
return NULL;
}
iDirectoryElements = psCurrent->pcNode->Directory()->maNodeFiles.NumElements();
psCurrent->iIndex++;
if (psCurrent->iIndex < iDirectoryElements)
{
pcChild = (CFileNodePackFileNode*)psCurrent->pcNode->Directory()->maNodeFiles.Get(psCurrent->iIndex);
if (pcChild->IsDirectory())
{
psIter->Push(pcChild);
return Iterate(psIter);
}
else
{
psIter->SetCurrent(pcChild);
return psIter->Current();
}
}
else
{
psIter->Pop();
return Iterate(psIter);
}
}
开发者ID:andrewpaterson,项目名称:Codaphela.Library,代码行数:35,代码来源:PackFiles.cpp
示例2: DoEvaluate
static EvaluationContextBase * DoEvaluate(LetEvaluationContext * evaluationContext) {
Term * lets = NULL, * current = NULL, * let[] = {NULL, NULL}, * error = NULL;
if (!evaluationContext->childContextBindings) {
if (!(lets = Iterate(&evaluationContext->arguments))) {
THIS_CONTEXT->result = InvalidArgumentCount();
return THIS_CONTEXT;
}
if (terRedex != lets->tag) {
THIS_CONTEXT->result = InvalidArgumentType();
return THIS_CONTEXT;
}
evaluationContext->letsList = lets->redex;
evaluationContext->childContextBindings = AllocateContextBindings(THIS_CONTEXT->contextBindings);
}
if (!(current = Iterate(&evaluationContext->letsList)))
return AcquireTermListEvaluationContext(THIS_CONTEXT->parent, evaluationContext->childContextBindings, evaluationContext->arguments);
if (terRedex != current->tag) {
THIS_CONTEXT->result = InvalidArgumentType();
return THIS_CONTEXT;
}
if (TakeSeveralArguments(current->redex, let, &error) < 0) {
THIS_CONTEXT->result = error;
return THIS_CONTEXT;
}
if (terVariable != let[0]->tag) {
THIS_CONTEXT->result = InvalidArgumentType();
return THIS_CONTEXT;
}
evaluationContext->currentLetVariable = let[0]->variable;
return AcquireTermEvaluationContext(THIS_CONTEXT, THIS_CONTEXT->contextBindings, let[1]);
}
开发者ID:spaceorc,项目名称:skbscheme,代码行数:33,代码来源:LetEvaluation.c
示例3: EvalLambda
static Term * EvalLambda(Lambda lambda, List arguments) {
Term * formalArgument = NULL, * argument = NULL;
ContextBindings * childContextBindings = AllocateContextBindings(lambda.context);
while(formalArgument = Iterate(&lambda.formalArguments)) {
argument = Iterate(&arguments);
if (!argument)
return InvalidArgumentCount();
CheckTermType(formalArgument, terVariable);
childContextBindings->dictionary = Set(childContextBindings->dictionary, formalArgument->variable, argument);
}
if (Iterate(&arguments))
return InvalidArgumentCount();
return EvalList(lambda.body, childContextBindings);
}
开发者ID:spaceorc,项目名称:skbscheme,代码行数:14,代码来源:Redex.c
示例4: Reset
void PanamaCipherPolicy<B>::CipherSetKey(const NameValuePairs ¶ms, const byte *key, unsigned int length)
{
FixedSizeSecBlock<word32, 8> buf;
Reset();
memcpy(buf, key, 32);
Iterate(1, buf);
if (length == 64)
memcpy(buf, key+32, 32);
else
memset(buf, 0, 32);
Iterate(1, buf);
Iterate(32);
}
开发者ID:acat,项目名称:emule,代码行数:15,代码来源:panama.cpp
示例5: main
int main(int argc, char **argv)
{
FILE *f;
double atk,def;
int t=0;
InitSystem();
Bpp=4;
XRes=800+XR; YRes=400;
ScreenBuf=(unsigned char*)malloc(XRes*YRes*Bpp);
memset(ScreenBuf,0,XRes*YRes*Bpp);
InitSDL();
while (1)
{
int Ch=ReadKey();
if (Ch=='q') exit(0);
Iterate();
Survey(&atk,&def);
f=fopen("output.txt","a");
fprintf(f,"%d %.6g %.6g\n",t,atk,def);
fclose(f);
t++;
}
}
开发者ID:ModelingOriginsofLife,项目名称:Guttenberg-model,代码行数:29,代码来源:foodchain.cpp
示例6: VLOG
void TableGroup<V>::GlobalBarrier() {
VLOG(0) << "Iterating " << max_staleness_ + 1
<< " times to simulate GlobalBarrier()";
for (int i = 0; i < max_staleness_ + 1; ++i) {
Iterate();
}
}
开发者ID:bruce2008github,项目名称:petuum,代码行数:7,代码来源:table_group.hpp
示例7: Think
void Think(POS *p, int *pv) {
pv[1] = 0; // fixing rare glitch
// Play a move from opening book, if applicable
if (use_book) {
pv[0] = GuideBook.GetPolyglotMove(p, 1);
if (pv[0]) return;
pv[0] = MainBook.GetPolyglotMove(p, 1);
if (pv[0]) return;
}
// Set basic data
ClearHist();
tt_date = (tt_date + 1) & 255;
nodes = 0;
abort_search = 0;
verbose = 1;
Timer.SetStartTime();
// Search
Iterate(p, pv);
}
开发者ID:GordCaswell,项目名称:lucaschessportable,代码行数:27,代码来源:search.cpp
示例8: RunAnnotate
static void RunAnnotate(char *fname, int side)
{
FILE *fin = fopen(fname, "r");
struct Position *p;
if(fin) {
struct PGNHeader header;
char move[16];
while(!scanHeader(fin, &header)) {
p = InitialPosition();
while(!scanMove(fin, move)) {
int themove = ParseSAN(p, move);
if(themove != M_NONE) {
ShowPosition(p);
Print(0, "%s(%d): ",
p->turn == White ? "White":"Black", (p->ply/2)+1);
Print(0, "%s\n", SAN(p, themove));
if(side == -1 || (side == p->turn)) {
Iterate(p);
}
DoMove(p, themove);
}
}
FreePosition(p);
}
}
else Print(0, "Couldn't open %s\n", fname);
}
开发者ID:thgreiner,项目名称:amy,代码行数:30,代码来源:commands.c
示例9: mitkThrow
QString QmitkStatisticsModelToStringConverter::GetString() const
{
if (m_statisticsModel == nullptr)
{
mitkThrow() << "Cannot convert TableModel to String: TableModel is nullptr";
}
QString textData;
int columns = m_statisticsModel->columnCount();
if (m_includeHeaderData)
{
for (int i = 0; i < columns; i++)
{
if (i > 0)
{
textData += m_columnDelimiterWithSpace;
}
textData += m_statisticsModel->headerData(i, Qt::Horizontal).toString();
}
textData += m_lineDelimiter;
}
textData += Iterate(m_rootIndex, m_statisticsModel);
return textData;
}
开发者ID:Cdebus,项目名称:MITK,代码行数:26,代码来源:QmitkStatisticsModelToStringConverter.cpp
示例10: StartIteration
void CFiles::GetFileNames(CMapStringInt* pcFileNames)
{
CFileIterator cIter;
CFileIteratorReturn* pcReturn;
int* piValue;
int iRank;
pcReturn = StartIteration(&cIter);
while (pcReturn)
{
piValue = pcFileNames->Get(pcReturn->GetFullName());
if (!piValue)
{
iRank = pcReturn->GetFileRank() << 16;
pcFileNames->Put(pcReturn->GetFullName(), iRank + 1);
}
else
{
iRank = (*piValue) >> 16;
if (iRank < pcReturn->GetFileRank())
{
iRank = pcReturn->GetFileRank() << 16;
*piValue = iRank | (*piValue & 0xFFFF);
}
(*piValue)++;
}
pcReturn = Iterate(&cIter);
}
StopIteration(&cIter);
}
开发者ID:andrewpaterson,项目名称:Codaphela.Library,代码行数:31,代码来源:Files.cpp
示例11: premia_interactive_menu
static int premia_interactive_menu( Planning *pt_plan,
Model **models,
Family **families,
Pricing **pricings,
int user)
{
Model* pt_model;
Option* pt_option;
Pricing* pt_pricing;
PricingMethod* pt_method;
DynamicTest* pt_test;
PricingMethod* pt_methods_available[MAX_METHODS];
if (OutputFile(&out_stream)!=OK) return WRONG;
if (SelectModel(user,pt_plan,models,families,pricings,&pt_model)!=OK) return WRONG;
if (SelectOption(user,pt_plan,families,pt_model,pricings,&pt_option)!=OK) return WRONG;
if (SelectPricing(user,pt_model,pt_option,pricings,&pt_pricing)!=OK) return WRONG;
while(1){
if (SelectMethod(user,pt_plan,pt_pricing,pt_option,pt_model,&pt_method)!=OK)
return FAIL;
if (SelectTest(user,pt_plan,pt_pricing,pt_option,pt_model,pt_method,&pt_test)!=OK)
return FAIL;
if (GetTimeInfo(user,pt_plan,&computation_time_info)!=OK)
return FAIL;
if ((pt_plan->Action=='p')||
(( pt_plan->Action=='t')&&
(GetTest(user,pt_plan,pt_pricing,pt_option,pt_test)==OK))){
(void)ShowPlanning(NAMEONLYTOFILE,pt_plan);
(void)Action(pt_model,pt_option,pt_pricing,
pt_method,pt_test,NAMEONLYTOFILE,pt_plan,&computation_time_info);
Fprintf(TOSCREEN,"\nComputing...\n");
Iterate(pt_plan,&(pt_plan->Par[0]),0,pt_plan->Action,pt_model,pt_option,
pt_pricing,pt_method,pt_test,TOFILE,&computation_time_info);
pt_methods_available[pt_plan->NumberOfMethods]=pt_method;
if (pt_plan->Action=='t' || MoreAction(&(pt_plan->NumberOfMethods))==FAIL)
break;
else
free_premia_method(pt_method);
}
}
fclose(out_stream);
if ((pt_plan->Action=='p') && (pt_plan->VarNumber>0))
(void)BuildGnuStuff(pt_plan,pt_model,pt_option,pt_pricing,pt_methods_available);
if (pt_plan->Action=='t')
{
(void)FreeTest(pt_test);
(void)BuildGnuStuffTest(pt_model,pt_option,pt_pricing,pt_method,pt_test);
}
free_premia_model(pt_model);
free_premia_option(pt_option);
free_premia_method(pt_method);
return OK;
}
开发者ID:jayhsieh,项目名称:premia-13,代码行数:59,代码来源:premia.c
示例12: Iterate
// Iterate over all valid rows in this batch
void RowBatch::Iterate(CodeGen &codegen,
const std::function<void(RowBatch::Row &)> cb) {
// Create a simple adapter around the provided function
CallbackAdapter adapter{cb};
// Do iteration with adapter
Iterate(codegen, adapter);
}
开发者ID:apavlo,项目名称:peloton,代码行数:9,代码来源:row_batch.cpp
示例13: getKey
int StringHash::Add(const String & string, void * object)
{
unsigned int key = getKey(string);
unsigned int h = Iterate(key, string);
if (strings[h] == NULL)
Insert(h, key, string);
objects[h] = object;
if (count * 2 > size)
{
Grow();
return Iterate(key, string);
}
return h;
}
开发者ID:Griffan,项目名称:FASTQuick,代码行数:18,代码来源:StringHash.cpp
示例14: Iterate
OP_STATUS ChainedHashBackend::Next(ChainedHashIterator* iterator) const
{
INT32 pos = iterator->GetHashLinkPos();
if (pos < 0)
{
return OpStatus::ERR;
}
return Iterate(iterator, (UINT32)(pos + 1));
}
开发者ID:prestocore,项目名称:browser,代码行数:9,代码来源:OpHashTable.cpp
示例15: Iterate
CFileIteratorReturn* CFiles::StartIteration(CFileIterator* pcIter)
{
pcIter->Init();
if (mcPackFilesArray.IsEmpty())
{
pcIter->mbFileSystem = TRUE;
}
return Iterate(pcIter);
}
开发者ID:andrewpaterson,项目名称:Codaphela.Library,代码行数:9,代码来源:Files.cpp
示例16:
int32
ConditionalAllAppsIterator::GetNextDirents(struct dirent *buffer, size_t length, int32 count)
{
if (!Iterate())
return 0;
Instantiate();
return fWalker->GetNextDirents(buffer, length, count);
}
开发者ID:HaikuArchives,项目名称:OpenTracker,代码行数:9,代码来源:OpenWithWindow.cpp
示例17: EvalList
Term * EvalList(List list, ContextBindings * contextBindings) {
Term * result = NULL;
Term * i = NULL;
while(i = Iterate(&list))
EvalTermAndCheckError(result, i, contextBindings);
if (!result)
return InvalidArgumentCount();
return result;
}
开发者ID:spaceorc,项目名称:skbscheme,代码行数:9,代码来源:Redex.c
示例18: while
void RunningSceneController::DoMainLoop()
{
initialized = true;
while(!stop_requested)
{
Iterate();
m_thread->sleep(boost::get_system_time()+boost::posix_time::milliseconds(5));
}
}
开发者ID:Adrasl,项目名称:OX,代码行数:9,代码来源:RunningSceneController.cpp
示例19: r
CDenseVector<T> CLevenbergMarquardt<Matrix,T>::Iterate(size_t nouter, const CWeightFunction<T>& w, size_t ninner, T epsilon, bool silentouter, bool silentinner) {
vector<T> residuals;
CDenseVector<T>& weights = m_problem.GetWeights();
CDenseVector<T> r(m_problem.GetNumberOfDataPoints());
m_problem.ComputeResidual(r);
T res = r.Norm2();
residuals.push_back(res);
size_t k = 0;
if(!silentouter) {
cout.setf(ios::scientific,ios::floatfield);
cout << "k=" << k << ": " << res << endl;
}
T sinv;
while(k<nouter) {
// run LM method
Iterate(ninner,1e-10,1e-10,silentinner);
// compute weight function from unweighted (!) residual vector residual
m_problem.ComputeResidual(r);
// update weights used in inner iteration
sinv = w(r,weights);
// save norm of residual
res = r.Norm2();
residuals.push_back(res);
k++;
if(!silentouter)
cout << "k=" << k << ": " << res << endl;
double dres = res - residuals[residuals.size()-2];
if(fabs(dres)<epsilon)
break;
}
// express residual in numbers of variance
for(size_t i=0;i<r.NElems();i++)
r(i) = r.Get(i)*sinv;
// return residual
return r;
}
开发者ID:caomw,项目名称:r4r,代码行数:56,代码来源:lm.cpp
示例20: while
const int GravityIterator<T>::IterateUntilTrapped()
{
while (true) {
const int result = Trapped();
if (result != -1) {
return result;
}
Iterate();
}
}
开发者ID:harryeakins,项目名称:scratch,代码行数:10,代码来源:GravityIterator.cpp
注:本文中的Iterate函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论