这篇教程C++ GetNext函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetNext函数的典型用法代码示例。如果您正苦于以下问题:C++ GetNext函数的具体用法?C++ GetNext怎么用?C++ GetNext使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetNext函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: Optimise_Plcvoid Optimise_Plc(PLC *plc){ TAG *btag=NULL; // Base Tag for optimized Packet PACKET *packet=NULL; int bfindex=0,findex=0,bfunc=0,func=0; int MaxRealPacketSize=50; int MaxEltByPacket=MaxRealPacketSize; TrieChListe(&(plc->Tags),&compare_plc); LISTE *tags=&(plc->Tags); LISTE *packets=&(plc->Packets); Log(LOG_DEBUG,"Optimise Plc: %s (%d Tags)/n",plc->PlcName,tags->Count); ELEMENT *elt=GetFirst(tags); while (elt!=NULL) { if (btag==NULL) { btag=elt->Data; bfindex=_MBGetC_F_Index(btag->Address); //bfunc=_MBGetC_F_Index(btag->Address); bfunc=FTable[bfindex].Read_Function; elt=GetNext(tags,elt); continue; } else { TAG *tag=elt->Data; findex=_MBGetC_F_Index(btag->Address); //func=_MBGetC_F_Index(tag->Address); func=FTable[findex].Read_Function; if ((bfunc==func)&&(_MBGetAddress(btag->Address)+MaxEltByPacket>=_MBGetAddress(tag->Address))) { if (packet==NULL) // create a new packet { packet=malloc(sizeof(PACKET)); if (packet!=NULL) // new packet { AddChListe(packets,packet); memset(packet,0,sizeof(PACKET)); AddPacket(packet,btag); // base tag memcpy(packet->BaseAddress,btag->Address,sizeof(packet->BaseAddress)); RemoveChListe(tags,btag); } else Log(LOG_CRIT,"Optimise_Plc : Unable to allocate memory: %s/n",strerror(errno)); }; if (packet!=NULL) // add to actual packet { AddPacket(packet,tag); tag->Index=_MBGetAddress(tag->Address)-_MBGetAddress(btag->Address);//-1; elt=GetNext(tags,elt); RemoveChListe(tags,tag); packet->NumElt=_MBGetAddress(tag->Address)-_MBGetAddress(btag->Address)+_MBGetDataSize(FTable[findex].DataType); continue; } } else { btag=NULL; // if not, there is no possibility of optimization packet=NULL; continue; } elt=GetNext(tags,elt); } }}
开发者ID:Felipeasg,项目名称:TuxPLC,代码行数:62,
示例2: GetNextbool TrackList::CanMoveDown(Track * t) const{ return GetNext(t, true) != NULL;}
开发者ID:SteveDaulton,项目名称:audacity,代码行数:4,
示例3: wxCHECK_MSGsize_t wxDir::Traverse(wxDirTraverser& sink, const wxString& filespec, int flags) const{ wxCHECK_MSG( IsOpened(), (size_t)-1, wxT("dir must be opened before traversing it") ); // the total number of files found size_t nFiles = 0; // the name of this dir with path delimiter at the end wxString prefix = GetName(); prefix += wxFILE_SEP_PATH; // first, recurse into subdirs if ( flags & wxDIR_DIRS ) { wxString dirname; for ( bool cont = GetFirst(&dirname, wxEmptyString, wxDIR_DIRS | (flags & wxDIR_HIDDEN) ); cont; cont = cont && GetNext(&dirname) ) { const wxString fulldirname = prefix + dirname; switch ( sink.OnDir(fulldirname) ) { default: wxFAIL_MSG(wxT("unexpected OnDir() return value") ); // fall through case wxDIR_STOP: cont = false; break; case wxDIR_CONTINUE: { wxDir subdir; // don't give the error messages for the directories // which we can't open: there can be all sorts of good // reason for this (e.g. insufficient privileges) and // this shouldn't be treated as an error -- instead // let the user code decide what to do bool ok; do { wxLogNull noLog; ok = subdir.Open(fulldirname); if ( !ok ) { // ask the user code what to do bool tryagain; switch ( sink.OnOpenError(fulldirname) ) { default: wxFAIL_MSG(wxT("unexpected OnOpenError() return value") ); // fall through case wxDIR_STOP: cont = false; // fall through case wxDIR_IGNORE: tryagain = false; break; case wxDIR_CONTINUE: tryagain = true; } if ( !tryagain ) break; } } while ( !ok ); if ( ok ) { nFiles += subdir.Traverse(sink, filespec, flags); } } break; case wxDIR_IGNORE: // nothing to do ; } } } // now enum our own files if ( flags & wxDIR_FILES ) { flags &= ~wxDIR_DIRS; wxString filename; bool cont = GetFirst(&filename, filespec, flags); while ( cont ) { wxDirTraverseResult res = sink.OnFile(prefix + filename);//.........这里部分代码省略.........
开发者ID:DumaGit,项目名称:winsparkle,代码行数:101,
示例4: GetHeadPositionvoid NEPointerList::OnDraw( VGDevice & hdc ) const{ //GRNotationElement* e; GuidoPos pos = GetHeadPosition(); while(pos) GetNext(pos)->OnDraw(hdc);}
开发者ID:EQ4,项目名称:guido-engine,代码行数:6,
示例5: whilevoid NEPointerList::setPosition(const NVPoint & newPosition){ GuidoPos pos=GetHeadPosition(); while(pos) GetNext(pos)->setPosition(newPosition);}
开发者ID:EQ4,项目名称:guido-engine,代码行数:5,
示例6: GetScoredDistancedoubleTaskLeg::ScanDistanceScored(const GeoPoint &ref) const{ return GetScoredDistance(ref) + (GetNext() ? GetNext()->ScanDistanceScored(ref) : 0);}
开发者ID:Advi42,项目名称:XCSoar,代码行数:6,
示例7: lockCOHScriptObject *CFunctionCollection::GetFirst() { CSLock lock(m_critsec); enumerator_it = _function_map.begin(); return GetNext();}
开发者ID:awptimus,项目名称:openholdembot,代码行数:5,
示例8: CheckConnectionint CheckConnection(PLC *plc){ if (plc==NULL) return(0); Log(LOG_DEBUG,"Checking Connection for %s/n",plc->PlcName); Eip_Connection *new_connection=NULL; Eip_Connection *connection=plc->Connection; Eip_Session *session=plc->Session; if (session==NULL) return(0); if (connection==NULL) { Log(LOG_DEBUG,"Connection for %s is NULL/n",plc->PlcName); return(BuildConnection(plc)); } BYTE *path=(BYTE*)(((void*)connection)+sizeof(Eip_Connection)); if (plc->NetWork) new_connection=_ConnectPLCOverDHP(session, plc->PlcType, _Priority,_TimeOut_Ticks, (int)session, //TO_ConnID, connection->ConnectionSerialNumber, //ConnSerialNumber connection->OriginatorVendorID, connection->OriginatorSerialNumber, _TimeOutMultiplier, MAX_SAMPLE, _Transport, plc->NetWork, path, connection->Path_size); else new_connection=_ConnectPLCOverCNET(session, plc->PlcType, _Priority,_TimeOut_Ticks, (int)session, //TO_ConnID, connection->ConnectionSerialNumber, //ConnSerialNumber connection->OriginatorVendorID, connection->OriginatorSerialNumber, _TimeOutMultiplier, MAX_SAMPLE, _Transport, path, connection->Path_size); //flush(session->query); //flush(session->reply); Log(LOG_DEBUG,"Checking Connection for %s : %s (%X/%X) -> %p/n",plc->PlcName,cip_err_msg,cip_errno,cip_ext_errno,new_connection); if (new_connection==NULL) { if ((cip_errno==0x01)&&(cip_ext_errno==0x100)) { Log(LOG_WARNING,"Connection OK for %s/n",plc->PlcName); return(1); // duplicate Forward open } // error }else { if (cip_errno) { free(new_connection); new_connection=NULL; } }; //Log(LOG_WARNING,"connection = %p/n",connection); RemoveChListe(&CONNECTIONs,connection); ELEMENT *elt=GetFirst(&PLCs); if (elt!=NULL) do { PLC *plc=elt->Data; if (plc->Connection==connection) plc->Connection=new_connection; } while ((elt=GetNext(&PLCs,elt))!=NULL); if (new_connection!=NULL) { AddChListe(&CONNECTIONs,new_connection); Log(LOG_WARNING,"Connection OK for %s (%d connections)/n",plc->PlcName,CONNECTIONs.Count); return(1); }else { Log(LOG_WARNING,"Connection Error for %s (%d connections)/n",plc->PlcName,CONNECTIONs.Count); return(0); }}
开发者ID:Felipeasg,项目名称:TuxPLC,代码行数:90,
示例9: EthGetPacket// Read next packetUINT EthGetPacket(ETH *e, void **data){ BLOCK *b; bool flag = false; // Validate arguments if (e == NULL || data == NULL) { return INFINITE; } if (e->HasFatalError) { return INFINITE; } if (e->SuAdapter != NULL) { // Read packet with SeLow UINT size; if (SuGetNextPacket(e->SuAdapter, data, &size) == false) { // Error occurred e->HasFatalError = true; return INFINITE; } return size; }RETRY: // Check the presence of the packet in queue b = GetNext(e->PacketQueue); if (b != NULL) { UINT size; size = b->Size; *data = b->Buf; Free(b); if (e->PacketQueue->num_item == 0) { e->Empty = true; } return size; } if (e->Empty) { e->Empty = false; return 0; } if (flag == false) { // Try to get next packet PROBE_STR("EthGetPacket: PacketInitPacket"); wp->PacketInitPacket(e->Packet, e->Buffer, e->BufferSize); PROBE_STR("EthGetPacket: PacketReceivePacket"); if (wp->PacketReceivePacket(e->Adapter, e->Packet, false) == false) { // Failed return INFINITE; } else { UCHAR *buf; UINT total; UINT offset; buf = (UCHAR *)e->Packet->Buffer; total = e->Packet->ulBytesReceived; offset = 0; while (offset < total) { struct bpf_hdr *header; UINT packet_size; UCHAR *packet_data; header = (struct bpf_hdr *)(buf + offset); packet_size = header->bh_caplen; offset += header->bh_hdrlen; packet_data = buf + offset; offset = Packet_WORDALIGN(offset + packet_size); if (packet_size >= 14) { UCHAR *tmp; BLOCK *b; PROBE_DATA2("EthGetPacket: NewBlock", packet_data, packet_size); tmp = MallocFast(packet_size); Copy(tmp, packet_data, packet_size); b = NewBlock(tmp, packet_size, 0); InsertQueue(e->PacketQueue, b); } }//.........这里部分代码省略.........
开发者ID:455475876github,项目名称:SoftEtherVPN,代码行数:101,
示例10: whileNodeRenderableBounded *CDRArrowheadStore::GetConvertedNode(DWORD Reference, INT32 *Distance, BOOL *NotPresent){ // set up the not present thingy *NotPresent = FALSE; // find the correct chunk CDRArrowheadStoredItem *Item; INT32 Size; if(IsEmpty()) return 0; // no items in the list Item = (CDRArrowheadStoredItem *)GetHead(); // scan though the list looking for the reference while(Item != 0) { if(CDRDATA_DWORD(*((DWORD *)(Item->Block))) == Reference) { Size = Item->Size; break; } Item = (CDRArrowheadStoredItem *)GetNext(Item); } // did we find a chunk? if(Item == 0) { *NotPresent = TRUE; return 0; } // locate the coordinates cdrfArrowhead *Arrow = (cdrfArrowhead *)Item->Block; cdrfCoord *Coords = (cdrfCoord *)(Item->Block + CDRDATA_WORD(Arrow->CoordsOffset) + cdrfARROWHEAD_COORDOFF_CORRECT); // store the distance from the definitons *Distance = CDRDATA_SWORD(Arrow->Distance); // check to see if a cached pointer is available if(Item->pNode != 0) return Item->pNode; // OK, convert that arrowhead // this is not particularly pleasant. We need to scan though the coords creating a path, // each sub path must be a seperate path unless the next subpath has the same closedness // as the previous one, in which case it's a sub path. // this is because closed sub paths have different attributes to open ones. It's a nasty // system, and rather overcomplicated, but never mind. INT32 ThisType = GCN_LASTSUB_NONE; // the type of this subpath INT32 LastType = GCN_LASTSUB_NONE; // the type of the last subpath NodePath *FirstPath = 0; // the first path in my set of paths NodePath *LastPath = 0; // the last path in my set of paths NodePath *ThisPath = 0; // the path I'm currently working on // check that the first node type is a move to avoid stuffing up my next bit if((Arrow->NodeTypes[0] & cdrfPATHCOORDTYPE_MASK) != cdrfPATHCOORDTYPE_MOVE) { // for now, if the first element isn't a move, pretend that it doesn't exist *NotPresent = TRUE; return 0; } INT32 CoordType; INT32 l; UINT32 Control1 = 0; // number of first control point UINT32 Control2 = 0; // of second DocCoord co, cn1, cn2; // coordinates PathFlags Flags; INT32 NNodes = CDRDATA_WORD(Arrow->NNodes); BOOL NeedMoveTo = TRUE; // convert all the coordinates for(l = 0; l < NNodes; l++) { CoordType = Arrow->NodeTypes[l] & cdrfPATHCOORDTYPE_MASK; if(CoordType == cdrfPATHCOORDTYPE_MOVE || l == 0) { // start a new path! LastType = ThisType; // first of all, what type of path is this? if((Arrow->NodeTypes[l] & cdrfPATHCOORDATTR_CLOSE) != 0) ThisType = GCN_LASTSUB_CLOSED; else ThisType = GCN_LASTSUB_OPEN; // OK, do we need to start a new path? if(ThisType != LastType) { // yep, attach the last one we did if(ThisPath != 0)//.........这里部分代码省略.........
开发者ID:Amadiro,项目名称:xara-cairo,代码行数:101,
示例11: mainprog//.........这里部分代码省略......... { Log(LOG_INFO,"Connexion d'un client depuis %s (socket : %d)/n", inet_ntoa(sonadr.sin_addr),fd); SetCoe(fd); client=malloc(sizeof(CLIENT)); if (client!=NULL) { if (AddChListe(&CLIENTs,client)>0) { /* ajout du client dans les socket à surveiller */ memset(client,0,sizeof(CLIENT)); client->FD=fd; FD_SET(fd, &fd_clients); fcntl(fd, F_SETFL, O_NONBLOCK | fcntl(fd, F_GETFL, 0)); Log(LOG_INFO,"Client connecté depuis %s (socket : %d)/n", inet_ntoa(sonadr.sin_addr),fd); } else { close(fd); Log(LOG_CRIT, "Erreur à l'ajout du client (%s)/n",strerror(errno)); } } else { close(fd); Log(LOG_WARNING, "Erreur à la création du client (%s)/n",strerror(errno)); } } } /* Tester si les sockets clientes ont bougées */ for(fd=0; fd<nfds; fd++ ) { if((fd != Server) && FD_ISSET(fd, &rfds)) { /* Recherche du client */ client=FindClient(fd,&CLIENTs); if (client==NULL) { Log(LOG_WARNING, "Client inconnu !!! (socket : %d)--/n",fd); close(fd); FD_CLR(fd, &fd_clients); Reply(fd,"Erreur interne (line : %d)/n",__LINE__); continue; } switch (lire_client(client)) { case 0: RemoveChListe(&CLIENTs,client); free(client); close(fd); FD_CLR(fd, &fd_clients); Log(LOG_INFO, "-- perte d'un client ! (socket : %d)--/n",fd); continue; default:/* Traitement requete */ Log(LOG_DEBUG,"<-Client : %p (buffersize : %d)/n",client,client->InBuffer.size); Traite(client); continue; } } } break; } /* Checking Tag inactivity */ if (TAGs.Count>0) { time_t now=time(NULL); ELEMENT *elt=GetFirst(&TAGs); if (elt!=NULL) do { TAG *tag=elt->Data; if ((now-tag->Time_Value)>INACTIVITY_TO) { ELEMENT *elt_old=elt; Log(LOG_DEBUG,"/t-Deleting Tag %s on %s (%p / %p)/n",tag->TagName,tag->Plc->PlcName,tag,elt); elt=GetNext(&TAGs,elt); RemoveChListe_Ex(&TAGs,elt_old); free(elt_old); if (tag->Plc!=NULL) { tag->Plc->References--; if (tag->Plc->References<=0) { Log(LOG_DEBUG,"No more Tag on plc : %s/n",tag->Plc->PlcName); DisconnectPlc(tag->Plc); } } free(tag); continue; } } while ((elt=GetNext(&TAGs,elt))!=NULL); } } close(Server); Log(LOG_DEBUG,"Killing all connections/n"); KillConnections(); Log(LOG_DEBUG,"Closing list TAGs : %d counts/n",TAGs.Count); CloseList(&TAGs); Log(LOG_DEBUG,"Closing list PLCs : %d counts/n",PLCs.Count); CloseList(&PLCs); Log(LOG_DEBUG,"Closing list CLIENTs : %d counts/n",CLIENTs.Count); CloseList(&CLIENTs); return(0);}
开发者ID:Felipeasg,项目名称:TuxPLC,代码行数:101,
示例12: switchint RichEditBkImg::PositionItem2Value(const POSITION_ITEM &pos ,int nMin, int nMax,BOOL bX){ int nRet=0; switch(pos.pit) { case PIT_NORMAL: if(pos.cMinus == -1) nRet=nMax-(int)pos.nPos; else nRet=nMin+(int)pos.nPos; break; case PIT_PREV_NEAR: //“[”相对于前一兄弟窗口。用于X时,参考前一兄弟窗口的right,用于Y时参考前一兄弟窗口的bottom case PIT_PREV_FAR: //“{”相对于前一兄弟窗口。用于X时,参考前一兄弟窗口的left,用于Y时参考前一兄弟窗口的top { CRect rcRef; RichEditObj *pRefObj=GetPrev(); if(pRefObj) { rcRef = pRefObj->GetRect(); }else { rcRef=m_pObjectHost->GetAdjustedRect(); rcRef.right = rcRef.left; rcRef.bottom = rcRef.top; } if(bX) { LONG refPos = (pos.pit == PIT_PREV_NEAR)?rcRef.right:rcRef.left; nRet=refPos+(int)pos.nPos*pos.cMinus; }else { LONG refPos = (pos.pit == PIT_PREV_NEAR)?rcRef.bottom:rcRef.top; nRet=refPos+(int)pos.nPos*pos.cMinus; } } break; case PIT_NEXT_NEAR: //“]”相对于后一兄弟窗口。用于X时,参考后一兄弟的left,用于Y时参考后一兄弟的top case PIT_NEXT_FAR: //“}”相对于后一兄弟窗口。用于X时,参考后一兄弟的right,用于Y时参考后一兄弟的bottom { CRect rcRef; RichEditObj *pRefObj = GetNext(); if(pRefObj) { rcRef = pRefObj->GetRect(); }else { rcRef = m_pObjectHost->GetAdjustedRect(); rcRef.left = rcRef.right; rcRef.top = rcRef.bottom; } if(bX) { LONG refPos = (pos.pit == PIT_NEXT_NEAR)?rcRef.left:rcRef.right; nRet=refPos+(int)pos.nPos*pos.cMinus; }else { LONG refPos = (pos.pit == PIT_NEXT_NEAR)?rcRef.top:rcRef.bottom; nRet=refPos+(int)pos.nPos*pos.cMinus; } } break; } return nRet;}
开发者ID:435420057,项目名称:soui,代码行数:69,
示例13: UsageError const char *ExpectNext() { if (IsEmpty()) UsageError(); return GetNext(); }
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:6,
示例14: Loggerint Logger(LISTE *plcs){ int res=0,Comm_err=0,Read_Something=0; if (TEST) { ListePlc(plcs); //return(0); } int now=time(NULL); res=BuildSockets(plcs); while (!Terminated) { ELEMENT *elt=GetFirst(plcs); while (elt!=NULL) // PLCs { PLC *plc=elt->Data; /* Something to do ? */ if (plc->Next_Time>time(NULL)) { elt=GetNext(plcs,elt); continue; } /* Test Socket */ if (plc->socket<0) { if (BuildSocket(plc)<0) { Log(LOG_WARNING,"Socket unavailable for : %s/n",plc->PlcName); plc->Next_Time=now+WAIT_FOR_RECONNECT; elt=GetNext(plcs,elt); continue; } else Log(LOG_INFO,"Socket build for : %s/n",plc->PlcName); } now=time(NULL); Read_Something=0; Comm_err=1; //plc->Next_Time=now+0.95*MAX_SAMPLE/1000; plc->Next_Time=now+MAX_SAMPLE; Log(LOG_DEBUG,"Set plc->Next_Time in %d seconds (MAX_SAMPLE : %d)/n",plc->Next_Time-now,MAX_SAMPLE); /* Read Tags */ ELEMENT *elt2=GetFirst(&(plc->Tags)); while (elt2!=NULL) { TAG *tag=elt2->Data; if ((now-tag->Time_Value)>(1.5*tag->Time_Sample)) Log(LOG_WARNING,"Time Sample exceed on tag : %s (%s)/n",tag->TagName,plc->PlcName); if ((now-tag->Time_Value)>=tag->Time_Sample) { //Log(LOG_DEBUG,"Reading tag : %s (%s) (%d - %d > %d)/n",tag->TagName,plc->PlcName,now,tag->Time_Value,tag->Time_Sample); Read_Something=1; res=ReadTag(plc,tag); if (res==0) Comm_err=0; // At least one tag is Ok if (mb_errno==EPIPE) CloseSocket(plc->socket,plcs); } if ((tag->Time_Value+tag->Time_Sample)<(plc->Next_Time)) { plc->Next_Time=tag->Time_Value+tag->Time_Sample; Log(LOG_DEBUG,"plc->Next_Time in %d seconds*/n",plc->Next_Time-now); } elt2=GetNext(&(plc->Tags),elt2); } /* Read Packets */ elt2=GetFirst(&(plc->Packets)); while (elt2!=NULL) { PACKET *packet=elt2->Data; if ((now-packet->Time_Value)>(1.5*packet->Time_Sample)) Log(LOG_WARNING,"Time Sample exceed on packet : %s (%s)/n",packet->BaseAddress,plc->PlcName); if ((now-packet->Time_Value)>=packet->Time_Sample) { Read_Something=1; res=ReadPacket(plc,packet); if (res>=0) Comm_err=0; // At least one tag is Ok if (mb_errno==EPIPE) CloseSocket(plc->socket,plcs); } if ((packet->Time_Value+packet->Time_Sample)<(plc->Next_Time)) { plc->Next_Time=packet->Time_Value+packet->Time_Sample; Log(LOG_DEBUG,"plc->Next_Time in %d seconds/n",plc->Next_Time-now); } elt2=GetNext(&(plc->Packets),elt2); } /* Check Plc */ if (Comm_err && Read_Something) // All Tags & packets are in error { Log(LOG_WARNING,"All tags in error for : %s suspending for %d seconds/n",plc->PlcName,WAIT_FOR_RECONNECT); plc->Next_Time=now+WAIT_FOR_RECONNECT; } if (plc->Next_Time>0.8*(time(NULL)+MODBUS_SOCK_TIMEOUT)) { close(plc->socket); plc->socket=-1; Log(LOG_DEBUG,"Closing socket for plc : %s /n",plc->PlcName); } elt=GetNext(plcs,elt); } sleep(1); } Log(LOG_NOTICE,"Killing Connections/n"); KillAll(plcs);//.........这里部分代码省略.........
开发者ID:Felipeasg,项目名称:TuxPLC,代码行数:101,
示例15: GetMinimumLegDistancedoubleTaskLeg::ScanDistanceMin() const{ return GetMinimumLegDistance() + (GetNext() ? GetNext()->ScanDistanceMin() : 0);}
开发者ID:Advi42,项目名称:XCSoar,代码行数:6,
示例16: GetNextXMLElement XMLElement::GetNext(const String& name) const{ return GetNext(name.CString());}
开发者ID:zhzhxtrrk,项目名称:Urho3D,代码行数:4,
示例17: GetNominalLegDistancedoubleTaskLeg::ScanDistanceNominal() const{ return GetNominalLegDistance() + (GetNext() ? GetNext()->ScanDistanceNominal() : 0);}
开发者ID:Advi42,项目名称:XCSoar,代码行数:6,
示例18: clearFixturesvoid Body::clearFixtures(){ for (auto f = getBody().GetFixtureList(); f; f = f->GetNext()) { getBody().DestroyFixture(f); }}
开发者ID:vanhung1087,项目名称:avalon,代码行数:6,
示例19: CloseEth// Close Ethernet adaptervoid CloseEth(ETH *e){ // Validate arguments if (e == NULL) { return; } if (e->Tap != NULL) {#ifndef NO_VLAN FreeTap(e->Tap);#endif // NO_VLAN }#ifdef BRIDGE_PCAP { struct CAPTUREBLOCK *block; pcap_breakloop(e->Pcap); WaitThread(e->CaptureThread, INFINITE); ReleaseThread(e->CaptureThread); pcap_close(e->Pcap); while (block = GetNext(e->Queue)){ Free(block->Buf); FreeCaptureBlock(block); } ReleaseQueue(e->Queue); }#endif // BRIDGE_PCAP#ifdef BRIDGE_BPF#ifdef BRIDGE_BPF_THREAD { struct CAPTUREBLOCK *block; int fd = e->Socket; e->Socket = INVALID_SOCKET; WaitThread(e->CaptureThread, INFINITE); ReleaseThread(e->CaptureThread); e->Socket = fd; // restore to close after while (block = GetNext(e->Queue)){ Free(block->Buf); FreeCaptureBlock(block); } ReleaseQueue(e->Queue); }#else // BRIDGE_BPF_THREAD Free(e->Buffer);#endif // BRIDGE_BPF_THREAD#endif // BRIDGE_BPF ReleaseCancel(e->Cancel); Free(e->Name); Free(e->Title); // Restore MTU value EthSetMtu(e, 0); if (e->Socket != INVALID_SOCKET) {#if defined(BRIDGE_BPF) || defined(BRIDGE_PCAP) || defined(UNIX_SOLARIS) close(e->Socket);#else // BRIDGE_PCAP closesocket(e->Socket);#endif // BRIDGE_PCAP#if defined(BRIDGE_BPF) || defined(UNIX_SOLARIS) if (e->SocketBsdIf != INVALID_SOCKET) { close(e->SocketBsdIf); }#endif // BRIDGE_BPF || UNIX_SOLARIS } Free(e);}
开发者ID:455475876github,项目名称:SoftEtherVPN,代码行数:75,
示例20: ReadDataDistanceMatrix/*{{{ data*/void ReadDataDistanceMatrix(value** points, FILE* inputFile, int k) { List tempList; size_t lineSize = 0; char* lineBuff = NULL; char* temp; char delims[5] = "/t ,/n"; char* token = NULL; int num = 0; int i; int line = 0; dm = malloc(sizeof(datadistanceMatrix)); dm->data=NULL; dm->dataDist=NULL; dm->dataNum=0; dm->queries=NULL; dm->iterator=0; dm->queryDist=NULL; dm->queryNum=0; dm->qIterator=0; dm->k = k; getline(&lineBuff, &lineSize, inputFile); /*skip the first value*/ token = strtok(lineBuff, delims); InitList(&tempList, BUFFSIZE * sizeof(char), NULL, NULL,NULL); while (token != NULL) { token = strtok(NULL, delims); if (token == NULL) break; temp = malloc((LABELSIZE + 1) * sizeof(char)); memcpy(temp, token, strlen(token)); temp[strlen(token)] = '/0'; InsertValueList(tempList, temp); num++; free(temp); } SetDataSize(num); *points = malloc(num*sizeof(value)); value* newData = *points; char* tempVal = GetFirst(tempList); for (i = 0; i < num; i++) { newData[i].name = malloc(LABELSIZE * sizeof(char)); memset(newData[i].name,'/0',LABELSIZE); if(tempVal ==NULL) continue; strcpy(newData[i].name, tempVal); tempVal=GetNext(tempList); } dm->dataDist = malloc(num * sizeof(double*)); while (getline(&lineBuff, &lineSize, inputFile) != -1) { dm->dataDist[line] = malloc(num * sizeof(double)); newData[line].content=malloc(sizeof(int)); memcpy(newData[line].content,&line,sizeof(int)); token = strtok(lineBuff, delims); if (token == NULL) break; for (i = 0; i < num; i++) { dm->dataDist[line][i] = atoi(token); token = strtok(NULL, delims); } line++; } dm->dataNum=line; data.tableSize = dm->dataNum; DestroyList(&tempList); free(lineBuff);}
开发者ID:sergafts,项目名称:softdevalg,代码行数:81,
示例21: assert// ATTENTION, aend timePosition!void NEPointerList::setSpacing(const TYPE_TIMEPOSITION & timePosition, NVPoint& position){ // this is obolete! assert(false);#ifdef BALBAL if (empty()) return; assert(!empty()); GRNotationElement * criticalElement = 0; NEPointerList * list= this; // getElementsWithTimePosition(timePosition); // think about it. TYPE_TIMEPOSITION nextTimePosition (getNextTimePosition(timePosition)); TYPE_SPACING spacing = 0; if(!list->empty()) { NEPointerList* shortyList=list->getElementsWithShortestDuration(); criticalElement=shortyList->getElementWithMaxSpacing(); float criticalElementSize=criticalElement->getBoundingBox().right; assert(criticalElementSize>=0); // get size of real element if(criticalElement->getRelativeEndTimePosition()>nextTimePosition) // is there an Overlap? { criticalElement = new GRSingleNote(nextTimePosition-timePosition); // Dummy element for spacing calculation // I Believe abstractRepresentation will not be created? delete criticalElement; } else { } GuidoPos pos = GetHeadPosition(); GRNotationElement * e; float min = 0; while (pos) { e = GetNext(pos); if (e->getRelativeTimePosition()==timePosition && e->getBoundingBox().left<min) min = e->getBoundingBox().left; } pos = GetHeadPosition(); while(pos) { e = GetNext(pos); if (tmp) { tmp->setHPosition(position.x-min); } else { } } position.x += spacing+criticalElementSize; position.x -= min; delete shortyList; } else { criticalElement = new GRSingleNote(nextTimePosition-timePosition); // special Dummy-Object?? delete criticalElement; GRNotationElement * e; GuidoPos pos=GetHeadPosition(); while(pos) { e=GetNext(pos); } position.x += spacing; }#endif}
开发者ID:EQ4,项目名称:guido-engine,代码行数:74,
示例22: RouteTrackingStop//.........这里部分代码省略......... DeleteRouteEntry(t->RouteToServer); } DeleteRouteEntry(t->RouteToDefaultDns); DeleteRouteEntry(t->RouteToNatTServer); DeleteRouteEntry(t->RouteToRealServerGlobal); } FreeRouteEntry(t->RouteToDefaultDns); FreeRouteEntry(t->RouteToServer); FreeRouteEntry(t->RouteToEight); FreeRouteEntry(t->RouteToNatTServer); FreeRouteEntry(t->RouteToRealServerGlobal); t->RouteToDefaultDns = t->RouteToServer = t->RouteToEight = t->RouteToNatTServer = t->RouteToRealServerGlobal = NULL; if (s->Cedar->Client != NULL && s->Account != NULL) { Unlock(s->Account->lock); }#if 0 // Get the current DNS server if (GetDefaultDns(&dns_ip)) { if (IPToUINT(&t->OldDnsServer) != 0) { if (IPToUINT(&t->OldDnsServer) != IPToUINT(&dns_ip)) { char s1[MAX_SIZE], s2[MAX_SIZE]; network_has_changed = true; IPToStr(s1, sizeof(s1), &t->OldDnsServer); IPToStr(s2, sizeof(s2), &dns_ip); Debug("Old Dns: %s, New Dns: %s/n", s1, s2); } } } if (network_has_changed == false) { Debug("Network: not changed./n"); } else { Debug("Network: Changed./n"); }#endif // Get the current routing table table = GetRouteTable(); // Restore the routing table which has been removed so far while (e = GetNext(t->DeletedDefaultGateway)) { bool restore = true; UINT i; // If the restoring routing entry is a default gateway and // the existing routing table contains another default gateway // on the interface, give up restoring the entry if (IPToUINT(&e->DestIP) == 0 && IPToUINT(&e->DestMask) == 0) { for (i = 0;i < table->NumEntry;i++) { ROUTE_ENTRY *r = table->Entry[i]; if (IPToUINT(&r->DestIP) == 0 && IPToUINT(&r->DestMask) == 0) { if (r->InterfaceID == e->InterfaceID) { restore = false; } } } if (network_has_changed) { restore = false; } } if (restore) { // Routing table restoration AddRouteEntry(e); } // Memory release FreeRouteEntry(e); } // Release FreeRouteTable(table); ReleaseQueue(t->DeletedDefaultGateway); FreeRouteChange(t->RouteChange); Free(t);}
开发者ID:m-a-n-a-v,项目名称:SoftEtherVPN_Stable,代码行数:101,
示例23: GetNextCLibraryFile* CLibraryList::GetNextFile(POSITION& pos) const{ return Library.LookupFile( GetNext( pos ) );}
开发者ID:ericfillipe1,项目名称:shareaza-code,代码行数:4,
示例24: GetMinimumLegDistancefixed TaskLeg::ScanDistanceMin() const{ return GetMinimumLegDistance() + (GetNext() ? GetNext()->ScanDistanceMin() : fixed(0));}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:6,
示例25: binMalieExec::MalieExec(char *lpFileName){ execstream bin(lpFileName); DWORD dwCnt = bin.readdw(); for (;dwCnt;--dwCnt)//skip var { DWORD szLen = bin.readdw(); bin.seek(szLen&0x7FFFFFFF,FILE_CURRENT); GetNext(&bin); bin.seek(sizeof(DWORD)*4,FILE_CURRENT); } //至于这里为啥要跳过一个DW我也忘了、最初的解析里面没有写 // [7/20/2013 Azure] bin.seek(sizeof(DWORD),FILE_CURRENT);//skip 0x3130 dwCnt = 0x5F4 ////////////////////////////////////////////////////////////////////////// // Function parse block dwCnt = bin.readdw();// freopen("functionList.txt","wt,ccs=UNICODE",stdout); for (;dwCnt;--dwCnt)//skip function { DWORD szLen;char temp[1000];DWORD ch[3]; VM_FUNCTION func; szLen = bin.readdw(); bin.read(temp,(szLen&0x7FFFFFFF)); bin.read(ch,3*sizeof(DWORD)); func.dwID = ch[0]; func.wstrName = (WCHAR *)temp; func.dwVMCodeOffset = ch[2]; func.dwReserved0 = ch[1]; funcList[func.wstrName] = func; vecFuncList.push_back(func);// wprintf(L"%d,%ls,%d,0x%.4X/n",ch[0],temp,ch[1],ch[2]); } fprintf(stderr,"VM_FUNCTION:%d/n",funcList.size()); ////////////////////////////////////////////////////////////////////////// // Label parse block dwCnt = bin.readdw(); for (;dwCnt;--dwCnt)//skip label { DWORD szLen;char temp[1000];DWORD ch; MALIE_LABEL label; szLen = bin.readdw(); bin.read(temp,(szLen&0x7FFFFFFF)); ch = bin.readdw(); label.wstrName = (WCHAR *)temp; label.dwVMCodeOffset = ch; labelList[label.wstrName] = label; } fprintf(stderr,"LABEL:%d/n",labelList.size()); ////////////////////////////////////////////////////////////////////////// // VM_DATA : just read to new area szVM_DATA = bin.readdw(); //dump original scene pVM_DATA = new unsigned char[szVM_DATA]; bin.read(pVM_DATA,szVM_DATA); fprintf(stderr,"VM_DATA size: %8X/n",szVM_DATA); ////////////////////////////////////////////////////////////////////////// // VM_CODE : just read to new area szVM_CODE = bin.readdw(); pVM_CODE = new unsigned char [szVM_CODE]; bin.read(pVM_CODE,szVM_CODE); fprintf(stderr,"VM_CODE size: %8X/n",szVM_CODE);// fprintf(stderr,"system_onInit:0x%X/n",func_List.find(L"system_onInit")->second.dwVMCodeOffset); ////////////////////////////////////////////////////////////////////////// // strTable DWORD unkSize = bin.readdw(); if (unkSize*8 >bin.GetFileSize()-bin.seek(0,FILE_CURRENT)) { szStrTable = unkSize;//ziped crypted pStrTable = new unsigned char[unkSize]; bin.read(pStrTable,szStrTable); cntStrIndex = bin.readdw(); vStrIndex.reserve(cntStrIndex/2+1); DWORD offset = bin.readdw(); for (size_t idx = 1;idx<cntStrIndex;++idx) { DWORD tmpOffset = bin.readdw(); vStrIndex.push_back(STRING_INFO(offset,tmpOffset-offset)); offset = tmpOffset; } } else { cntStrIndex = unkSize;//normal vStrIndex.resize(cntStrIndex); bin.read(&vStrIndex[0],cntStrIndex*sizeof(STRING_INFO)); szStrTable = bin.readdw();//.........这里部分代码省略.........
开发者ID:regomne,项目名称:chinesize,代码行数:101,
示例26: GetNominalLegDistancefixed TaskLeg::ScanDistanceNominal() const{ return GetNominalLegDistance() + (GetNext() ? GetNext()->ScanDistanceNominal() : fixed(0));}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:6,
示例27: whileBOOL CRKey::EncodeUrl(CPipe *pPipe, DWORD dwEncoding, char chSepNameVal, char chSepValues){_STTEX(); // Add each value TMem< char > buf; LPREGVALUE prv = NULL; while ( ( prv = (LPREGVALUE)GetNext( prv ) ) != NULL ) { // Write separator if needed if ( pPipe->GetBufferSize() ) pPipe->Write( &chSepValues, 1 ); switch( dwEncoding ) { case 0 : { // Write the key pPipe->Write( prv->cpkey, prv->ksize ); // Separator pPipe->Write( &chSepNameVal, 1 ); // Write raw value if ( REG_BINARY == prv->type ) pPipe->Write( prv->pbdata, prv->size ); else pPipe->Write( GetSz( prv ) ); } break; case 1 : { // Write the name if ( buf.grow( CCfgFile::GetMinCanonicalizeBufferSize( strlen( prv->cpkey ) ) ) ) { buf.Zero(); CCfgFile::CanonicalizeBuffer( buf, prv->bpkey, strlen( prv->cpkey ) ); pPipe->Write( buf ); } // end if // Separator pPipe->Write( &chSepNameVal, 1 ); // Write binary buffers if ( REG_BINARY == prv->type ) { // Binary encoding if ( buf.grow( CCfgFile::GetMinCanonicalizeBufferSize( prv->size ) ) ) { buf.Zero(); CCfgFile::CanonicalizeBuffer( buf, prv->pbdata, prv->size ); pPipe->Write( buf ); } // end if } // end if else { // Write the name LPCTSTR val = GetSz( prv ); if ( buf.grow( CCfgFile::GetMinCanonicalizeBufferSize( strlen( val ) ) ) ) { buf.Zero(); CCfgFile::CanonicalizeBuffer( buf, (LPBYTE)val, strlen( val ) ); pPipe->Write( buf ); } // end if } // end if } break; case 2 : { TMem< char > buf2; // Write the name if ( buf.grow( CCfgFile::GetMinCanonicalizeBufferSize( strlen( prv->cpkey ) ) ) ) { buf.Zero(); CCfgFile::CanonicalizeBuffer( buf, prv->bpkey, strlen( prv->cpkey ) ); pPipe->Write( buf ); } // end if // Separator pPipe->Write( &chSepNameVal, 1 ); // Write binary buffers if ( REG_BINARY == prv->type ) { // Binary encoding if ( buf.grow( CCfgFile::GetMinCanonicalizeBufferSize( prv->size ) ) ) { buf.Zero(); CCfgFile::CanonicalizeBuffer( buf, prv->pbdata, prv->size ); } // end if } // end if else { // Write the name LPCTSTR val = GetSz( prv ); if ( buf.grow( CCfgFile::GetMinCanonicalizeBufferSize( strlen( val ) ) ) ) { buf.Zero(); CCfgFile::CanonicalizeBuffer( buf, (LPBYTE)val, strlen( val ) ); } // end if } // end if//.........这里部分代码省略.........
开发者ID:aminsyed,项目名称:rulib,代码行数:101,
示例28: GetNextCChatSession* CChatCore::FindSession(CEDClient* pClient){ CChatSession* pSession; for ( POSITION pos = GetIterator() ; pos ; ) { pSession = GetNext( pos ); // If we already have a session if ( ( ( ! pSession->m_bGUID ) || ( pSession->m_pGUID == pClient->m_pGUID ) ) && ( pSession->m_pHost.sin_addr.S_un.S_addr == pClient->m_pHost.sin_addr.S_un.S_addr ) && ( pSession->m_nProtocol == PROTOCOL_ED2K ) ) { // Update details pSession->m_bGUID = pClient->m_bGUID; pSession->m_pGUID = pClient->m_pGUID; pSession->m_pHost = pClient->m_pHost; pSession->m_sAddress = pClient->m_sAddress; pSession->m_sUserNick = pClient->m_sNick; pSession->m_sUserAgent = pClient->m_sUserAgent; pSession->m_bUnicode = pClient->m_bEmUnicode; pSession->m_nClientID = pClient->m_nClientID; pSession->m_pServer = pClient->m_pServer; pSession->m_bMustPush = ( ( pClient->m_nClientID > 0 ) && ( pClient->m_nClientID < 16777216 ) ); // return existing session return pSession; } } // Create a new chat session pSession = new CChatSession(); pSession->m_nProtocol = PROTOCOL_ED2K; pSession->m_hSocket = INVALID_SOCKET; // Should always remain invalid- has no real connection pSession->m_nState = cssActive; pSession->m_bConnected = TRUE; pSession->m_tConnected = GetTickCount(); // Set details pSession->m_bGUID = pClient->m_bGUID; pSession->m_pGUID = pClient->m_pGUID; pSession->m_pHost = pClient->m_pHost; pSession->m_sAddress = pClient->m_sAddress; pSession->m_sUserNick = pClient->m_sNick; pSession->m_sUserAgent = pClient->m_sUserAgent; pSession->m_bUnicode = pClient->m_bEmUnicode; pSession->m_nClientID = pClient->m_nClientID; pSession->m_pServer = pClient->m_pServer; pSession->m_bMustPush = ( ( pClient->m_nClientID > 0 ) && ( pClient->m_nClientID < 16777216 ) ); // Make new input and output buffer objects DWORD nLimit = 0; pSession->m_pInput = new CBuffer( &nLimit ); pSession->m_pOutput = new CBuffer( &nLimit ); Add( pSession ); return pSession;}
开发者ID:ericfillipe1,项目名称:shareaza-code,代码行数:62,
注:本文中的GetNext函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetNextAttackDelay函数代码示例 C++ GetNetwork函数代码示例 |