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


C++ ListInit函数代码示例

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


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

示例1: RequestInit

void
RequestInit(TSession * const sessionP,
            TConn *    const connectionP) {

    time_t nowtime;

    sessionP->validRequest = false;  /* Don't have valid request yet */

    time(&nowtime);
    sessionP->date = *gmtime(&nowtime);

    sessionP->conn = connectionP;

    sessionP->responseStarted = FALSE;

    sessionP->chunkedwrite = FALSE;
    sessionP->chunkedwritemode = FALSE;

    ListInit(&sessionP->cookies);
    ListInit(&sessionP->ranges);
    TableInit(&sessionP->request_headers);
    TableInit(&sessionP->response_headers);

    sessionP->status = 0;  /* No status from handler yet */

    StringAlloc(&(sessionP->header));
}
开发者ID:4N7HR4X,项目名称:kamailio,代码行数:27,代码来源:abyss_http.c

示例2: InitParkingLot

ParkingLot * InitParkingLot( FILE * mapconfig, int col, int row, int floors, int accesses )
{
    char *** matrix;
    int *vertices, *ramps;
    ParkingLot * parkinglot;

    vertices = (int*)malloc(sizeof(int));
    VerifyMalloc( (Item) vertices );

    ramps = (int*)malloc(sizeof(int));
    VerifyMalloc( (Item) ramps );

    parkinglot = (ParkingLot*) malloc( sizeof(ParkingLot) );
    VerifyMalloc((Item) parkinglot);
    parkinglot->freespots = 0;
    matrix = MatrixInit(vertices, ramps, mapconfig, col, row, floors); /*Creates string cointaining the map - its a 3d string */
    parkinglot->graphdecoder = GraphDecoderInit(matrix, col, row, floors, *vertices, &(parkinglot->freespots) ); /*Creates array cointaining the Decoder for the graph positions*/
    parkinglot->g = GraphInit(*vertices, matrix, parkinglot->graphdecoder, col, row);
    parkinglot->accesseshead = InitAccesses(accesses, parkinglot->graphdecoder, *vertices);
    parkinglot->parkedcarshead = ListInit();
    parkinglot->queuehead = ListInit();

    /**PrintGraph(GetGraph(parkinglot), *vertices); */ /*prints the graph in the parkinglot */
    FreeMatrix(matrix, col, row);
    free(vertices);
    free(ramps);

    return (parkinglot);
}
开发者ID:jsmvalente,项目名称:projectoaed,代码行数:29,代码来源:ParkingLot.c

示例3: ParseBuildList

List* ParseBuildList(char* s, Err* err){
    List* L=NULL,*Lold=NULL;
    int i=0,iold=0; Str* S=NULL; Err* err2=ErrInit();
    i=0;
    while ((s!=NULL)&&(i<strlen(s))){
        iold=i;
        
        S=ParseLex(s, err,&i);
         
        if (S==NULL && i<strlen(s)){
            err->pres=err2->pres;
            err->err=err2->err;
            myfree(err2);
            return NULL;
        }
        if (S==NULL && i>=strlen(s)){
            break;
        }

        i=i;
        
        if (L==NULL) { L=ListInit(); Lold=L;}
        else { L->next=NULL; L->next=ListInit(); L=L->next;}
        ListPutDataStr(L,S->s);
        StrFree(S);
        /*printf("%s\n",S->s);*/
    }
    myfree(err2->err);
    myfree(err2);
    return Lold;
}
开发者ID:PoCTo,项目名称:yamsh,代码行数:31,代码来源:parse.c

示例4: RequestInit

void
RequestInit(TSession * const sessionP,
            TConn *    const connectionP) {

    sessionP->validRequest = false;  /* Don't have valid request yet */

    time(&sessionP->date);

    sessionP->connP = connectionP;

    sessionP->responseStarted = FALSE;

    sessionP->chunkedwrite = FALSE;
    sessionP->chunkedwritemode = FALSE;

    sessionP->continueRequired = FALSE;

    ListInit(&sessionP->cookies);
    ListInit(&sessionP->ranges);
    TableInit(&sessionP->requestHeaderFields);
    TableInit(&sessionP->responseHeaderFields);

    sessionP->status = 0;  /* No status from handler yet */

    StringAlloc(&(sessionP->header));
}
开发者ID:BirminghamConservatoire,项目名称:IntegraLive,代码行数:26,代码来源:http.c

示例5: printf

heap_t *heapCreate (size_t heapSize)
{
    heap_t *new_heap;
    sector_t *s0;
    new_heap = (heap_t*)malloc(sizeof(heap_t));
    if(new_heap == NULL)
    {
        printf("Error during heap allocation\n");
        exit(EXIT_FAILURE);
    }
    new_heap->empty=ListInit();
    new_heap->full=ListInit();
    new_heap->dim=heapSize;
    new_heap->base=malloc(heapSize);//memoria dello heap allocata
    if(new_heap->base == NULL)
    {
        printf("Error during base allocation\n");
        exit(EXIT_FAILURE);
    }
    s0=(sector_t*)malloc(sizeof(sector_t));
    if(s0==NULL) return NULL;
    s0->offset=(int)new_heap->base;
    s0->dimen=heapSize;
    new_heap->empty = OrderInsert(new_heap->empty,(void*)s0,NULL);//inserisco in empty la partizione intera
    return(new_heap);
}
开发者ID:blubecks,项目名称:Laboratorio,代码行数:26,代码来源:myheap.c

示例6: MediaSrvInit

////////////////////////////////////////////////////
// 功能:
// 输入:
// 输出:
// 返回:
// 说明:
////////////////////////////////////////////////////
void MediaSrvInit(void)
{
	ListInit(&MediaObjList);
	ListInit(&MediaCallbackList);
	hMediaMutex = kMutexCreate();
	JzSrvInit();
	SaveMplayerVar();
}
开发者ID:DanielGit,项目名称:Intrisit201202,代码行数:15,代码来源:MediaSrv.c

示例7: TaskInit

// 说明:任务管理模块初始化
void TaskInit(void)
{
    static uint32_t flag = FALSE;
    if (flag) {
        TEE_Printf("Task Module has been inited sometime before!\n");
        return;
    }
    flag = TRUE;
    current_task = NULL;
    ListInit(&list_all_tasks);
    ListInit(&list_ready_tasks);
    ListInit(&list_suspud_tasks);
}
开发者ID:HappyASR,项目名称:Trust-E-OS,代码行数:14,代码来源:tee_scheduler.c

示例8: MIMETypeCreate

MIMEType *
MIMETypeCreate(void) {
 
    MIMEType * MIMETypeP;

    MALLOCVAR(MIMETypeP);

    if (MIMETypeP) {
        ListInit(&MIMETypeP->typeList);
        ListInit(&MIMETypeP->extList);
        PoolCreate(&MIMETypeP->pool, 1024);
    }
    return MIMETypeP;
}
开发者ID:BirminghamConservatoire,项目名称:IntegraLive,代码行数:14,代码来源:response.c

示例9: main

int main(void)
{
	// 양방향 연결 리스트의 생성 및 초기화  ///////
	List list;
	int data;
	ListInit(&list);

	// 8개의 데이터 저장  ///////
	LInsert(&list, 1);  LInsert(&list, 2);
	LInsert(&list, 3);  LInsert(&list, 4);
	LInsert(&list, 5);  LInsert(&list, 6);
	LInsert(&list, 7);  LInsert(&list, 8);

	// 저장된 데이터의 조회  ///////
	if(LFirst(&list, &data))
	{
		printf("%d ", data);

		while(LNext(&list, &data)) 
			printf("%d ", data);
		
		while(LPrevious(&list, &data))
			printf("%d ", data);
		
		printf("\n\n");
	}

	return 0;
}
开发者ID:jhBang8917,项目名称:study_algorithm,代码行数:29,代码来源:DBLinkedListMain.c

示例10: PointInitList

/* initialize a list point - sets it as an empty list */
static FSTATUS PointInitList(Point *point, PointType type)
{
	DLIST *pList;

	point->Type = POINT_TYPE_NONE;
	switch (type) {
	case POINT_TYPE_PORT_LIST:
		pList = &point->u.portList;
		break;
	case POINT_TYPE_NODE_LIST:
		pList = &point->u.nodeList;
		break;
#if !defined(VXWORKS) || defined(BUILD_DMC)
	case POINT_TYPE_IOC_LIST:
		pList = &point->u.iocList;
		break;
#endif
	default:
		ASSERT(0);
		return FINVALID_OPERATION;
	}
	ListInitState(pList);
	if (! ListInit(pList, MIN_LIST_ITEMS)) {
		fprintf(stderr, "%s: unable to allocate memory\n", g_Top_cmdname);
		return FINSUFFICIENT_MEMORY;
	}
	point->Type = type;
	return FSUCCESS;
}
开发者ID:01org,项目名称:opa-ff,代码行数:30,代码来源:point.c

示例11: main

int main()
{
	CommonDataStr commonDataStr;
	CommonDataStr *commonDataPtr = &commonDataStr;
	FILE *vertFilePtr;
	fopen_s(&vertFilePtr, VERTEX_FILE, "r");

	if (vertFilePtr == NULL)
	{
		printf("Fatal Error: Unable to open %s File\n", VERTEX_FILE);
		return 1;
	}
	
	//Initialise the common data structure
	ListInit(&commonDataPtr->vertDataHead);
	commonDataPtr->numBits = 0;
	commonDataPtr->numVerts = 0;

	//Parse the vert file and create the vert data list
	ParseVertFile(vertFilePtr, commonDataPtr);

	//Decompress the bitstream file and find RMS error
	DecompressFromBitStream(commonDataPtr);

	//Free the vert data
	FreeVertData(commonDataPtr);

	fclose(vertFilePtr);
	return 0;
}
开发者ID:maheshvele,项目名称:GameDataCodec,代码行数:30,代码来源:main.c

示例12: TestIterator

void TestIterator()
{
    List* list = ListInit();

    /* Prepare the initial elements. */
    CU_ASSERT(list->push_back(list, (void*)(intptr_t)1) == true);
    CU_ASSERT(list->push_back(list, (void*)(intptr_t)2) == true);
    CU_ASSERT(list->push_back(list, (void*)(intptr_t)3) == true);
    CU_ASSERT(list->push_back(list, (void*)(intptr_t)4) == true);

    /* Iterate through the list. */
    void* element;
    int check = 1;

    list->first(list, false);
    while (list->next(list, &element)) {
        CU_ASSERT_EQUAL((int)(intptr_t)element, check);
        ++check;
    }

    /* Iterate through the list in reversed order. */
    check = 4;
    list->first(list, true);
    while (list->reverse_next(list, &element)) {
        CU_ASSERT_EQUAL((int)(intptr_t)element, check);
        --check;
    }

    ListDeinit(list);
}
开发者ID:ZSShen,项目名称:C-Common-Data-Structures,代码行数:30,代码来源:unit_list.c

示例13: InitAccesses

ListNode * InitAccesses(int accesses, Array decoder, int vertices)
{
    int i, *index, counter = 0;
    char type;
  	ListNode* accesseshead = ListInit();

    for(i = 0; i < vertices; i++) /*Goes through every vertice in the decoder to see if it is or not an access */
    {
        type = GetIP_Type(i, decoder);
        if( type == 'R' || type == 'C' || type == 'H' || type == 'E' || type == 'L' ) /*If it is an access */
        {
          	index = (int*) malloc( sizeof(int) );
          	VerifyMalloc((Item) index);

          	*index = i;
            counter++;
            accesseshead = AddNodeToListHead(accesseshead, (Item) index);
        }
    }
    if(counter != accesses)
    {
        printf("Error. Number of read accesses doesnt match info from file.");
        exit(0);
    }

    return accesseshead;
}
开发者ID:jsmvalente,项目名称:projectoaed,代码行数:27,代码来源:ParkingLot.c

示例14: ListInit

List *ListCopy(List *in, int deep)
 {
  ListItem *item, *outitem;
  List *out;
  out = ListInit();
  item = in->first;
  while (item != NULL)
   {
    outitem           = (ListItem *)lt_malloc_incontext(sizeof(ListItem), out->memory_context);
    outitem->prev     = out->last;
    outitem->next     = NULL;
    outitem->DataSize = item->DataSize;
    if (item->copyable != 0)
     {
      outitem->data     = (void *)lt_malloc_incontext(outitem->DataSize, out->memory_context);
      memcpy(outitem->data, item->data, outitem->DataSize);
     } else {
      if      ((deep!=0)&&(item->DataType == DATATYPE_LIST)) outitem->data = ListCopy((List *)item->data,1);
      else if ((deep!=0)&&(item->DataType == DATATYPE_DICT)) outitem->data = DictCopy((Dict *)item->data,1);
      else                                                   outitem->data =                  item->data   ;
     }
    outitem->copyable = item->copyable;
    outitem->DataType = item->DataType;
    if (out->first == NULL) out->first      = outitem;
    if (out->last  != NULL) out->last->next = outitem;
    out->last = outitem;
    out->length++;
    item = item->next;
   }
  return out;
 }
开发者ID:dcf21,项目名称:pyxplot8,代码行数:31,代码来源:lt_list.c

示例15: TestInsert

void TestInsert()
{
    List* list = ListInit();

    /* Insert elements to the specified indexes. */
    CU_ASSERT(list->insert(list, 1, (void*)(intptr_t)1) == false);

    CU_ASSERT(list->insert(list, 0, (void*)(intptr_t)1) == true);
    CU_ASSERT(list->insert(list, 1, (void*)(intptr_t)4) == true);
    CU_ASSERT(list->insert(list, 1, (void*)(intptr_t)2) == true);
    CU_ASSERT(list->insert(list, 2, (void*)(intptr_t)3) == true);
    CU_ASSERT(list->insert(list, 0, (void*)(intptr_t)0) == true);

    /* Check element insertion sequence. */
    void* element;
    CU_ASSERT(list->get_front(list, &element) == true);
    CU_ASSERT_EQUAL(element, (void*)(intptr_t)0);
    CU_ASSERT(list->get_back(list, &element) == true);
    CU_ASSERT_EQUAL(element, (void*)(intptr_t)4);

    CU_ASSERT(list->get_at(list, 0, &element) == true);
    CU_ASSERT_EQUAL(element, (void*)(intptr_t)0);
    CU_ASSERT(list->get_at(list, 1, &element) == true);
    CU_ASSERT_EQUAL(element, (void*)(intptr_t)1);
    CU_ASSERT(list->get_at(list, 2, &element) == true);
    CU_ASSERT_EQUAL(element, (void*)(intptr_t)2);
    CU_ASSERT(list->get_at(list, 3, &element) == true);
    CU_ASSERT_EQUAL(element, (void*)(intptr_t)3);
    CU_ASSERT(list->get_at(list, 4, &element) == true);
    CU_ASSERT_EQUAL(element, (void*)(intptr_t)4);

    CU_ASSERT_EQUAL(list->size(list), 5);
    ListDeinit(list);
}
开发者ID:ZSShen,项目名称:C-Common-Data-Structures,代码行数:34,代码来源:unit_list.c


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