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

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

?? fifo.ex.c

?? OPNET下的FIFO程序,用以增強OPNET下的FIFO功能
?? C
字號:
///////////////////////////////////////////////////////////////////////////
////////////////////// OPNET'S FIFO LIBRARY SOURCE FILE //////////////////////////////////////////////////////////////////////////////////////////////
/// 
/// 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 /////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#include "fifo.h" 
///////////////////////////////////////////////////////////////////////////
////////////////////////// FUNCTIONS DEFINITION ///////////////////////////
///////////////////////////////////////////////////////////////////////////

/****************************** FIFO_INIT ********************************/
/* This function initializes a sFIFO structure
/* 		sFifo fifo: a pointer to the sFIFO structure to initialize
/*************************************************************************/

void fifo_init(sFifo *fifo)
{
// initialize the FIFOfifo->nbrObjects=0;
fifo->firstObject=OPC_NIL;
fifo->lastObject=OPC_NIL;
}

/****************************** FIFO_NEW *********************************/
/* This function creates and initializes a new sFIFO structure in the dynamic
/* memory.  
/* 		Return: a pointer to the new sFIFO structure
/*************************************************************************/

sFifo* fifo_new()
{
sFifo* fifo;
// allocate the memory for the new fifo
fifo=(sFifo*)op_prg_mem_alloc(sizeof(sFifo));
// initialize this new structure
fifo_init(fifo);
// and return a pointer to this new sFifo structurereturn fifo;
}

/****************************** FIFO_INSERT ******************************/
/* 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 multiplexing service) 
/* 		sFifo fifo: a pointer to the FIFO 
in which the data will be inserted/*	   	void* data: a pointer to the data (of any type) to add in the FIFO
/* 		Return: 1 if success/*				0 otherwise
/*************************************************************************/

int fifo_insert(sFifo* fifo, void* data)
{
sObject* object;
// allocates dynamic memory for the new fifo object
object=(sObject*)op_prg_mem_alloc(sizeof(sObject));
// if this memory allocation was successfullif (object!=OPC_NIL)
	{
	// adds the data in the fifo object
	object->data=data;
	// by default the fifoNumber of the object is 0
	object->fifoNumber=0;
	object->next=OPC_NIL;
	// 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;
		}
	// increment by one the number of Object contained in the Fifo	fifo->nbrObjects++;
	return 1;
	}
// if the memory allocation failedelse
	{
	// return 0 as error indicator	return 0;
	}
}
/**************************** FIFO_EXTRACT *******************************/
/* This function is used to get the data pointer which is at the beginning 
/* of a "FIFO"
./* 		sFifo fifo: a pointer to the FIFO 
from which the data will be extracted/*		Return: a pointer to the extracted data if success
/*	   			OPC_NIL otherwise
/*************************************************************************/

void* fifo_extract(sFifo *fifo)
{
sObject* object;
void *data;
// if there are some object in the fifo
if (fifo->nbrObjects!=0)
	{
	// extract the first object from the fifo
	object=fifo->firstObject;
	// extract the data pointer from this object
	data=object->data;
	// reorganize the fifo
	fifo->firstObject=object->next;
	// destroy the extracted object
	op_prg_mem_free(object);
	// decrement by one the number of Object in the Fifo	fifo->nbrObjects--;
	// return the pointer to the extracted data	return data;
	}// otherwise return OPC_NIL since there is nothing in the fifo
else
	{
	return OPC_NIL;
	}
}

/***************************** FIFO_READ ********************************/
/* This function is used to read the data pointer which is at the beginning 
/* of a "FIFO" whitout extracting the data from the queue
./* 		sFifo fifo: a pointer to the FIFO 
from which the data will be read/* 		Return: a pointer to the readed data if success
/*	   			OPC_NIL otherwise
/*************************************************************************/

void* fifo_read(sFifo *fifo)
{
sObject* object;
void *data;
// if there are some object in the fifo
if (fifo->nbrObjects!=0)
	{
	// extract the first object from the fifo
	object=fifo->firstObject;
	// extract the data pointer from this object
	data=object->data;
	// return the pointer to the read data	return data;
	}
// otherwise return OPC_NIL since there is nothing in the fifo
else
	{
	return OPC_NIL;
	}
}

 /*********************** FIFO_MULTIPLEX_INSERT ***************************/
/* This function is used to add a data pointer in a FIFO using the 
/* multeplexing service
/* 		sFifo fifo: a pointer to the FIFO 
in which the data will be inserted/*	   	void* data: a pointer to the data (of any type) to add in the FIFO
/*	    int fifo_number: the number of the FIFO for multiplexing
. that is the /* number of the subqueue in which the data will be inserted/* 		Return: 1 if success				0 otherwise
/*************************************************************************/

int fifo_multiplex_insert(sFifo* fifo,void* data,int fifo_number)
{
int result;
// add the data pointer at the end of the fifo
 by calling the fifo_insert functionresult=fifo_insert(fifo,data);
// if this operation was successfullif (result!=0)
	{
	// specify the fifoNumber for multiplexing
	fifo->lastObject->fifoNumber=fifo_number;
	}
return result;
}


/********************** FIFO_MULTIPLEX_EXTRACT **************************/
/* This function is used to get (extract) a data pointer from a FIFO using the 
/* multiplexing service
/* 		sFifo fifo: a pointer to the FIFO 
from which the data will be extracted/*	    int fifo_number: the number of the FIFO for multiplexing
, that is the /* number of the subqueue from which the data will be extracted/* 		Return: a pointer to the extracted data if success
/*	   			OPC_NIL otherwise
/*************************************************************************/

void* fifo_multiplex_extract(sFifo* fifo,int fifo_number)
{
sObject* object;
sObject* previousObject;
void *data;
previousObject=OPC_NIL;
object=fifo->firstObject;
// scan all the object contained in the fifo
while (object!=OPC_NIL)
	{
	// if the object has the wanted fifo number
 	if (object->fifoNumber==fifo_number)
		{
		// extract the data pointer
		data=object->data;
		// reorganize the fifo without the object
		if (previousObject==OPC_NIL)
			{
			fifo->firstObject=object->next;
			}
		else
			{
			previousObject->next=object->next;
			if (object==fifo->lastObject)
				{
				fifo->lastObject=previousObject;
				}
			}
		// destroy the object
		op_prg_mem_free(object);



		// decrement by one the number of Object in the Fifo		fifo->nbrObjects--;
		// and return the data pointer
 to the extracted data
		return data;
		}
	// otherwise the object doesn't belong to the right subqueue, thus read the next object in the fifo
	else
		{
		previousObject=object;
		object=object->next;
		}
	}
// return OPC_NIL if no data were foundreturn OPC_NIL;
}

/*********************** FIFO_MULTIPLEX_READ  ***************************/
/* This function is used to read a data pointer in a FIFO using the 
multeplexing/* service whitout extracting it
/*  	sFifo fifo: a pointer to the FIFO 
in which the data will be read/*	    int fifo_number: the number of the FIFO for multiplexing
, that is the/* number of the subqueue in which the data will be read/* 		Return: a pointer to the read data if success
/*	   			OPC_NIL otherwise
/*************************************************************************/

void* fifo_multiplex_read(sFifo* fifo,int fifo_number)
{
sObject* object;
//sObject* previousObject;
void *data;
//previousObject=OPC_NIL;
object=fifo->firstObject;
// scan all the object contained in the fifo
while (object!=OPC_NIL)
	{
	// if the object has the wanted fifo number
 	if (object->fifoNumber==fifo_number)
		{
		// read the data pointer
		data=object->data;
		// and return it		return data;
		}
	// otherwise the object doesn't belong to the right subqueue, thus read the next object in the fifo
	else
		{
		//previousObject=object;
		object=object->next;
		}
	}
// return NULL if no data were foundreturn OPC_NIL;
}

/******************* FIFO_MULTIPLEX_EXTRACT_FIRST ************************/
/* This function is used to get the data pointer which is at the beginning 
/* of a "FIFO" and to return its fifo number
. Thus it extracts the oldest data/* from queue regardless the subqueue in which it is stored./* 		 sFifo fifo: a pointer to the FIFO
 from which the data will be extracted/* 		 int* fifo_number: return the fifo number (subqueue) of the extracted data
/*		 Return: a pointer to the extracted data if success
/*	   			 OPC_NIL otherwise
/*************************************************************************/

void* fifo_multiplex_extract_first(sFifo *fifo, int *fifo_number)
{
sObject* object;
void* data;
// if there are some object in the fifo
if (fifo->nbrObjects!=0)
	{
	// extract the first object from the fifo
	object=fifo->firstObject;
	// extract the data pointer from this object
	data=object->data;
	// get the fifoNumber corresponding to the data pointer
	*fifo_number=object->fifoNumber;
	// reorganize the fifo
	fifo->firstObject=object->next;
	// destroy the extracted object
	op_prg_mem_free(object);
	// decrenment by one the number of Object contained in the Fifo	fifo->nbrObjects--;
	// and return the pointer to the extracted data	return data;
	}
// otherwise return OPC_NIL since there is nothing in the fifo
else
	{
	return OPC_NIL;
	}
}

/********************* FIFO_MULTIPLEX_READ_FIRST ************************/
/* 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
./* Thus it reads the oldest data in all the subqueue./* 		sFifo fifo: a pointer to the FIFO
 in which the data will be read/* 		int* fifo_number: return the fifo number (subqueue) of the read data
/* 		Return: a pointer to the read data if success
/*	   			OPC_NIL otherwise
/*************************************************************************/

void* fifo_multiplex_read_first(sFifo *fifo, int *fifo_number)
{
sObject* object;
void* data;
// if there are some object in the fifo
if (fifo->nbrObjects!=0)
	{
	// extract the first object from the fifo
	object=fifo->firstObject;
	// extract the data pointer from this object
	data=object->data;
	// read the fifoNumber corresponding to the data pointer
	*fifo_number=object->fifoNumber;
	// and return the pointer to the read data	return data;
	}
// otherwise return OPC_NIL since there is nothing in the fifo
else
	{
	
return OPC_NIL;
	}
}

/***************************** FIFO_SIZE *********************************/
/* This function returns the size of a fifo, that is the number of data /* objects contained in it/* 		sFifo: a pointer to the sFIFO that must report its size/*		Return: the size of the fifo/*************************************************************************/
int fifo_size(sFifo* fifo)
{
return (fifo->nbrObjects)
;}
/***************************** FIFO_SIZE *********************************/
/* This function returns the size of a fifo using the multiplex service, that /* is returns the number of data objects contained in one of its subqueue/* 		sFifo: a pointer to the sFIFO that must report the size of one of * its subqueue/*		fifo_number: the fifo numer (subqueue) that must report its size/*		Return: the size of the specified fifo_number subqueue/*************************************************************************/
int fifo_multiplex_size(sFifo* fifo, int fifo_number)
{
int fifo_number_size;sObject* object;
fifo_number_size=0;object=fifo->firstObject;
// scan all the object contained in the fifo
while (object!=OPC_NIL)
	{
	// if the object has the wanted fifo number
 	if (object->fifoNumber==fifo_number)
		{
		// increment by 1 the number of objects contained in the subqueue		fifo_number_size++;		}
	// read the next object in the fifo
	object=object->next;
	}
// return the number of objects found in the wanted subqueuereturn fifo_number_size;}
 /**************************** FIFO_DESTROY *******************************/
/* This function destroy a dynamic FIFO structure which was created by the 
/* fifo_new function. Thus this function also destroys all the objects and 
/* data which are contained in the FIFO.
/* 		sFifo: a pointer to the sFIFO structure to destroy
/*************************************************************************/

void fifo_destroy(sFifo* fifo)
{
void *data;
// extract all the data pointer from the fifo
do 
	{
	data=fifo_extract(fifo);
	// free the memory used by these data
	op_prg_mem_free(data);
	}
while (data!=OPC_NIL);
// free the memory used by the sFifo
 structureop_prg_mem_free(fifo);
}


/***************************** FIFO_PRINT ********************************/
/* This function display a FIFO on the computer screen
/* 		sFifo fifo: a pointer to the FIFO to display
/*************************************************************************/

void fifo_print(sFifo fifo)
{
int* i;
int nbr;
sObject* object;
object=fifo.firstObject;
nbr=0;
// for each Object contained in the Fifowhile(object!=OPC_NIL)
	{
	// print the pointer value of the user's data	i=(int*)(object->data);
	printf("%d...",*i);
	object=object->next;
	nbr++;
	}
printf("end of the %d objects\n",fifo.nbrObjects);
}

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲主播在线观看| 日本v片在线高清不卡在线观看| 不卡的av在线播放| 亚洲美女区一区| 精品成a人在线观看| 91蜜桃在线观看| 国产一区二区三区香蕉| 一区二区三区日韩在线观看| 欧美精品一区二区三区一线天视频| 91色九色蝌蚪| 高清成人在线观看| 日韩一区二区三区在线观看| 夜夜嗨av一区二区三区| 亚洲色图欧洲色图婷婷| 精品一二三四区| 韩日精品视频一区| 成人免费视频免费观看| av在线免费不卡| 在线视频中文字幕一区二区| 欧美另类变人与禽xxxxx| 欧美精品久久久久久久多人混战| 日韩一级精品视频在线观看| 久久女同性恋中文字幕| 中文字幕一区三区| 一区二区三区在线视频免费| 日韩二区在线观看| 日韩av中文字幕一区二区| 激情图区综合网| 99久久国产综合精品色伊| 一本一道综合狠狠老| 色狠狠桃花综合| 欧美在线免费视屏| 精品成人a区在线观看| 欧美高清性hdvideosex| 国产欧美一区二区精品性| 国产精品国产精品国产专区不蜜| 亚洲一区二区三区四区在线 | 免费成人av在线| 蜜桃免费网站一区二区三区| 国产成人免费在线观看不卡| 色吊一区二区三区| 久久综合久久鬼色| 亚洲一区二区三区爽爽爽爽爽| 蜜桃精品视频在线| 日韩丝袜情趣美女图片| 国产精品久线在线观看| 日本不卡高清视频| 蜜臀久久99精品久久久久宅男| 成人一区在线看| 91福利社在线观看| 久久综合中文字幕| 欧美白人最猛性xxxxx69交| 欧美国产乱子伦| 五月天亚洲精品| 久久国产乱子精品免费女| 国产一区免费电影| 欧美性高清videossexo| 精品欧美一区二区久久| 亚洲人成电影网站色mp4| 美女在线一区二区| 成人福利在线看| 日韩亚洲欧美一区| 一区二区不卡在线视频 午夜欧美不卡在 | 不卡av在线网| 欧美成人猛片aaaaaaa| 国产精品久久久久7777按摩| 视频一区二区三区中文字幕| 91网站最新地址| 日韩三区在线观看| 亚洲一区免费观看| 91在线看国产| 国产精品视频观看| 韩国一区二区三区| 91精品午夜视频| 亚洲狼人国产精品| 成人美女视频在线观看| 精品国产乱码久久久久久浪潮| 亚洲成人激情社区| 欧美在线不卡视频| 亚洲男人的天堂av| 色老综合老女人久久久| 一区免费观看视频| 高清国产午夜精品久久久久久| 日韩区在线观看| 久久99久久久欧美国产| 欧美大片一区二区| 麻豆精品国产传媒mv男同| 日韩一区二区三区四区五区六区| 亚洲成精国产精品女| 欧美日韩电影一区| 一区二区国产视频| 欧美猛男超大videosgay| 一个色妞综合视频在线观看| 欧美亚洲高清一区| 亚洲va欧美va人人爽午夜| 欧美乱熟臀69xxxxxx| 老司机免费视频一区二区三区| 欧美一区二区三区免费观看视频| 亚洲电影在线免费观看| 欧美一级一级性生活免费录像| 男女性色大片免费观看一区二区| 欧美xxx久久| 国产美女精品一区二区三区| 欧美一区二区三区电影| 久久66热re国产| 国产精品久久久久影视| 国产成人在线视频播放| 日韩一区二区免费在线观看| 国产传媒日韩欧美成人| 亚洲图片你懂的| 欧美色倩网站大全免费| 蜜桃视频一区二区| 中国色在线观看另类| 91久久精品国产91性色tv| 麻豆国产91在线播放| 国产欧美日韩三级| 欧美视频中文字幕| 国产一区二区在线观看视频| 中文字幕中文在线不卡住| 欧美日韩国产美女| 成人久久18免费网站麻豆| 中文字幕一区二区三区精华液| 欧美日韩国产不卡| 毛片av一区二区三区| 亚洲欧美怡红院| 3atv一区二区三区| 国产成人啪午夜精品网站男同| 一区二区三区在线观看国产| 2023国产精品自拍| 91麻豆精品在线观看| 黄色日韩网站视频| 中文字幕亚洲一区二区av在线 | 欧美日韩综合在线免费观看| 日本不卡一区二区| 中文字幕在线不卡一区| 在线成人高清不卡| 粉嫩欧美一区二区三区高清影视 | 欧美理论片在线| 国产成人99久久亚洲综合精品| 午夜久久久久久久久| 中文字幕亚洲区| 欧美视频一区二区在线观看| 成人a区在线观看| 久久99久久99小草精品免视看| 亚洲一卡二卡三卡四卡无卡久久| 国产欧美一区二区精品婷婷| 日韩午夜在线观看| 欧洲国内综合视频| 成人手机在线视频| 麻豆精品视频在线观看视频| 夜夜爽夜夜爽精品视频| 国产欧美一区二区精品仙草咪| 5月丁香婷婷综合| 91在线无精精品入口| bt欧美亚洲午夜电影天堂| 激情av综合网| 日韩国产精品久久| 午夜一区二区三区在线观看| 亚洲一区二区欧美日韩| 亚洲色图都市小说| 最新日韩av在线| 中文字幕一区在线| 中文字幕欧美区| 久久综合五月天婷婷伊人| 日韩视频在线观看一区二区| 日韩一区二区三| 日韩午夜在线播放| 精品噜噜噜噜久久久久久久久试看| 欧美精品三级日韩久久| 欧美精品乱人伦久久久久久| 538在线一区二区精品国产| 欧美肥妇毛茸茸| 欧美一区二区三区免费视频| 日韩美女视频在线| 久久精品网站免费观看| 欧美国产97人人爽人人喊| 中文字幕在线播放不卡一区| 亚洲麻豆国产自偷在线| 亚洲精品乱码久久久久久久久 | 欧美午夜影院一区| 色94色欧美sute亚洲线路一ni | 色先锋aa成人| 欧美在线啊v一区| 在线视频一区二区三区| 91精品欧美一区二区三区综合在| 日韩精品一区二区三区中文不卡 | 亚洲成人免费在线| 麻豆成人久久精品二区三区小说| 国产一区不卡在线| 91麻豆精品一区二区三区| 91精彩视频在线观看| 欧美放荡的少妇| 久久只精品国产| 亚洲欧美日韩中文播放| 日韩成人一区二区| 成人夜色视频网站在线观看| 欧美天堂一区二区三区| 精品久久久久一区| 亚洲欧洲av在线| 美女脱光内衣内裤视频久久影院|