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


C++ TMap::Empty方法代码示例

本文整理汇总了C++中TMap::Empty方法的典型用法代码示例。如果您正苦于以下问题:C++ TMap::Empty方法的具体用法?C++ TMap::Empty怎么用?C++ TMap::Empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TMap的用法示例。


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

示例1: EnumerateChunkPartInventory

void FBuildPatchAppManifest::EnumerateChunkPartInventory(const TArray<FGuid>& ChunksRequired, TMap<FGuid, TArray<FFileChunkPart>>& ChunkPartsAvailable) const
{
	ChunkPartsAvailable.Empty();
	// Use a set to optimize
	TSet<FGuid> ChunksReqSet(ChunksRequired);
	// For each file in the manifest, check what chunks it is made out of, and grab details for the ones in ChunksRequired
	for (auto FileManifestIt = Data->FileManifestList.CreateConstIterator(); FileManifestIt && !FBuildPatchInstallError::HasFatalError(); ++FileManifestIt)
	{
		const FFileManifestData& FileManifest = *FileManifestIt;
		uint64 FileOffset = 0;
		for (auto ChunkPartIt = FileManifest.FileChunkParts.CreateConstIterator(); ChunkPartIt && !FBuildPatchInstallError::HasFatalError(); ++ChunkPartIt)
		{
			const FChunkPartData& ChunkPart = *ChunkPartIt;
			if (ChunksReqSet.Contains(ChunkPart.Guid))
			{
				TArray<FFileChunkPart>& FileChunkParts = ChunkPartsAvailable.FindOrAdd(ChunkPart.Guid);
				FFileChunkPart FileChunkPart;
				FileChunkPart.Filename = FileManifest.Filename;
				FileChunkPart.ChunkPart = ChunkPart;
				FileChunkPart.FileOffset = FileOffset;
				FileChunkParts.Add(FileChunkPart);
			}
			FileOffset += ChunkPart.Size;
		}
	}
}
开发者ID:johndpope,项目名称:UE4,代码行数:26,代码来源:BuildPatchManifest.cpp

示例2: LoadAssetRegistry

bool FChunkManifestGenerator::LoadAssetRegistry(const FString& SandboxPath, const TSet<FName>* PackagesToKeep)
{
	UE_LOG(LogChunkManifestGenerator, Display, TEXT("Loading asset registry."));

	// Load generated registry for each platform
	check(Platforms.Num() == 1);

	for (auto Platform : Platforms)
	{
		/*FString PlatformSandboxPath = SandboxPath.Replace(TEXT("[Platform]"), *Platform->PlatformName());
		FArchive* AssetRegistryReader = IFileManager::Get().CreateFileReader(*PlatformSandboxPath);*/

		FString PlatformSandboxPath = SandboxPath.Replace(TEXT("[Platform]"), *Platform->PlatformName());
		FArrayReader FileContents;
		if (FFileHelper::LoadFileToArray(FileContents, *PlatformSandboxPath) == false)
		{
			continue;
		}
		FArchive* AssetRegistryReader = &FileContents;

		TMap<FName, FAssetData*> SavedAssetRegistryData;
		TArray<FDependsNode*> DependencyData;
		if (AssetRegistryReader)
		{
			AssetRegistry.LoadRegistryData(*AssetRegistryReader, SavedAssetRegistryData, DependencyData);
		}
		for (auto& LoadedAssetData : AssetRegistryData)
		{
			if (PackagesToKeep &&
				PackagesToKeep->Contains(LoadedAssetData.PackageName) == false)
			{
				continue;
			}

			FAssetData* FoundAssetData = SavedAssetRegistryData.FindRef(LoadedAssetData.ObjectPath);
			if ( FoundAssetData )
			{
				LoadedAssetData.ChunkIDs.Append(FoundAssetData->ChunkIDs);
				
				SavedAssetRegistryData.Remove(LoadedAssetData.ObjectPath);
				delete FoundAssetData;
			}
		}

		for (const auto& SavedAsset : SavedAssetRegistryData)
		{
			if (PackagesToKeep && PackagesToKeep->Contains(SavedAsset.Value->PackageName))
			{ 
				AssetRegistryData.Add(*SavedAsset.Value);
			}
			
			delete SavedAsset.Value;
		}
		SavedAssetRegistryData.Empty();
	}
	return true;
}
开发者ID:VZout,项目名称:Team6UnrealEngine,代码行数:57,代码来源:ChunkManifestGenerator.cpp

示例3: ClearDelegateObjects

	void ClearDelegateObjects()
	{
		for (auto obj : DelegateObjects)
		{
			obj->RemoveFromRoot();
		}
		DelegateObjects.Empty();
		functions.Empty();
	}
开发者ID:Galvarezss,项目名称:Unreal.js,代码行数:9,代码来源:Delegates.cpp

示例4: EmptyD3DSamplerStateCache

void EmptyD3DSamplerStateCache()
{
	for (auto Iter = GSamplerStateCache.CreateIterator(); Iter; ++Iter )
	{
		auto* State = Iter.Value();
		// Manually release
		State->Release();
	}

	GSamplerStateCache.Empty();
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:11,代码来源:D3D11State.cpp

示例5: EmptyD3DSamplerStateCache

void EmptyD3DSamplerStateCache()
{
#if LOCK_GSamplerStateCache
	FScopeLock Lock(&GSamplerStateCacheLock);
#endif
	for (auto Iter = GSamplerStateCache.CreateIterator(); Iter; ++Iter )
	{
		auto* State = Iter.Value();
		// Manually release
		State->Release();
	}

	GSamplerStateCache.Empty();
}
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:14,代码来源:D3D11State.cpp

示例6: GenerateFieldMappings

void FBlueprintCompileReinstancer::GenerateFieldMappings(TMap<UObject*, UObject*>& FieldMapping)
{
	check(ClassToReinstance);

	FieldMapping.Empty();

	for (auto& Prop : PropertyMap)
	{
		FieldMapping.Add(Prop.Value, FindField<UProperty>(ClassToReinstance, *Prop.Key.ToString()));
	}

	for (auto& Func : FunctionMap)
	{
		UFunction* NewFunction = ClassToReinstance->FindFunctionByName(Func.Key, EIncludeSuperFlag::ExcludeSuper);
		FieldMapping.Add(Func.Value, NewFunction);
	}

	UObject* NewCDO = ClassToReinstance->GetDefaultObject();
	FieldMapping.Add(OriginalCDO, NewCDO);
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:20,代码来源:KismetReinstanceUtilities.cpp

示例7:

	~FProtoMessagePool()
	{
		for (TMap<TWeakObjectPtr<UFunction>, PoolMapping>::TIterator It(Pool); It; ++It)
		{
			PoolMapping& PM = It.Value();
			// Delete all the non-prototype versions of the message in the pool
			MessagePoolElem* Elem = PM.FreeList;
			while (Elem)
			{
				MessagePoolElem* NextElem = Elem->Next();
				delete (*Elem)->Msg;
				delete Elem;
				Elem = NextElem;
			}
		}

		Pool.Empty();

		// Optional:  Delete all global objects allocated by libprotobuf.
		google::protobuf::ShutdownProtobufLibrary();
	}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:21,代码来源:OnlineMsgSteam.cpp

示例8: ProcessCmdString


//.........这里部分代码省略.........
					else if (CmdToken == NAME_Fatal)
					{
						Value &= ~ELogVerbosity::VerbosityMask;
						Value |= ELogVerbosity::Fatal;
					}
					else if (CmdToken == NAME_Error)
					{
						Value &= ~ELogVerbosity::VerbosityMask;
						Value |= ELogVerbosity::Error;
					}
					else if (CmdToken == NAME_Warning)
					{
						Value &= ~ELogVerbosity::VerbosityMask;
						Value |= ELogVerbosity::Warning;
					}
					else if (CmdToken == NAME_Log)
					{
						Value &= ~ELogVerbosity::VerbosityMask;
						Value |= ELogVerbosity::Log;
					}
					else if (CmdToken == NAME_Display)
					{
						Value &= ~ELogVerbosity::VerbosityMask;
						Value |= ELogVerbosity::Display;
					}
					else if (CmdToken == NAME_Verbose)
					{
						Value &= ~ELogVerbosity::VerbosityMask;
						Value |= ELogVerbosity::Verbose;
					}
					else if (CmdToken == NAME_VeryVerbose || CmdToken == NAME_All)
					{
						Value &= ~ELogVerbosity::VerbosityMask;
						Value |= ELogVerbosity::VeryVerbose;
					}
					else if (CmdToken == NAME_Default)
					{
						if (CategoryVerbosities.Num() && !FromBoot)
						{
							Value = CategoryVerbosities[0]->DefaultVerbosity;
						}
					}
					else if (CmdToken == NAME_Off)
					{
						Value &= ~ELogVerbosity::VerbosityMask;
						Value |= ELogVerbosity::Fatal;
					}
					else if (CmdToken == NAME_On)
					{
						Value &= ~ELogVerbosity::VerbosityMask;
							// try to get a non-zero value from the toggle backup
							uint8* Toggle = ToggleAssociations.Find(Category);
							if (Toggle && *Toggle)
							{
								Value |= *Toggle;
							}
							else
							{
								Value |= ELogVerbosity::All;
							}
					}
					else if (CmdToken == NAME_Break)
					{
						Value ^= ELogVerbosity::BreakOnLog;
					}
				}
			}
			if (Category != NAME_Reset)
			{
				if (FromBoot)
				{
					if (Category == NAME_BootGlobal)
					{
						// changing the global at boot removes everything set up so far
						BootAssociations.Empty();
					}
					BootAssociations.Add(Category, Value);
				}
				else
				{
					for (int32 CategoryIndex = 0; CategoryIndex < CategoryVerbosities.Num(); CategoryIndex++)
					{
						FLogCategoryBase* Verb = CategoryVerbosities[CategoryIndex];
						Verb->SetVerbosity(ELogVerbosity::Type(Value));
					}
					if (Category == NAME_Global)
					{
						// if this was a global change, we need to change them all
						ApplyGlobalChanges();
					}
				}
				// store off the last non-zero one for toggle
				if (Value & ELogVerbosity::VerbosityMask)
				{
					// currently on, store this in the pending and clear it
					ToggleAssociations.Add(Category, Value & ELogVerbosity::VerbosityMask);
				}
			}
		}
	}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:101,代码来源:OutputDevices.cpp

示例9: MergeInFunctionNodes

// TODO: Refactor this (and some other stuff) into a preprocessing step for use by any compiler?
bool FNiagaraCompiler::MergeInFunctionNodes()
{
	struct FReconnectionInfo
	{
	public:
		UEdGraphPin* From;
		TArray<UEdGraphPin*> To;

		//Fallback default value if an input connection is not connected.
		FString FallbackDefault;

		FReconnectionInfo()
			: From(NULL)
		{}
	};
	TMap<FName, FReconnectionInfo> InputConnections;
	TMap<FName, FReconnectionInfo> OutputConnections;

	TArray<class UEdGraphPin*> FuncCallInputPins;
	TArray<class UEdGraphPin*> FuncCallOutputPins;

	//Copies the function graph into the main graph.
	//Removes the Function call in the main graph and the input and output nodes in the function graph, reconnecting their pins appropriately.
	auto MergeFunctionIntoMainGraph = [&](UNiagaraNodeFunctionCall* InFunc, UNiagaraGraph* FuncGraph)
	{
		InputConnections.Empty();
		OutputConnections.Empty();
		FuncCallInputPins.Empty();
		FuncCallOutputPins.Empty();

		check(InFunc && FuncGraph);
		if (InFunc->FunctionScript)
		{
			//Get all the pins that are connected to the inputs of the function call node in the main graph.
			InFunc->GetInputPins(FuncCallInputPins);
			for (UEdGraphPin* FuncCallInputPin : FuncCallInputPins)
			{
				FName InputName(*FuncCallInputPin->PinName);
				FReconnectionInfo& InputConnection = InputConnections.FindOrAdd(InputName);
				if (FuncCallInputPin->LinkedTo.Num() > 0)
				{
					check(FuncCallInputPin->LinkedTo.Num() == 1);
					UEdGraphPin* LinkFrom = FuncCallInputPin->LinkedTo[0];
					check(LinkFrom->Direction == EGPD_Output);
					InputConnection.From = LinkFrom;
				}
				else
				{
					//This input has no link so we need the default value from the pin.
					InputConnection.FallbackDefault = FuncCallInputPin->GetDefaultAsString();
				}
			}
			//Get all the pins that are connected to the outputs of the function call node in the main graph.
			InFunc->GetOutputPins(FuncCallOutputPins);
			for (UEdGraphPin* FuncCallOutputPin : FuncCallOutputPins)
			{
				FName OutputName(*FuncCallOutputPin->PinName);
				for (UEdGraphPin* LinkTo : FuncCallOutputPin->LinkedTo)
				{
					check(LinkTo->Direction == EGPD_Input);
					FReconnectionInfo& OutputConnection = OutputConnections.FindOrAdd(OutputName);
					OutputConnection.To.Add(LinkTo);
				}
			}

			//Remove the function call node from the graph now that we have everything we need from it.
			SourceGraph->RemoveNode(InFunc);

			//Keep a list of the Input and Output nodes we see in the function graph so that we can remove (most of) them later.
			TArray<UEdGraphNode*, TInlineAllocator<64>> ToRemove;

			//Search the nodes in the function graph, finding any connections to input or output nodes.
			for (UEdGraphNode* FuncGraphNode : FuncGraph->Nodes)
			{
				if (UNiagaraNodeInput* InputNode = Cast<UNiagaraNodeInput>(FuncGraphNode))
				{
					check(InputNode->Pins.Num() == 1);
					//Get an array of "To" pins from one or more input nodes referencing each named input.
					FReconnectionInfo& InputConnection = InputConnections.FindOrAdd(InputNode->Input.Name);
					if (InputConnection.From)
					{
						//We have a connection from the function call so remove the input node and connect to that.
						ToRemove.Add(InputNode);
					}
					else
					{
						//This input has no connection from the function call so what do we do here? 
						//For now we just leave the input node and connect back to it. 
						//This will mean unconnected pins from the function call will look for constants or attributes. 
						//In some cases we may want to just take the default value from the function call pin instead?
						//Maybe have some properties on the function call defining that.
						InputConnection.From = InputNode->Pins[0];
					}

					TArray<UEdGraphPin*>& LinkToPins = InputNode->Pins[0]->LinkedTo;
					for (UEdGraphPin* ToPin : LinkToPins)
					{
						check(ToPin->Direction == EGPD_Input);
						InputConnection.To.Add(ToPin);
//.........这里部分代码省略.........
开发者ID:didixp,项目名称:Ark-Dev-Kit,代码行数:101,代码来源:NiagaraCompiler.cpp

示例10: ClearTagToFunctionMap

void IGameplayCueInterface::ClearTagToFunctionMap()
{
	PerClassGameplayTagToFunctionMap.Empty();
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:4,代码来源:GameplayCueInterface.cpp

示例11: OnPinMouseDown

FReply SGraphPin::OnPinMouseDown( const FGeometry& SenderGeometry, const FPointerEvent& MouseEvent )
{
	bIsMovingLinks = false;

	if (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton)
	{
		if (!GraphPinObj->bNotConnectable && IsEditable.Get())
		{
			if (MouseEvent.IsAltDown())
			{
				// Alt-Left clicking will break all existing connections to a pin
				const UEdGraphSchema* Schema = GraphPinObj->GetSchema();
				Schema->BreakPinLinks(*GraphPinObj, true);
				return FReply::Handled();
			}

			auto OwnerNodePinned = OwnerNodePtr.Pin();
			if (MouseEvent.IsControlDown() && (GraphPinObj->LinkedTo.Num() > 0))
			{
				// Get a reference to the owning panel widget
				check(OwnerNodePinned.IsValid());
				TSharedPtr<SGraphPanel> OwnerPanelPtr = OwnerNodePinned->GetOwnerPanel();
				check(OwnerPanelPtr.IsValid());

				// Obtain the set of all pins within the panel
				TSet<TSharedRef<SWidget> > AllPins;
				OwnerPanelPtr->GetAllPins(AllPins);

				// Construct a UEdGraphPin->SGraphPin mapping for the full pin set
				TMap< UEdGraphPin*, TSharedRef<SGraphPin> > PinToPinWidgetMap;
				for( TSet< TSharedRef<SWidget> >::TIterator ConnectorIt(AllPins); ConnectorIt; ++ConnectorIt )
				{
					const TSharedRef<SWidget>& SomePinWidget = *ConnectorIt;
					const SGraphPin& PinWidget = static_cast<const SGraphPin&>(SomePinWidget.Get());

					PinToPinWidgetMap.Add(PinWidget.GetPinObj(), StaticCastSharedRef<SGraphPin>(SomePinWidget));
				}

				// Define a local struct to temporarily store lookup information for pins that we are currently linked to
				struct LinkedToPinInfo
				{
					// Pin name string
					FString PinName;

					// A weak reference to the node object that owns the pin
					TWeakObjectPtr<UEdGraphNode> OwnerNodePtr;
				};

				// Build a lookup table containing information about the set of pins that we're currently linked to
				TArray<LinkedToPinInfo> LinkedToPinInfoArray;
				for( TArray<UEdGraphPin*>::TIterator LinkArrayIter(GetPinObj()->LinkedTo); LinkArrayIter; ++LinkArrayIter )
				{
					if (auto PinWidget = PinToPinWidgetMap.Find(*LinkArrayIter))
					{
						check((*PinWidget)->OwnerNodePtr.IsValid());

						LinkedToPinInfo PinInfo;
						PinInfo.PinName = (*PinWidget)->GetPinObj()->PinName;
						PinInfo.OwnerNodePtr = (*PinWidget)->OwnerNodePtr.Pin()->GetNodeObj();
						LinkedToPinInfoArray.Add(PinInfo);
					}
				}

				// Control-Left clicking will break all existing connections to a pin
				// Note that for some nodes, this can cause reconstruction. In that case, pins we had previously linked to may now be destroyed.
				const UEdGraphSchema* Schema = GraphPinObj->GetSchema();
				Schema->BreakPinLinks(*GraphPinObj, true);

				// Check to see if the panel has been invalidated by a graph change notification
				if (!OwnerPanelPtr->Contains(OwnerNodePinned->GetNodeObj()))
				{
					// Force the panel to update. This will cause node & pin widgets to be reinstanced to match any reconstructed node/pin object references.
					OwnerPanelPtr->Update();

					// Obtain the full set of pins again after the update
					AllPins.Empty(AllPins.Num());
					OwnerPanelPtr->GetAllPins(AllPins);

					// Rebuild the UEdGraphPin->SGraphPin mapping for the full pin set
					PinToPinWidgetMap.Empty(PinToPinWidgetMap.Num());
					for( TSet< TSharedRef<SWidget> >::TIterator ConnectorIt(AllPins); ConnectorIt; ++ConnectorIt )
					{
						const TSharedRef<SWidget>& SomePinWidget = *ConnectorIt;
						const SGraphPin& PinWidget = static_cast<const SGraphPin&>(SomePinWidget.Get());

						PinToPinWidgetMap.Add(PinWidget.GetPinObj(), StaticCastSharedRef<SGraphPin>(SomePinWidget));
					}
				}
				
				// Now iterate over our lookup table to find the instances of pin widgets that we had previously linked to
				TArray<TSharedRef<SGraphPin>> PinArray;
				for(auto LinkedToPinInfoIter = LinkedToPinInfoArray.CreateConstIterator(); LinkedToPinInfoIter; ++LinkedToPinInfoIter)
				{
					LinkedToPinInfo PinInfo = *LinkedToPinInfoIter;
					UEdGraphNode* OwnerNodeObj = PinInfo.OwnerNodePtr.Get();
					if(OwnerNodeObj != NULL)
					{
						for(auto PinIter = PinInfo.OwnerNodePtr.Get()->Pins.CreateConstIterator(); PinIter; ++PinIter)
						{
							UEdGraphPin* Pin = *PinIter;
//.........这里部分代码省略.........
开发者ID:johndpope,项目名称:UE4,代码行数:101,代码来源:SGraphPin.cpp

示例12: ScopeLock

void FChunkWriter::FQueuedChunkWriter::GetChunkFilesizes(TMap<FGuid, int64>& OutChunkFileSizes)
{
	FScopeLock ScopeLock(&ChunkFileSizesCS);
	OutChunkFileSizes.Empty(ChunkFileSizes.Num());
	OutChunkFileSizes.Append(ChunkFileSizes);
}
开发者ID:johndpope,项目名称:UE4,代码行数:6,代码来源:BuildPatchChunk.cpp

示例13: EmptyCache

void FVulkanVertexDeclaration::EmptyCache()
{
	GVertexDeclarationCache.Empty(0);
}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:4,代码来源:VulkanVertexDeclaration.cpp


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