亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
日韩三级精品电影久久久| 欧美日韩精品一区二区三区 | 国产亚洲欧美日韩俺去了| 奇米亚洲午夜久久精品| 欧美日韩在线播放三区四区| 一区二区三区91| 欧美久久久久久蜜桃| 香蕉影视欧美成人| 欧美一区二区三区在线电影| 日韩高清电影一区| 久久理论电影网| 91网站在线观看视频| 一区二区三区国产豹纹内裤在线| 欧美综合欧美视频| 丝袜美腿亚洲色图| 久久久99久久| 色成人在线视频| 日本亚洲三级在线| 久久久午夜精品| 91免费视频网址| 日本中文字幕一区二区视频| 精品少妇一区二区三区免费观看| 久久精品国产秦先生| 国产欧美综合在线观看第十页| 99re这里只有精品首页| 亚洲bt欧美bt精品| 国产日韩欧美制服另类| 色婷婷av一区二区三区软件| 蜜臀av在线播放一区二区三区| 自拍偷拍亚洲综合| 日韩午夜av一区| 一本久久a久久精品亚洲| 青青草国产精品97视觉盛宴| 欧美国产精品劲爆| 日韩欧美在线123| 97久久精品人人爽人人爽蜜臀| 青青草国产成人av片免费| 国产精品美女久久久久久久久久久 | 色噜噜久久综合| 卡一卡二国产精品| 洋洋av久久久久久久一区| 2020日本不卡一区二区视频| 色播五月激情综合网| 国模冰冰炮一区二区| 一区二区三区在线免费| 久久精品一区二区三区av| 在线观看三级视频欧美| 国产精品亚洲专一区二区三区 | 国产日产欧产精品推荐色| 在线看不卡av| 大桥未久av一区二区三区中文| 日本午夜一区二区| 亚洲一区二区欧美激情| 国产精品系列在线| 26uuu国产日韩综合| 欧美精品亚洲二区| 在线中文字幕不卡| 盗摄精品av一区二区三区| 免费观看久久久4p| 天天操天天色综合| 一区二区三区四区国产精品| 日本一区二区三区国色天香 | 精品国产伦一区二区三区观看方式 | 亚洲婷婷综合色高清在线| 欧美成va人片在线观看| 精品视频在线免费观看| 91丨九色丨国产丨porny| 国产高清精品网站| 国产一区二区三区久久悠悠色av| 日本视频在线一区| 性感美女极品91精品| 一区二区久久久久| 亚洲精品美腿丝袜| 亚洲欧美国产77777| 国产精品国产三级国产aⅴ入口| 久久中文娱乐网| 欧美tk丨vk视频| 日韩欧美国产综合一区 | 欧美亚日韩国产aⅴ精品中极品| gogo大胆日本视频一区| 成人久久18免费网站麻豆| 国产二区国产一区在线观看| 狠狠色狠狠色合久久伊人| 精品在线播放免费| 国产精品系列在线观看| 国产成人av资源| 97se亚洲国产综合在线| 91麻豆国产在线观看| 色婷婷久久99综合精品jk白丝| 色视频成人在线观看免| 91福利视频久久久久| 欧美影视一区在线| 欧美挠脚心视频网站| 91精品国产福利| 2024国产精品| 亚洲国产精品ⅴa在线观看| 国产精品日韩成人| 亚洲蜜桃精久久久久久久| 一区二区三区成人| 日本不卡一区二区三区高清视频| 蜜桃视频一区二区三区| 国产一区二区导航在线播放| 粉嫩aⅴ一区二区三区四区五区| eeuss鲁片一区二区三区| 一本大道久久a久久综合| 欧美久久久久久久久| 精品久久国产97色综合| 国产日产欧美一区二区视频| 亚洲精品免费在线| 久久成人免费网站| 99re6这里只有精品视频在线观看| 欧美性一二三区| 精品成人一区二区三区| 国产精品福利影院| 亚洲国产精品尤物yw在线观看| 免费高清不卡av| 99久久久精品免费观看国产蜜| 欧美日韩在线播放一区| 久久精品综合网| 婷婷久久综合九色综合伊人色| 国产成人综合亚洲91猫咪| 91免费观看国产| 欧美成人精品福利| 亚洲一区在线观看免费| 久久成人免费网站| 在线亚洲精品福利网址导航| 欧美mv日韩mv| 午夜伦理一区二区| 3atv一区二区三区| 久久日一线二线三线suv| 亚洲精品国产成人久久av盗摄| 青青草成人在线观看| 91老司机福利 在线| 欧美一区二区三区免费视频| 国产精品你懂的在线| 日本91福利区| 91久久精品一区二区| 久久综合资源网| 亚洲精品久久久蜜桃| 开心九九激情九九欧美日韩精美视频电影| 北条麻妃国产九九精品视频| 欧美一区二区三区影视| 亚洲一区在线观看免费观看电影高清| 国产成人a级片| 欧美成人三级电影在线| 亚洲成av人**亚洲成av**| www.亚洲免费av| 久久久精品人体av艺术| 免费观看成人av| 884aa四虎影成人精品一区| 国产精品对白交换视频| 国产精品99久| 26uuu精品一区二区在线观看| 日韩电影免费一区| 欧美日韩激情一区| 夜夜亚洲天天久久| 99国产精品一区| 亚洲欧美在线视频观看| 国产99一区视频免费 | 欧美色综合久久| 亚洲久草在线视频| 成av人片一区二区| 欧美韩国日本不卡| 国产成a人亚洲精| 久久久精品欧美丰满| 狠狠色狠狠色综合日日91app| 精品国产91乱码一区二区三区 | 国产东北露脸精品视频| 亚洲精品在线网站| 国产老妇另类xxxxx| 久久久蜜桃精品| 国产精品系列在线观看| 久久精品人人做人人综合| 国内一区二区在线| 视频一区欧美日韩| 91精品婷婷国产综合久久| 午夜影视日本亚洲欧洲精品| 在线观看成人小视频| 亚洲妇女屁股眼交7| 欧美日韩国产天堂| 蜜臀va亚洲va欧美va天堂| 日韩精品影音先锋| 国产精品538一区二区在线| 国产亚洲成av人在线观看导航 | 91激情在线视频| 一区二区三区中文字幕电影| 欧洲一区二区三区免费视频| 亚洲大片免费看| 欧美一区二区三区在线观看 | 精品少妇一区二区三区日产乱码| 韩国一区二区三区| 国产欧美1区2区3区| eeuss鲁片一区二区三区在线观看| 一区二区三区在线观看网站| 欧美伦理影视网| 国产高清在线观看免费不卡| 亚洲视频免费在线| 91麻豆精品国产自产在线| 国产综合色精品一区二区三区| 综合激情网...|