• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ destroyList函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中destroyList函数的典型用法代码示例。如果您正苦于以下问题:C++ destroyList函数的具体用法?C++ destroyList怎么用?C++ destroyList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了destroyList函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: destroyList

void destroyList(Node * head)
{
    Node * n = head->next;
    
    free(head);
    
    if(n != NULL)
        destroyList(n);
}
开发者ID:grohj,项目名称:fit-cvut,代码行数:9,代码来源:main.c


示例2: main

int main(int argc, char** argv)
{
    switch(argc) {
    case 5:
        LIST_LEN = (1<<atoi(argv[4]));
    case 4:
        TOTAL_LISTS = (1<<atoi(argv[3]));
	case 3:
		REPEAT_TIMES = atoi(argv[2]);
	case 2:
		TOGETHER_NUM = atoi(argv[1]);
        break;
    default:
        break;
    }
	int syscpu = sysconf(_SC_NPROCESSORS_CONF);
	int processorid = 0;
	cpu_set_t mask;
	CPU_ZERO(&mask);
	CPU_SET(processorid, &mask);
	if (sched_setaffinity(0, sizeof(mask), &mask) == -1) {
		std::cerr << "could not set CPU affinity in main thread " << std::endl;
	}
#ifdef USING_MALLOC
    head = (List**)malloc(TOTAL_LISTS*sizeof(List*));
    allList = (List**)malloc(TOTAL_LISTS*sizeof(List*));
	listsLen = (int*)malloc(TOTAL_LISTS*sizeof(int));
	listNumber = (int*)malloc(TOTAL_LISTS*sizeof(int));
#else
    head = new List*[TOTAL_LISTS];
    allList = new List*[TOTAL_LISTS];
	listsLen = new int[TOTAL_LISTS];
	listNumber = new int[TOTAL_LISTS];
#endif
	gettimeofday(&start, NULL);
	buildList();
	gettimeofday(&end, NULL);
	double duration = (end.tv_sec-start.tv_sec) + (end.tv_usec-start.tv_usec)/1000000.0;
	std::cerr << "build duration = " << duration << std::endl;
	gettimeofday(&start, NULL);
	int loopNum = TOTAL_LISTS/TOGETHER_NUM;
	if (TOTAL_LISTS%TOGETHER_NUM != 0) {
		loopNum++;
	}
	for (int i = 0; i < loopNum; i++) {
		tracingTask(i);
	}
	gettimeofday(&end, NULL);
	duration = (end.tv_sec-start.tv_sec) + (end.tv_usec-start.tv_usec)/1000000.0;
	std::cout << "traverse duration " << duration << " s" << std::endl;
	std::cerr << "traverse duration " << duration << " s accum " << total_accum << " traverse " << tra_times << std::endl;

	destroyList();

	return 0;
}
开发者ID:SamDivine,项目名称:accirr,代码行数:56,代码来源:multiref_compiler.cpp


示例3: destroyList

void MIDIOut::rescanDevices()
{
    /* Treat all devices nonexistent and doomed for destruction */
    QList <MIDIDevice*> destroyList(m_devices);

    /* Find out which devices are still present */
    for (ItemCount i = 0; i < MIDIGetNumberOfDevices(); i++)
    {
        MIDIDeviceRef dev = MIDIGetDevice(i);
        for (ItemCount j = 0; j < MIDIDeviceGetNumberOfEntities(dev); j++)
        {
            MIDIEntityRef entity = MIDIDeviceGetEntity(dev, j);
            OSStatus s = 0;
            SInt32 uid = 0;

            /* Check if the entity is able to send data */
            if (MIDIEntityGetNumberOfDestinations(entity) == 0)
                continue;

            /* Extract UID from the entity */
            s = MIDIObjectGetIntegerProperty(entity, kMIDIPropertyUniqueID, &uid);
            if (s != 0)
            {
                qWarning() << "Unable to get entity UID";
                continue;
            }

            MIDIDevice* dev(deviceByUID(uid));
            if (dev != NULL)
            {
                /* Device still exists */
                destroyList.removeAll(dev);
            }
            else
            {
                /* New device */
                dev = new MIDIDevice(this, entity);
                Q_ASSERT(dev != NULL);
                if (dev->extractUID() == true &&
                        dev->extractName() == true)
                {
                    addDevice(dev);
                }
                else
                {
                    delete dev;
                    dev = NULL;
                }
            }
        }
    }

    /* Destroy all devices that were no longer present */
    while (destroyList.isEmpty() == false)
        delete destroyList.takeFirst();
}
开发者ID:alexpaulzor,项目名称:qlc,代码行数:56,代码来源:midiout.cpp


示例4: destroyList

int destroyList( listOfPaths_t* list)
{
	if (list != NULL)
	{
		if (list->next != NULL) destroyList(list->next);
		free(list->path);
		free(list);
	}
	return 1;
}
开发者ID:hbredin,项目名称:pinocchIO,代码行数:10,代码来源:structure_utils.c


示例5: searchExactManyCoresK

// Exact k-NN search with the RBC.  This version works better on computers
// with a high core count (say > 4)
void searchExactManyCoresK(matrix q, matrix x, matrix r, rep *ri, unint **NNs, real **dNNs, unint K){
  unint i, j, k;
  unint **repID = (unint**)calloc(q.pr, sizeof(*repID));
  for(i=0; i<q.pr; i++)
    repID[i] = (unint*)calloc(K, sizeof(**repID));
  real **dToReps = (real**)calloc(q.pr, sizeof(*dToReps));
  for(i=0; i<q.pr; i++)
    dToReps[i] = (real*)calloc(K, sizeof(**dToReps));
  intList *toSearch = (intList*)calloc(r.pr, sizeof(*toSearch));
  for(i=0;i<r.pr;i++)
    createList(&toSearch[i]);
  
  bruteKHeap(r,q,repID,dToReps,K);

#pragma omp parallel for private(j,k)
  for(i=0; i<r.pr/CL; i++){
    unint row = CL*i;
    real temp[CL];
    
    for(j=0; j<q.r; j++ ){
      for(k=0; k<CL; k++){
	temp[k] = distVec( q, r, j, row+k );
      }
      for(k=0; k<CL; k++){
	//dToRep[j] is current UB on dist to j's NN
	//temp - ri[i].radius is LB to dist belonging to rep i
	if( row+k<r.r && 3.0*dToReps[j][K-1] >= temp[k] && dToReps[j][K-1] >= temp[k] - ri[row+k].radius) 
	  addToList(&toSearch[row+k], j); //query j needs to search rep 
      }
    }
    for(j=0;j<CL;j++){
      if(row+j<r.r){
	while(toSearch[row+j].len % CL != 0)
	  addToList(&toSearch[row+j],DUMMY_IDX);	
      }
    }
  }

  bruteListK(x,q,ri,toSearch,r.r,NNs,dToReps,K);
  
  for(i=0; i<q.r; i++){
    for(j=0; j<K; j++)
      dNNs[i][j]=dToReps[i][j];
  }

  for(i=0;i<q.pr;i++)
    free(dToReps[i]);
  free(dToReps);
  for(i=0;i<r.pr;i++)
    destroyList(&toSearch[i]);
  free(toSearch);
  for(i=0;i<q.pr;i++)
    free(repID[i]);
  free(repID);
}
开发者ID:sourekj,项目名称:Packages,代码行数:57,代码来源:rbc.cpp


示例6: main

int main()
{
    int a = 0;
    int b = 0;
    int tmp = 0;
    List* listLess = createList();
    List* listBetween = createList();
    List* listMore = createList();

    printf("Enter a\n");
    scanf("%d",&a);
    printf("Enter b \n");
    scanf("%d",&b);

    FILE* f = fopen("input.txt","r");
    FILE* g = fopen("output.txt","w");

    while (!(feof(f)))
    {
        fscanf(f,"%d",&tmp);
        if (tmp < a)
            add(listLess,tmp);
        if ((a <= tmp) && (tmp <= b))
            add(listBetween,tmp);
        if (tmp >= b)
            add(listMore,tmp);
    }

    printListToFile(listLess,g);
    fprintf(g," | ");
    printListToFile(listBetween,g);
    fprintf(g," | ");
    printListToFile(listMore,g);

    destroyList(listLess);
    destroyList(listBetween);
    destroyList(listMore);
    fclose(f);
    fclose(g);
    printf("See output file\n");
    getc(stdin);
}
开发者ID:vlad24,项目名称:FIRST-SEMESTER,代码行数:42,代码来源:parts+main.cpp


示例7: applyChanges

void applyChanges(int *board,int w)
{
    Node *information;
    int i;
    for(i=1;i<=statusList.size;i++)
    {
        information=searchByPos(&statusList,i);
        board[information->data->i*w+information->data->j]=information->data->status;
    }
    destroyList(&statusList);
}
开发者ID:JuanCrg90,项目名称:Conway-s-Game-of-Life-,代码行数:11,代码来源:Conway.c


示例8: destroyList

//Completely free a list
void destroyList(VyNode* node, int destroyData)
{
	//Make sure a node is declared
	if(node == NULL)
	  return;
	//Destroy the data
	if(node->data != NULL && destroyData)
	  free(node->data);
	//Recursilvy call this function
	destroyList(node->nextNode,destroyData);
}
开发者ID:mueschm,项目名称:Vyper,代码行数:12,代码来源:VyLink.c


示例9: destroyList

typename Particles<ParticleTraits>::Size_t
Particles<ParticleTraits>::deferredDestroyAmount(PatchID_t pid) const
{
  Size_t retval = 0;

  // Add in all relevant sizes

  if (pid < 0)
    {
      PatchID_t i, npatch = attributeLayout_m.sizeLocal();
      for (i = 0; i < npatch; ++i)
	retval += destroyList(i).domain().size();
    }
  else
    {
      retval = destroyList(pid).domain().size();
    }

  return retval;
}
开发者ID:pathscale,项目名称:freepooma-testsuite,代码行数:20,代码来源:Particles.cpp


示例10: destroyList

void TdmCurrentState::createSkillList(void){
    //Очистить список
    destroyList(skillList, etSKILL);
    skillMap.clear();
    skillList = TSkill::getAll();
    //Создать индексированный список
    for(int i=0; i < skillList->Count; i++){
        TSkill *current = (TSkill*)skillList->Items[i];
        skillMap[current->getId()] = current;
        }
}
开发者ID:agoffer,项目名称:secretary,代码行数:11,代码来源:currentStateDM.cpp


示例11: ddcSeaStatsShowTimeDiff

void ddcSeaStatsShowTimeDiff(){
  Node* node = timeList;
  while(node != NULL){
    TimeDiff* diff = (TimeDiff*)(node->data);
    fprintf(stderr,",%lu", (unsigned long)(diff->end.tv_usec - diff->start.tv_usec));
    node = node->next;
  }
  fprintf(stderr, "\n");

  destroyList(timeList);
}
开发者ID:mkfifo,项目名称:ddc,代码行数:11,代码来源:Stats.c


示例12: destroyChnTbl

/*------------------------------------------------------------------------------
 *name:         destroyChnTbl()
 *arguments:    ChnTbl *chntbl
 *return:       void
 *exception:
 *functions:    销毁哈希链表
 *----------------------------------------------------------------------------*/
void destroyChnTbl(ChnTbl *chntbl)
{
	for (int i = 0; i < chntbl->key_num; ++i)
	{
		destroyList(&chntbl->key_lists[i]);
	}

	free(chntbl->key_lists);

	memset(chntbl, 0, sizeof(ChnTbl));
}
开发者ID:CubeSugar,项目名称:Algorithms_with_C_myself,代码行数:18,代码来源:hash_chn_tbl.c


示例13: main

int main(int argc, char** argv)
{
    switch(argc) {
    case 5:
        LIST_LEN = (1<<atoi(argv[4]));
    case 4:
        TOTAL_LISTS = (1<<atoi(argv[3]));
	case 3:
		REPEAT_TIMES = atoi(argv[2]);
	case 2:
		CORO_NUM = atoi(argv[1]);
        break;
    default:
        break;
    }
	int syscpu = sysconf(_SC_NPROCESSORS_CONF);
	int quarterCore = syscpu/4;
	int bindid = quarterCore;
	//bindProc(bindid);
	bindProc(0);
#ifdef USING_MALLOC
    head = (List**)malloc(TOTAL_LISTS*sizeof(List*));
    allList = (List**)malloc(TOTAL_LISTS*sizeof(List*));
	listsLen = (int*)malloc(TOTAL_LISTS*sizeof(int));
	listNumber = (int*)malloc(TOTAL_LISTS*sizeof(int));
#else
    head = new List*[TOTAL_LISTS];
    allList = new List*[TOTAL_LISTS];
	listsLen = new int[TOTAL_LISTS];
	listNumber = new int[TOTAL_LISTS];
#endif
	gettimeofday(&start, NULL);
	buildList();
	gettimeofday(&end, NULL);
	double duration = (end.tv_sec-start.tv_sec) + (end.tv_usec-start.tv_usec)/1000000.0;
	std::cerr << "build duration = " << duration << std::endl;
	//bindProc(0);
	AccirrInit(&argc, &argv);
	for (intptr_t i = 0; i < CORO_NUM; i++) {
		createTask(tracingTask, (void*)i);
	}
	gettimeofday(&start, NULL);
	AccirrRun();
	AccirrFinalize();
	gettimeofday(&end, NULL);
	duration = (end.tv_sec-start.tv_sec) + (end.tv_usec-start.tv_usec)/1000000.0;
	std::cout << "traverse duration " << duration << " s accum " << total_accum << " traverse " << tra_times << std::endl;
	std::cerr << "traverse duration " << duration << " s accum " << total_accum << " traverse " << tra_times << std::endl;

	destroyList();

	return 0;
}
开发者ID:SamDivine,项目名称:accirr,代码行数:53,代码来源:newnodepttest.cpp


示例14: destroyList

/*7*/void freeData(hashTable arrayHash[])
{
	int i;

	for(i=0;i<MAX;i++){
		if(arrayHash[i].elemStatus == 1){
			if(arrayHash[i].collision != NULL){
				destroyList(arrayHash[i].collision);
			}
			free(arrayHash[i].word);
		}
	}
}//end freeData
开发者ID:evanyc15,项目名称:School_Programming,代码行数:13,代码来源:LAB3.c


示例15: freeValueMemory

void freeValueMemory(void *value)
{
	/* check to see if the value was ever set */
	if(value == NULL)
	{
        return;
	}
	/* else, free the linked list */
	else
	{
        destroyList((linkedList_t *) value);
	}
}
开发者ID:chloe747,项目名称:AA_Assignment_1,代码行数:13,代码来源:binaryTree.c


示例16: main

int main()
{
	int ret = 0;
	Node *head = NULL;
	ret = createList(&head);
	ret = printList(head);
	ret = reverseList(head);
	ret = printList(head);
	ret = destroyList(head);
	system("pause");

	return ret;
}
开发者ID:xsun89,项目名称:CZBKStudy,代码行数:13,代码来源:Source.c


示例17: main

int main(int argc, char** argv) {

    Node * head;
    int j;
    Node* tail;
    Node * n;
    int i;Node * s;
    
    head = createNode(0);
    tail = head;
    
    
    for(i = 1; i < 20; i++)
    {
        n = createNode (i);
        tail = appendEnd(tail, n);
        
    }
    
    
    
    for (j = 0; j < 20; j+= 2)
    {
        s = search(head,j);
        
        deleteNode(&head, s);
    }
    
    
    
     for(i = 20; i < 30; i++)
    {
        n = createNode (i);
        tail = appendEnd(tail, n);
        
    }
    for (j = 0; j < 40; j+= 2)
    {
        s = search(head,j);
        if( s != NULL)
        deleteNode(&head, s);
    }
    
   
    
    printList(head);
    
    destroyList(head);
    
    return (0);
}
开发者ID:grohj,项目名称:fit-cvut,代码行数:51,代码来源:main.c


示例18: getDeclinaisons

static int			getDeclinaisons(t_product *product)
{
  char			request[1024];
  t_list		*ret;
  t_list		*tmp;
  t_list		*start;

  start = NULL;
  product->declinaisons = NULL;
  snprintf(request, 1024,
  	   "SELECT "\
	   "Nom, Attribut, Attribut2, CouleurPrimaire, DeclinaisonStock, DeclinaisonPrixTTC, " \
	   "DeclinaisonPrixHT, DeclinaisonReference "\
	   "FROM declinaisons WHERE LOWER(DeclinaisonReference) LIKE '%s%%';", product->id);
  setScript(request);
  if ((ret = execRequest()) && (tmp = ret) && (ret = ret->next) && ret->content)
    {
      while (ret && ret->content)
	{
	  t_declinaison *current;

	  printf("RET : '%s'\n", ret->content);
	  
	  if (!(current = malloc(sizeof(t_declinaison))))
	    {
	      perror("malloc");
	      exit(FAILURE);
	    }
	  setRequestResult(ret->content);
	  getNextResultValue(&current->Nom);
	  getNextResultValue(&current->Attribut);
	  getNextResultValue(&current->Attribut2);
	  getNextResultValue(&current->CouleurPrimaire);
	  getNextResultValue(&current->DeclinaisonStock);
	  getNextResultValue(&current->DeclinaisonPrixTTC);
	  getNextResultValue(&current->DeclinaisonPrixHT);
	  getNextResultValue(&current->DeclinaisonReference);
	  setRequestResult(NULL);
	  
	  product->declinaisons = addToList(product->declinaisons, current);
	  if (!start)
	    start = product->declinaisons;

	  ret = ret->next;
	}
      product->declinaisons = start;
      destroyList(tmp, TRUE);
      return 0;
    }
  return FAILURE;
}
开发者ID:Lunacie,项目名称:dumboServer,代码行数:51,代码来源:product.c


示例19: quit

// Call this instead of exit(), so we can clean up SDL
static void
quit(int rc) {

    printf("Cleanup\n");

    ListElement *el;
    
    for(el = texturesList->first; el != NULL; el=el->next) {
      printf("Destroy texture\n");
      SDL_DestroyTexture((SDL_Texture *)el->data);
    }
    destroyList(texturesList);

    for(el = musicList->first; el != NULL; el=el->next) {
      printf("Destroy music\n");
      Mix_FreeMusic((Mix_Music *)el->data);
    }
    destroyList(musicList);

    for(el = fontList->first; el != NULL; el=el->next) {
      printf("Destroy font\n");
      TTF_CloseFont((TTF_Font *)el->data);
    }
    destroyList(fontList);

    if(renderer) {
        SDL_DestroyRenderer(renderer);
        //printf("%s\n", SDL_GetError());
    }
    if(window) {
        SDL_DestroyWindow(window);
        //printf("%s\n", SDL_GetError());
    }
    Mix_CloseAudio();
    SDL_Quit();
    printf("Bye!\n");
    exit(0);
}
开发者ID:batiste,项目名称:sdl2-game-loop,代码行数:39,代码来源:common.c


示例20: test_peekTail

static void test_peekTail(void **state)
{
    const int a = 1001;
    LinkedList *list = createList();
    assert_non_null(list);
    for (int i = 0; i < a; i++)
    {
        int *c = malloc(sizeof(int));
        *c = i;
        insertTop(list, c);
        assert_int_equal(*(int*)peekTail(list), 0);
    }
    destroyList(list);
}
开发者ID:jradtilbrook,项目名称:linkedlist,代码行数:14,代码来源:unittests.c



注:本文中的destroyList函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ destroyPQExpBuffer函数代码示例发布时间:2022-05-30
下一篇:
C++ destroy函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap