本文整理汇总了C++中Iterate函数的典型用法代码示例。如果您正苦于以下问题:C++ Iterate函数的具体用法?C++ Iterate怎么用?C++ Iterate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Iterate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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]);
}
示例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);
}
示例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);
}
示例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++;
}
}
示例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();
}
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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));
}
示例15: Iterate
CFileIteratorReturn* CFiles::StartIteration(CFileIterator* pcIter)
{
pcIter->Init();
if (mcPackFilesArray.IsEmpty())
{
pcIter->mbFileSystem = TRUE;
}
return Iterate(pcIter);
}