亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fifo.ex.c

?? 感知無線電有關的仿真
?? C
字號:
///////////////////////////////////////////////////////////////////////////
///////////////////////// LIBRAIRY FILE FOR OPNET /////////////////////////
///////////////////////////////////////////////////////////////////////////
/// 
/// 	Contains:	The FIFO (First In First Out) service
///
///	Company:	National Institute of Standards and Technology
/// 	Written by:	Xavier Pallot
///	Date: 		04/14/00
///
///////////////////////////////////////////////////////////////////////////
/// 	Description:	This library provides the FIFO service for Opnet.
///			The "FIFO" can receive data pointer of any types.
///			A FIFO multiplexing service is also provided by
///			specifying a FIFO number with the data pointer.
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////

#include "fifo.h" 
#include <opnet.h>
///////////////////////////////////////////////////////////////////////////
/////////////////////////// FUNCTION DEFINITION ///////////////////////////
///////////////////////////////////////////////////////////////////////////

/****************************** INIT FIFO ********************************/
/* This function initializes a FIFO structure
/* In:	fifo -> pointer to the FIFO structure to initialize
/*************************************************************************/

void initFifo(sFifo *fifo)
{
fifo->nbrObjects=0;
fifo->firstObject=NULL;
fifo->lastObject=NULL;
}

int getFifoSize(sFifo * fifo)	{	return fifo->nbrObjects;	}/****************************** NEW FIFO *********************************/
/* This function creates and initializes a new FIFO structure in dynamic
/* memory  
/* Return: a pointer to the new FIFO structure
/*************************************************************************/

sFifo* newFifo()
{
sFifo* fifo;
// allocates the memory for the new fifo
fifo=(sFifo*)op_prg_mem_alloc(sizeof(sFifo));
// initializes this new structure
initFifo(fifo);
return fifo;
}

/*********************** PUT IN FIFO MULTIPLEX  ***************************/
/* This function is used to add a data pointer in a FIFO using the 
/* multeplexing service
/* In :	   fifo -> pointer to the FIFO 
/*	   data -> pointer to the data to add in the FIFO
/*	   fifoNumber -> the number of the FIFO for multiplexing
/* Return: 1 if success, 0 otherwise
/*************************************************************************/

int putInFifoMultiplex(sFifo* fifo,void* data,int fifoNumber)
{
int result;
// adds the data pointer at the end of the fifo
result=putInFifo(fifo,data);
if (result!=0)
	{
	// specify the fifoNumber for multiplexing
	fifo->lastObject->fifoNumber=fifoNumber;
	//printf("*********** EMPIL FIFO %d ID %d ************* ",fifoNumber,fifo);
	//printFifo(*fifo);
	}
return result;
}

/**************************** PUT IN FIFO *******************************/
/* This function is used to add a data pointer at the end of a "FIFO"
/* Note that by default the data pointer is added with a FIFO number equal 
/* to 0 (be careful when you also use the multeplexing service) 
/* In :	   fifo -> pointer to the FIFO 
/*	   data -> pointer to the data to add in the FIFO
/* Return: 1 if success, 0 otherwise
/*************************************************************************/

int putInFifo(sFifo* fifo, void* data)
{
sObject* object;
// allocates dynamic memory for the new fifo object
object=(sObject*)op_prg_mem_alloc(sizeof(sObject));
if (object!=NULL)
	{
	// adds the data in the fifo object
	object->data=data;
	// by default the fifoNumber of the object is 0
	object->fifoNumber=0;
	object->next=NULL;
	// adds the object in the fifo
	if (fifo->nbrObjects<=0)
		{
		// at the beginning if the fifo is empty
		fifo->firstObject=object;
		fifo->lastObject=object;
		}
	else
		{
		// at the end otherwise
		fifo->lastObject->next=object;
		fifo->lastObject=object;
		}
	fifo->nbrObjects++;
	return 1;
	}
else
	{
	return 0;
	}
}

/*********************** GET IN FIFO MULTIPLEX  ***************************/
/* This function is used to get a data pointer from a FIFO using the 
/* multeplexing service
/* In :	   fifo -> pointer to the FIFO 
/*	   fifoNumber -> the number of the FIFO for multiplexing
/* Return: a pointer to the extracted data if success
/*	   NULL otherwise
/*************************************************************************/

void* getInFifoMultiplex(sFifo* fifo,int fifoNumber)
{
sObject* object;
sObject* previousObject;
void *data;
previousObject=NULL;
object=fifo->firstObject;
// scan all the object contained in the fifo
while (object!=NULL)
	{
	// if the object has the wanted fifo number
 	if (object->fifoNumber==fifoNumber)
		{
		// extracts the data pointer
		data=object->data;
		// reorganizes the fifo without the object
		if (previousObject==NULL)
			{
			fifo->firstObject=object->next;
			}
		else
			{
			previousObject->next=object->next;
			if (object==fifo->lastObject)
				{
				fifo->lastObject=previousObject;
				}
			}
		// destroys the object
		op_prg_mem_free(object);
		fifo->nbrObjects--;
		// and returns the data pointer
		//printf("*********** DEPIL FIFO %d ID %d************* ",fifoNumber,fifo);
		//printFifo(*fifo);
		return data;
		}
	// else takes the next object in the fifo
	else
		{
		previousObject=object;
		object=object->next;
		}
	}
return NULL;
}

/*********************** READ IN FIFO MULTIPLEX  ***************************/
/* This function is used to read a data pointer from a FIFO using the 
/* multeplexing service whitout extracting the data
/* In :	   fifo -> pointer to the FIFO 
/*	   fifoNumber -> the number of the FIFO for multiplexing
/* Return: a pointer to the readed data if success
/*	   NULL otherwise
/*************************************************************************/

void* readInFifoMultiplex(sFifo* fifo,int fifoNumber)
{
sObject* object;
sObject* previousObject;
void *data;
previousObject=NULL;
object=fifo->firstObject;
// scan all the object contained in the fifo
while (object!=NULL)
	{
	// if the object has the wanted fifo number
 	if (object->fifoNumber==fifoNumber)
		{
		// extracts the data pointer
		data=object->data;
		// and returns the data pointer
		return data;
		}
	// else takes the next object in the fifo
	else
		{
		previousObject=object;
		object=object->next;
		}
	}
return NULL;
}

/******************** GET FIRST IN FIFO MULTIPLEX ************************/
/* This function is used to get the data pointer which is at the beginning 
/* of a "FIFO" and to return its fifo number
/* In :	   fifo -> pointer to the FIFO
/* Out:    fifoNumber -> the fifo number of the extracted data
/* Return: a pointer to the extracted data if success
/*	   NULL otherwise
/*************************************************************************/

void* getFirstInFifoMultiplex(sFifo *fifo, int *fifoNumber)
{
sObject* object;
void* data;
// if there are some object in the fifo
if (fifo->nbrObjects!=0)
	{
	// extracts the first object from the fifo
	object=fifo->firstObject;
	// extracts the data pointer from this object
	data=object->data;
	// get the fifoNumber corresponding to the data pointer
	*fifoNumber=object->fifoNumber;
	// reorganizes the fifo
	fifo->firstObject=object->next;
	// destroys the extracted object
	op_prg_mem_free(object);
	fifo->nbrObjects--;
	//printf("*********** DEPIL FIRST FIFO %d ID %d ************* ",fifoNumber,fifo);
	//printFifo(*fifo);
	return data;
	}
else
	{
	// returns null if there is nothing in the fifo
	return NULL;
	}
}

/******************** READ FIRST IN FIFO MULTIPLEX ***********************/
/* This function is used to read the data pointer which is at the beginning 
/* of a "FIFO" and to return its fifo number, whithout extracting the data
/* In :	   fifo -> pointer to the FIFO
/* Out:    fifoNumber -> the fifo number of the readed data
/* Return: a pointer to the readed data if success
/*	   NULL otherwise
/*************************************************************************/

void* readFirstInFifoMultiplex(sFifo *fifo, int *fifoNumber)
{
sObject* object;
void* data;
// if there are some object in the fifo
if (fifo->nbrObjects!=0)
	{
	// extracts the first object from the fifo
	object=fifo->firstObject;
	// extracts the data pointer from this object
	data=object->data;
	// get the fifoNumber corresponding to the data pointer
	*fifoNumber=object->fifoNumber;
	return data;
	}
else
	{
	// returns null if there is nothing in the fifo
	return NULL;
	}
}

/**************************** GET IN FIFO *******************************/
/* This function is used to get the data pointer which is at the beginning 
/* of a "FIFO"
/* In :	   fifo -> pointer to the FIFO 
/* Return: a pointer to the extracted data if success
/*	   NULL otherwise
/*************************************************************************/

void* getInFifo(sFifo *fifo)
{
sObject* object;
void *data;
// if there are some object in the fifo
if (fifo->nbrObjects!=0)
	{
	// extracts the first object from the fifo
	object=fifo->firstObject;
	// extracts the data pointer from this object
	data=object->data;
	// reorganizes the fifo
	fifo->firstObject=object->next;
	// destroys the extracted object
	op_prg_mem_free(object);
	fifo->nbrObjects--;
	return data;
	}
else
	{
	// returns null if there is nothing in the fifo
	return NULL;
	}
}

/**************************** READ IN FIFO *******************************/
/* This function is used to read the data pointer which is at the beginning 
/* of a "FIFO" whitout extracting the data from the queue
/* In :	   fifo -> pointer to the FIFO 
/* Return: a pointer to the readed data if success
/*	   NULL otherwise
/*************************************************************************/

void* readInFifo(sFifo *fifo)
{
sObject* object;
void *data;
// if there are some object in the fifo
if (fifo->nbrObjects!=0)
	{
	// extracts the first object from the fifo
	object=fifo->firstObject;
	// extracts the data pointer from this object
	data=object->data;
	return data;
	}
else
	{
	// returns null if there is nothing in the fifo
	return NULL;
	}
}

/**************************** DESTROY FIFO *******************************/
/* This function destroy a dynamic FIFO structure which was created by the 
/* newFifo function. Thus this function also destroys all the objects and 
/* data which are contained in the FIFO.
/* In: fifo -> a pointer to the FIFO structure to destroy
/*************************************************************************/

void destroyFifo(sFifo* fifo)
{
void *data;
// extract all data from the fifo
do 
	{
	data=getInFifo(fifo);
	// destroy the data: work ??
	op_prg_mem_free(data);
	}
while (data!=NULL);
// destroy the fifo
op_prg_mem_free(fifo);
}


/***************************** PRINT FIFO ********************************/
/* This function display a FIFO on the computer screen
/* In :	   fifo -> the FIFO to display
/*************************************************************************/

void printFifo(sFifo fifo)
{
int* i;
int nbr;
sObject* object;
object=fifo.firstObject;
nbr=1;
while(object!=NULL)
	{
	i=(int*)(object->data);
	printf("      /** Element %d:: %d\n",nbr,*i);
	object=object->next;
	nbr++;
	}
if (nbr<2)	printf("      /** list is empty\n");
}

///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩日日摸| 久久综合av免费| 26uuuu精品一区二区| 亚洲精品国产成人久久av盗摄| 蜜臀av性久久久久蜜臀aⅴ四虎| 99视频一区二区三区| 精品乱人伦小说| 午夜久久久久久| 色综合av在线| 国产精品第13页| 国产91精品入口| 久久久久久久久久久久久女国产乱| 五月天亚洲婷婷| 色狠狠色噜噜噜综合网| 中文一区一区三区高中清不卡| 极品销魂美女一区二区三区| 欧美区视频在线观看| 洋洋av久久久久久久一区| av日韩在线网站| 国产精品久久久久久久浪潮网站| 久草这里只有精品视频| 日韩精品在线看片z| 欧美96一区二区免费视频| 在线不卡免费欧美| 日韩专区在线视频| 69精品人人人人| 五月天一区二区三区| 69堂精品视频| 免费欧美在线视频| www国产亚洲精品久久麻豆| 久久99国产精品麻豆| 欧美成人激情免费网| 青草av.久久免费一区| 日韩精品专区在线影院重磅| 久久99国产精品久久99| 久久久久久亚洲综合影院红桃| 国产一区免费电影| 国产精品免费久久| 色94色欧美sute亚洲线路一ni| 亚洲三级免费观看| 欧美在线观看一二区| 午夜av一区二区三区| 日韩一区二区三区电影在线观看 | 国产精品久久久久国产精品日日| 国产露脸91国语对白| 亚洲国产精品精华液ab| 91麻豆成人久久精品二区三区| 一区二区免费看| 在线综合+亚洲+欧美中文字幕| 男人的j进女人的j一区| 国产午夜精品一区二区三区四区| 不卡av在线免费观看| 亚洲精品乱码久久久久久久久| 欧美性生交片4| 日本va欧美va精品发布| 欧美精品一区二区三区视频| 91在线观看高清| 日韩国产在线一| 国产日韩av一区二区| 欧美无乱码久久久免费午夜一区| 麻豆视频一区二区| 亚洲三级视频在线观看| 日韩欧美国产一二三区| av日韩在线网站| 免费人成精品欧美精品| 亚洲人成网站精品片在线观看| 欧美一区二区精品在线| 成人av电影观看| 免费观看30秒视频久久| 国产精品黄色在线观看| 欧美伦理电影网| 成人黄色777网| 久久国产生活片100| 亚洲美女屁股眼交3| 久久奇米777| 欧美精品高清视频| 日本精品视频一区二区三区| 国产一区二区在线电影| 亚洲h在线观看| 亚洲欧美欧美一区二区三区| 欧美精品一区二区三区蜜桃视频| 欧美丝袜丝交足nylons| 成人国产视频在线观看| 久久精品久久综合| 亚洲国产欧美在线| 亚洲天堂成人网| 国产日韩三级在线| 制服丝袜日韩国产| 日本高清不卡在线观看| www.日韩大片| 黄色小说综合网站| 日韩影院精彩在线| 一区二区三区精品| 成人欧美一区二区三区黑人麻豆 | 99在线精品观看| 国产精品一区二区在线看| 免费看日韩a级影片| 五月开心婷婷久久| 亚洲午夜久久久久久久久电影网 | 日韩黄色免费电影| 一区二区日韩av| 亚洲精品欧美在线| 亚洲美女精品一区| 亚洲另类中文字| 亚洲精选一二三| 亚洲欧美成人一区二区三区| 国产精品传媒视频| 国产精品久久久久天堂| 国产精品卡一卡二卡三| 国产精品久久久久久久久免费相片 | 日韩一区在线免费观看| 久久久美女毛片| 久久久久国产精品麻豆ai换脸| 日韩免费观看2025年上映的电影 | 日本不卡不码高清免费观看| 亚洲一区二区免费视频| 亚洲电影一区二区| 午夜视频在线观看一区| 日韩国产在线一| 久久精品国产精品亚洲综合| 天堂va蜜桃一区二区三区| 日韩av网站免费在线| 老司机精品视频在线| 极品销魂美女一区二区三区| 国产精品性做久久久久久| 成人手机电影网| 91尤物视频在线观看| 色婷婷香蕉在线一区二区| 欧美色区777第一页| 在线观看91精品国产麻豆| 日韩免费福利电影在线观看| 国产性做久久久久久| 国产精品国产自产拍高清av王其 | 欧美丝袜第三区| 91精品国产欧美日韩| 精品国产伦一区二区三区观看体验| 精品国精品自拍自在线| 国产精品久久久久久久久免费樱桃| 一区二区三区欧美日| 免费成人av在线播放| 国产99久久久久| 欧美性猛交一区二区三区精品| 91精品国产欧美一区二区18| 欧美激情资源网| 亚洲成在人线免费| 国产成人高清在线| 欧美日韩精品欧美日韩精品一| 欧美电影精品一区二区| 国产精品高潮呻吟| 日本欧洲一区二区| 91尤物视频在线观看| 日韩欧美在线影院| 日韩美女精品在线| 极品少妇xxxx偷拍精品少妇| 色噜噜夜夜夜综合网| 337p日本欧洲亚洲大胆精品| 亚洲一区自拍偷拍| 国产精品一区二区在线观看网站 | 日韩黄色一级片| 91在线一区二区| 精品国产不卡一区二区三区| 日韩一区欧美一区| 狠狠色综合播放一区二区| 欧美在线视频你懂得| 国产女主播在线一区二区| 日韩av不卡一区二区| 99免费精品在线| 精品国产乱码久久久久久牛牛| 一区二区在线看| 成人午夜碰碰视频| 精品久久人人做人人爱| 亚洲成人手机在线| 91网上在线视频| 国产精品素人一区二区| 国产一区二区女| 日韩免费观看高清完整版 | 粗大黑人巨茎大战欧美成人| 欧美精品18+| 亚洲一区在线观看免费观看电影高清| 国产尤物一区二区在线| 日韩欧美国产高清| 日本亚洲视频在线| 欧美日韩三级在线| 午夜精品久久久久久久蜜桃app| 99久久精品一区| 国产精品久久久久影院色老大 | 中文字幕中文在线不卡住| 国产成人精品影视| 久久久国产精品午夜一区ai换脸| 蜜臀av性久久久久蜜臀aⅴ流畅| 欧美久久一二三四区| 亚洲成人免费视| 欧美色综合天天久久综合精品| 亚洲免费在线视频| 色呦呦网站一区| 亚洲一区二区美女| 777午夜精品视频在线播放| 欧美a一区二区| 精品福利一二区| 国产精品白丝av|