当前位置: 首页>>代码示例>>C++>>正文


C++ destroyList函数代码示例

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


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


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