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


C++ UObject::IsRooted方法代码示例

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


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

示例1: CloseDisregardForGC

void FUObjectArray::CloseDisregardForGC()
{
	check(IsInGameThread());
	check(OpenForDisregardForGC);

	// Iterate over all class objects and force the default objects to be created. Additionally also
	// assembles the token reference stream at this point. This is required for class objects that are
	// not taken into account for garbage collection but have instances that are.

	// Workaround for Visual Studio 2013 analyzer bug. Using a temporary directly in the range-for
	// errors if the analyzer is enabled.
	TObjectRange<UClass> Range;
	for (UClass* Class : Range)
	{
		// Force the default object to be created.
		Class->GetDefaultObject(); // Force the default object to be constructed if it isn't already
		// Assemble reference token stream for garbage collection/ RTGC.
		if (!Class->HasAnyClassFlags(CLASS_TokenStreamAssembled))
		{
			Class->AssembleReferenceTokenStream();
		}
	}

	if (GIsInitialLoad)
	{
		// Iterate over all objects and mark them to be part of root set.
		int32 NumAlwaysLoadedObjects = 0;
		int32 NumRootObjects = 0;
		for (FObjectIterator It; It; ++It)
		{
			UObject* Object = *It;
			if (Object->IsSafeForRootSet())
			{
				NumRootObjects++;
				Object->AddToRoot();
			}
			else if (Object->IsRooted())
			{
				Object->RemoveFromRoot();
			}
			NumAlwaysLoadedObjects++;
		}

		UE_LOG(LogUObjectArray, Log, TEXT("%i objects as part of root set at end of initial load."), NumAlwaysLoadedObjects);
		if (GUObjectArray.DisregardForGCEnabled())
		{
			UE_LOG(LogUObjectArray, Log, TEXT("%i objects are not in the root set, but can never be destroyed because they are in the DisregardForGC set."), NumAlwaysLoadedObjects - NumRootObjects);
		}

		// When disregard for GC pool is closed for the first time, make sure the first GC index is set after the last non-GC index.
		// We do allow here for some slack if MaxObjectsNotConsideredByGC > (ObjLastNonGCIndex + 1) so that disregard for GC pool
		// can be re-opened later.
		ObjFirstGCIndex = FMath::Max(ObjFirstGCIndex, ObjLastNonGCIndex + 1);

		GUObjectAllocator.BootMessage();
	}

	UE_LOG(LogUObjectArray, Log, TEXT("CloseDisregardForGC: %d/%d objects in disregard for GC pool"), ObjLastNonGCIndex + 1, MaxObjectsNotConsideredByGC);	

	OpenForDisregardForGC = false;
	GIsInitialLoad = false;
}
开发者ID:dineshone,项目名称:UnrealGameEngine,代码行数:62,代码来源:UObjectArray.cpp


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