コード例 #1
0
EXPORT void CleanIndicatorsList(List **ppList)
{
	ListItem* handle;
	IndicatorSubscribers *pTempInd = NULL;	

	handle = CreateIterator(*ppList);

	//for each indicator struct- clean the subscribers list and free the IndicatorSubscribers struct:
	handle = Iterator_GetNext(*ppList, handle, (void**)&pTempInd);
	while (handle != NULL)
	{		
		List_Clear(&(pTempInd->subscribersList));
		List_Finalize(&(pTempInd->subscribersList));
		free(pTempInd);
		pTempInd = NULL;
		handle = Iterator_GetNext(*ppList, handle, (void**)&pTempInd);
	}

	FreeIterator(*ppList);
	List_Clear(*ppList);

	List_Finalize(*ppList);
	free(*ppList);
	(*ppList) = NULL;
}
コード例 #2
0
ファイル: lsq_hash_table.c プロジェクト: Duznet/Struct
LSQ_IteratorT LSQ_GetElementByIndex(LSQ_HandleT handle, LSQ_KeyT key) {
    HashTableDataT* container = NULL;
    NodeT* node = NULL;    
    assert(handle != LSQ_HandleInvalid);
    container = (HashTableDataT*)handle;
    for(node = container->buckets[HashFunc(container, key)]; node != NULL && container->keyCompFunc(node->key, key) != 0; node = node->next);
    return CreateIterator(container, node, node != NULL ? ITS_DEREFERENCABLE : ITS_PAST_REAR);
}
コード例 #3
0
ファイル: lsq_hash_table.c プロジェクト: Duznet/Struct
LSQ_IteratorT LSQ_GetFrontElement(LSQ_HandleT handle) {
    int i = 0;
    HashTableDataT* container = NULL;
    IteratorT* iter = NULL;
    assert(handle != NULL);
    container = (HashTableDataT*)handle;
    iter = CreateIterator(container, NULL, ITS_BEFORE_FIRST);
    LSQ_AdvanceOneElement(iter);
    return iter;
}
コード例 #4
0
ファイル: Composite.cpp プロジェクト: z163/GoF23
Currency CompositeEquipment::NetPrice () {
    Iterator<Equipment*>* i = CreateIterator();
    Currency total = 0;

    for (i->First(); !i->IsDone(); i->Next()) {
        total += i->CurrentItem()->NetPrice();
    }
    delete i;
    return total;
}
コード例 #5
0
iFCOIter* cFCOSetImpl::Lookup(const cFCOName& name)
{
    cFCOIterImpl* pIter = CreateIterator(this);
    if(! pIter->SeekToFCO(name))
    {
        pIter->DestroyIter();
        pIter = NULL;
    }
    return pIter;
}
コード例 #6
0
ファイル: set.cpp プロジェクト: liujiayi771/CS106B
bool Set<ElemType>::IsSubsetOf(Set *otherSet)
{
    Iterator<ElemType> *iterator;
    bool result;

    result = true;
    iterator = CreateIterator();
    while (result && iterator->HasNext()) {
        if (!otherSet->Contains(iterator->Next()))
	           result = false;
    }
    delete iterator;
    return (result);
}
コード例 #7
0
ファイル: set.cpp プロジェクト: liujiayi771/CS106B
Set<ElemType> *Set<ElemType>::Intersection(Set *otherSet)
{
    Iterator<ElemType> *iterator;
    Set *result;

    result = new Set<ElemType>(cmp);
	    iterator = CreateIterator();
    while (iterator->HasNext()) {
        ElemType elem = iterator->Next();
        if (otherSet->Contains(elem))
            result->AddElement(elem);
    }
    delete iterator;
    return (result);
}
コード例 #8
0
void SWorldDetailsView::OnSelectionChanged()
{
	auto SelectedLevels = WorldModel->GetSelectedLevels();
	TArray<UObject*> TileProperties;
	
	for (auto It = SelectedLevels.CreateIterator(); It; ++It)
	{
		UObject* PropertiesObject = (*It)->GetNodeObject();
		if (PropertiesObject)
		{
			TileProperties.Add(PropertiesObject);
		}
	}

	DetailsView->SetObjects(TileProperties, true);
}
コード例 #9
0
ファイル: set.cpp プロジェクト: liujiayi771/CS106B
Set<ElemType> *Set<ElemType>::Union(Set *otherSet)
{
	    Iterator<ElemType> *iterator;
    Set *result;
    
    result = new Set<ElemType>(cmp);
    iterator = CreateIterator();
    while (iterator->HasNext()) {
        result->AddElement(iterator->Next());
    }
    delete iterator;
    iterator = otherSet->CreateIterator();
    while (iterator->HasNext()) {
        result->AddElement(iterator->Next());
    }
    delete iterator;
    return (result);
}
コード例 #10
0
void SVisualLoggerFilters::CreateFiltersMenuCategoryForGraph(FMenuBuilder& MenuBuilder, FName MenuCategory) const
{
	auto FiltersFromGraph = GraphFilters[MenuCategory];
	for (auto Iter = FiltersFromGraph.CreateIterator(); Iter; ++Iter)
	{
		FName Name = **Iter;
		const FText& LabelText = FText::FromString(Name.ToString());
		MenuBuilder.AddMenuEntry(
			LabelText,
			FText::Format(LOCTEXT("FilterByTooltipPrefix", "Filter by {0}"), LabelText),
			FSlateIcon(),
			FUIAction(
			FExecuteAction::CreateSP(this, &SVisualLoggerFilters::FilterByTypeClicked, MenuCategory, Name),
			FCanExecuteAction(),
			FIsActionChecked::CreateSP(this, &SVisualLoggerFilters::IsAssetTypeActionsInUse, MenuCategory, Name),
			FIsActionButtonVisible::CreateLambda([this, LabelText]()->bool{return this->GraphsFilter.Len() == 0 || LabelText.ToString().Find(this->GraphsFilter) != INDEX_NONE; })),
			NAME_None,
			EUserInterfaceActionType::ToggleButton
			);
	}
}
コード例 #11
0
//find the relevant InidicatorsSubscribers Item.
//bCreateNew - boolean which indicate to create a new entry to the specific id if not exist
EXPORT IndicatorSubscribers *GetIndicatorSubscribers(List *pList, UINT32 indication_id, BOOL bCreateNew)
{
	ListItem* handle;
	IndicatorSubscribers *pTempInd = NULL;

	if(pList == NULL)
	{
		return NULL;
	}

	handle = CreateIterator(pList);

	handle = Iterator_GetNext(pList, handle, (void**)&pTempInd);
	while (handle != NULL)
	{
		if(pTempInd->id	== indication_id)//this is the Item
		{
			FreeIterator(pList);
			return pTempInd;
		}
		handle = Iterator_GetNext(pList, handle, (void**)&pTempInd);
	}
	FreeIterator(pList);

	if (TRUE == bCreateNew)
	{
		//No such indicator list for the specific id - generate new one
		pTempInd = (IndicatorSubscribers*)malloc(sizeof(IndicatorSubscribers));
		pTempInd->id = indication_id;
		List_Init(&(pTempInd->subscribersList), TRUE);
		List_AddItem(pList, pTempInd);
		return pTempInd;
	}

	return NULL;
}
コード例 #12
0
ファイル: array.c プロジェクト: Larkina/Data-structures
/* Функция, возвращающая итератор, ссылающийся на элемент с указанным индексом */
extern LSQ_IteratorT LSQ_GetElementByIndex(LSQ_HandleT handle, LSQ_IntegerIndexT index){
	return CreateIterator(handle, index);
}
コード例 #13
0
ファイル: lsq_hash_table.c プロジェクト: Duznet/Struct
LSQ_IteratorT LSQ_GetPastRearElement(LSQ_HandleT handle) {
    assert(handle != LSQ_HandleInvalid);
    return CreateIterator((HashTableDataT*)handle, NULL, ITS_PAST_REAR);
}
コード例 #14
0
iFCOIter* cFCOSetImpl::GetIter()
{
    return CreateIterator(this);
}
コード例 #15
0
ファイル: array.c プロジェクト: Larkina/Data-structures
/* Функция, возвращающая итератор, ссылающийся на первый элемент контейнера */
extern LSQ_IteratorT LSQ_GetFrontElement(LSQ_HandleT handle){
	return CreateIterator(handle, 0);
}
コード例 #16
0
ファイル: array.c プロジェクト: Larkina/Data-structures
/* Функция, возвращающая итератор, ссылающийся на элемент следующий за последним контейнера */
extern LSQ_IteratorT LSQ_GetPastRearElement(LSQ_HandleT handle){
	return (handle != LSQ_HandleInvalid) ? CreateIterator(handle, ((ArrayPtrT)handle)->physical_size ) : 0; 
}
コード例 #17
0
// This  function go over the specific list (L4 SS or status SS) and send all its registered targets the indication.
// Can be used as the InternalHandler with Messenger_PostRequest
EXPORT void SendIndicationToSubscribers( UINT32 internalRequestID, void *_buffer, UINT32 bufferLength )
{
	SendIndData *buffer = _buffer;
	ListItem* handle;
	L5_TARGET_ID targetID;
	// Instead of storing a pointer in the 'pData' field of the ListItem, the indicator ID is stored there.
	// Since the size of a pointer may be larger than the size of an L5_TARGET_ID, a pointer needs to be used
	// with Iterator_GetNext() to store the indicator ID, before copying the value to an L5_TARGET_ID.
	void *data;
	L5_RESULT res;
	IndicatorSubscribers *indSubscribers;
	List tempList;
	
	UNREFERENCED_PARAMETER(bufferLength);
	
	//TODO: use FailedDeliveryIndication if available to notify on send failure.

	// go over the list and send indications to all targets
	indSubscribers = GetIndicatorSubscribers(buffer->pSubscribersList, buffer->indication_id, FALSE);

	TRACE(TR_MOD_WRAPPER_LOGS, TR_SEV_DEBUG,"SendIndicationToSubscribers(IN) - internalRequestID=%d, indSubscribers=%d, pSubscribersList=%d, indication_id=%d",
									internalRequestID ,indSubscribers, buffer->pSubscribersList, buffer->indication_id);
	if ((NULL != indSubscribers) && (0 != List_Length(&(indSubscribers->subscribersList))))
	{		
		// Build temp list
		List_Init(&tempList, FALSE);
		handle = CreateIterator(&(indSubscribers->subscribersList));
		handle = Iterator_GetNext(&(indSubscribers->subscribersList), handle, (void**)(&data));
		while (handle != NULL)
		{
			List_AddItem(&tempList, data);
			handle = Iterator_GetNext(&(indSubscribers->subscribersList), handle, (void**)(&data));
		}

		FreeIterator(&(indSubscribers->subscribersList));

		//iterate the temp list and send the targets indication:
		handle = CreateIterator(&tempList);
		handle = Iterator_GetNext(&tempList, handle, (void**)(&data));
		while (handle != NULL)
		{
			targetID = (L5_TARGET_ID) data;

			//in case we are working with remote DnD, we want to send the trace and monitor indications 
			//only to the DnD agent
			if(((L3_L4_OPCODE_REPORT_MONITOR_EVACUATE != wimaxll_le16_to_cpu(*((UINT16 *)buffer->indication_buffer))) &&
				(L3_L4_OPCODE_REPORT_TRACE_EVACUATE != wimaxll_le16_to_cpu(*((UINT16 *)buffer->indication_buffer)))) ||
				(L5_TARGET_DND_AGENT == targetID))
			{
				TRACE(TR_MOD_WRAPPER_LOGS, TR_SEV_DEBUG,"SendIndicationToSubscribers - senderL5Conn=0x%x, targetID=%d, internalRequestID=%d",
													buffer->senderL5Conn, targetID, internalRequestID);
				res = buffer->pSenderFuncs->pfnSendReceiveMessage(
										buffer->senderL5Conn,  
										targetID, 
										internalRequestID, 
										buffer->indication_buffer, buffer->indication_buffer_size, 
										NULL, NULL, NULL);

				if ( L5_RESULT_ID_NOT_FOUND == res)
				{
					Indications_RemoveSubscriber(indSubscribers , targetID);
				}

			}

			handle = Iterator_GetNext(&tempList, handle, (void**)(&data));

			// TODO - XXX - check L5_COMMON_UTILS_IsTargetNotExist
			// TODO - XXX - check res
			// TODO - XXX - check responseID
		}

		FreeIterator(&tempList);

		//free the temp list items:
		List_Clear(&tempList);
		List_Finalize(&tempList);
	}
	else
	{
		TRACE(TR_MOD_WRAPPER_LOGS, TR_SEV_DEBUG,"SendIndicationToSubscribers - no subscribers");
	}
}