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


C++ Ptr::ClassName方法代码示例

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


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

示例1: TestObjectsFlushRemovesStackPointers

void TestObjectsFlushRemovesStackPointers(void)
{
	CFileUtil						cFileUtil;
	Ptr<CTestDoubleNamedString>		pDouble;
	Ptr<CRoot>						pRoot;

	cFileUtil.RemoveDir("Output");
	cFileUtil.MakeDir("Output/ClearPointers");

	ObjectsInit("Output/ClearPointers");
	SetupObjectsConstructors();

	pRoot = ORoot();

	gcObjects.Flush(TRUE, TRUE);
	AssertLongLongInt(2, gcObjects.NumDatabaseObjects());

	AssertNull(&pRoot);

	pDouble = ONMalloc(CTestDoubleNamedString, "Double")->Init();
	AssertString("CTestDoubleNamedString", pDouble.ClassName());

	pRoot = ORoot();
	AssertString("CRoot", pRoot.ClassName());

	ObjectsKill();
}
开发者ID:andrewpaterson,项目名称:Codaphela.Test,代码行数:27,代码来源:TestObjects.cpp

示例2: TestObjectsFlushClearGetByOid

void TestObjectsFlushClearGetByOid(void)
{
	CFileUtil						cFileUtil;
	CPointer						pObject;
	Ptr<CTestDoubleNamedString>		pDouble;
	Ptr<CRoot>						pRoot;

	cFileUtil.RemoveDir("Output");
	cFileUtil.MakeDir("Output/Dehollowfication");

	ObjectsInit("Output/Dehollowfication");
	SetupObjectsConstructors();
	
	pRoot = ORoot();
	pDouble = ONMalloc(CTestDoubleNamedString, "Double")->Init();
	pRoot->Add(pDouble);
	AssertLongLongInt(0, gcObjects.NumDatabaseObjects());
	pObject = gcObjects.Get(3);
	AssertNotNull(pObject.Object());
	AssertString("CTestDoubleNamedString", pObject.ClassName());

	gcObjects.Flush(TRUE, TRUE);
	AssertLongLongInt(3, gcObjects.NumDatabaseObjects());

	pObject = gcObjects.Get(3);
	AssertNotNull(pObject.Object());
	AssertString("CTestDoubleNamedString", pObject.ClassName());
	
	pRoot = ORoot();
	AssertString("CRoot", pRoot.ClassName());

	pObject = gcObjects.Get("Double");
	AssertNotNull(pObject.Object());
	AssertString("CTestDoubleNamedString", pObject.ClassName());
	AssertString("CRoot", pRoot.ClassName());

	ObjectsKill();
}
开发者ID:andrewpaterson,项目名称:Codaphela.Test,代码行数:38,代码来源:TestObjects.cpp

示例3: TestDehollowficationFromChunkFileSource

void TestDehollowficationFromChunkFileSource(void)
{
	CFileUtil		cFileUtil;

	cFileUtil.RemoveDir("Output\\Dehollowfication\\ChunkFile");

	MemoryInit();
	ObjectsInit("Output\\Dehollowfication\\Temp");
	WriteDehollowficationChunkedFile();
	ObjectsKill();
	MemoryKill();
	cFileUtil.RemoveDir("Output\\Dehollowfication\\Temp");

	CObjectSourceChunked* pcObjectSourceChunked;


	CDiskFile*	pcDiskFile = DiskFile("Output\\Dehollowfication\\ChunkFile\\Double.DRG");

	MemoryInit();
	ObjectsInit("Output\\Dehollowfication\\Temp");
	SetupDehollowficationConstructors();

	pcObjectSourceChunked = (CObjectSourceChunked*)gcObjects.AddSource<CObjectConverterNative>(pcDiskFile, "Double");  //Note the .DRG is intentionally dropped.
	AssertNotNull(pcObjectSourceChunked);

	AssertInt(4, pcObjectSourceChunked->NumNames());
	AssertString("Diamond End", pcObjectSourceChunked->GetName(0));
	AssertString("Double Start", pcObjectSourceChunked->GetName(1));
	AssertString("NamedString 1", pcObjectSourceChunked->GetName(2));
	AssertString("NamedString 2", pcObjectSourceChunked->GetName(3));

	Ptr<CTestDoubleNamedString> pStart;

	pStart = gcObjects.Get("Double Start");
	AssertTrue(pStart.IsNotNull());
	AssertString("CTestDoubleNamedString", pStart.ClassName());

	AssertTrue(pStart->mpSplit1.IsHollow());
	AssertTrue(pStart->mpSplit2.IsHollow());
	AssertFalse(pStart->mszString.IsHollow());

	pStart->mpSplit1->ClassName();
	AssertFalse(pStart->mpSplit1.IsHollow());
	AssertString("CTestNamedString", pStart->mpSplit1.ClassName());

	ObjectsKill();
	MemoryKill();
}
开发者ID:andrewpaterson,项目名称:Codaphela.Test,代码行数:48,代码来源:TestDehollowfication.cpp

示例4: TestEmbeddedObjectPointTo

void TestEmbeddedObjectPointTo(void)
{
	BOOL		bResult;
	CFileUtil	cFileUtil;
	OIndex		oiComplex;
	char*		szClassName;
	
	cFileUtil.RemoveDir("Output/EmbeddedObject");

	MemoryInit();
	ObjectsInit("Output/EmbeddedObject/");
	SetupEmbeddedObjectConstructors();

	Ptr<CRoot> pRoot = ORoot();
	Ptr<CEmbeddedComplex> pComplex = OMalloc(CEmbeddedComplex)->Init();
	oiComplex = pComplex->GetOI();

	Ptr<CEmbeddedContainer> pContainer = &pComplex->mcContainer;
	pRoot->Add(pContainer);

	bResult = gcObjects.Flush(TRUE, TRUE);
	AssertTrue(bResult);

	ObjectsKill();
	MemoryKill();

	AssertNull(&pContainer);

	MemoryInit();
	ObjectsInit("Output/EmbeddedObject/");
	SetupEmbeddedObjectConstructors();

	pRoot = gcObjects.GetRoot();
	AssertTrue(pRoot.IsNotNull());
	pContainer = pRoot->Get(0);
	AssertTrue(pContainer.IsHollow());
	AssertInt(0, pContainer.Object()->GetNumEmbedded());
	AssertLongLongInt(-1, pContainer.GetIndex());

	szClassName = pContainer->ClassName();
	AssertString("CEmbeddedContainer", szClassName);

	pComplex = pContainer->GetEmbeddingContainer();
	//Kinda feels like this test just stopped...

	ObjectsKill();
	MemoryKill();
}
开发者ID:andrewpaterson,项目名称:Codaphela.Test,代码行数:48,代码来源:TestEmbedded.cpp

示例5: TestDehollowficationFromDatabase

void TestDehollowficationFromDatabase(void)
{
	CIndexedConfig	cConfig;
	CFileUtil		cFileUtil;

	cConfig.Manual("Output\\Dehollowfication\\Database",
					FALSE,
					TRUE,
					FALSE,
					1 MB);

	cFileUtil.RemoveDir("Output\\Dehollowfication\\Database");

	MemoryInit();
	ObjectsInit(&cConfig);
	SetupDehollowficationScene();
	gcObjects.Flush(FALSE, FALSE);
	ObjectsKill();
	MemoryKill();

	MemoryInit();
	ObjectsInit(&cConfig);
	SetupDehollowficationConstructors();
	AssertLongLongInt(0, gcUnknowns.NumElements());
	AssertInt(0, gcObjects.GetStackPointers()->UsedPointers());

	AssertLongLongInt(0, gcObjects.NumMemoryIndexes());
	AssertLongLongInt(0, gcObjects.NumMemoryNames());
	AssertLongLongInt(11, gcObjects.NumDatabaseObjects());
	AssertLongLongInt(0, gcObjects.NumDatabaseObjectsCached());
	AssertLongLongInt(6, gcObjects.NumDatabaseNames());

	Ptr<CRoot> pRoot = ORoot();

	AssertTrue(pRoot->IsSetHollow());

	AssertLongLongInt(2, gcUnknowns.NumElements());
	AssertLongLongInt(2, gcObjects.NumMemoryIndexes());
	AssertLongLongInt(1, gcObjects.NumMemoryNames());
	AssertLongLongInt(1, gcObjects.NumDatabaseObjectsCached());
	AssertLongLongInt(6, gcObjects.NumDatabaseNames());
	AssertInt(1, gcObjects.GetStackPointers()->UsedPointers());

	Ptr<CTestDoubleNamedString> pTest = pRoot->Get<CTestDoubleNamedString>("Double Start");  //This will cause pRoot.Set to be dehollowed.
	AssertInt(2, gcObjects.GetStackPointers()->UsedPointers());
	AssertFalse(pRoot->IsSetHollow());
	AssertTrue(pTest.IsNotNull());
	AssertTrue(pTest.IsHollow());
	AssertLongLongInt(10, pTest.GetIndex());
	AssertLongLongInt(4, gcUnknowns.NumElements());
	AssertLongLongInt(4, gcObjects.NumMemoryIndexes());
	
	AssertString("12345", pTest->mpSplit1->mszEmbedded.Text()); //This will cause pTest and pTest.Split1 to be dehollowed.
	AssertLongLongInt(9, gcUnknowns.NumElements());
	AssertLongLongInt(9, gcObjects.NumMemoryIndexes());
	AssertFalse(pTest.IsHollow());
	AssertLongLongInt(10, pTest.GetIndex());
	AssertInt(2, gcObjects.GetStackPointers()->UsedPointers());
	AssertTrue(pTest->mpSplit1->mpAnother.IsHollow());
	AssertTrue(pTest->mpSplit2.IsHollow());
	AssertTrue(pTest->mpSplit1->mszString.IsHollow());
	AssertString("Diamond End", pTest->mpSplit1->mpAnother.GetName());
	AssertString("6789", pTest->mpSplit1->mszString->Text());
	AssertFalse(pTest->mpSplit1->mszString.IsHollow());

	AssertInt(2, gcObjects.GetStackPointers()->UsedPointers());

	Ptr<CTestNamedString> pDiamond = pTest->mpSplit1->mpAnother;
	AssertLongLongInt(9, gcUnknowns.NumElements());
	AssertLongLongInt(9, gcObjects.NumMemoryIndexes());
	AssertInt(3, gcObjects.GetStackPointers()->UsedPointers());
	AssertTrue(pTest->mpSplit1->mpAnother.IsHollow());
	AssertTrue(pDiamond.IsHollow());

	pDiamond->ClassName(); //This will cause pDiamond to be de-hollowed

	AssertFalse(pDiamond.IsHollow());
	AssertFalse(pTest->mpSplit1->mpAnother.IsHollow());

	AssertLongLongInt(10, gcUnknowns.NumElements());
	AssertLongLongInt(10, gcObjects.NumMemoryIndexes());
	AssertLongLongInt(6, gcObjects.NumMemoryNames());
	AssertLongLongInt(3, gcObjects.NumDatabaseObjectsCached());
	AssertLongLongInt(6, gcObjects.NumDatabaseNames());

	AssertTrue(pTest->mpSplit2.IsHollow());
	pTest->mpSplit2->ClassSize();
	AssertFalse(pTest->mpSplit2.IsHollow());
	AssertFalse(pTest->mpSplit2->mpAnother.IsHollow());
	AssertPointer(pDiamond.Object(), pTest->mpSplit2->mpAnother.Object());

	AssertLongLongInt(11, gcObjects.NumMemoryIndexes());
	AssertLongLongInt(6, gcObjects.NumMemoryNames());
	AssertLongLongInt(2, gcObjects.NumDatabaseObjectsCached());
	AssertLongLongInt(6, gcObjects.NumDatabaseNames());

	Ptr<CTestNamedString> pRandom = pRoot->Get<CTestNamedString>("NamedString 3");
	AssertTrue(pRandom.IsNotNull());
	AssertTrue(pRandom.IsHollow());

//.........这里部分代码省略.........
开发者ID:andrewpaterson,项目名称:Codaphela.Test,代码行数:101,代码来源:TestDehollowfication.cpp

示例6: TestEmbeddedObjectContainerDehollowfication

void TestEmbeddedObjectContainerDehollowfication(void)
{
	BOOL		bResult;
	CFileUtil	cFileUtil;
	char*		szClassName;
	OIndex		oiComplex;

	cFileUtil.RemoveDir("Output/EmbeddedObject");

	MemoryInit();
	ObjectsInit("Output/EmbeddedObject/");
	SetupEmbeddedObjectConstructors();

	Ptr<CRoot> pRoot = ORoot();
	Ptr<CEmbeddedComplex> pComplex = OMalloc(CEmbeddedComplex)->Init();
	oiComplex = pComplex->GetOI();

	pRoot->Add(pComplex);

	bResult = gcObjects.Flush(TRUE, TRUE);
	AssertTrue(bResult);

	ObjectsKill();
	MemoryKill();

	AssertInt(176, sizeof(CEmbeddedTest));
	AssertInt(544, sizeof(CEmbeddedContainer));
	AssertInt(1032, sizeof(CEmbeddedComplex));

	MemoryInit();
	ObjectsInit("Output/EmbeddedObject/");
	SetupEmbeddedObjectConstructors();

	pRoot = gcObjects.GetRoot();
	AssertTrue(pRoot.IsNotNull());
	pComplex = pRoot->Get(0);
	AssertTrue(pComplex.IsHollow());
	
	szClassName = pComplex->ClassName();
	AssertString("CEmbeddedComplex", szClassName);
	AssertLongLongInt(oiComplex, pComplex.GetIndex());

	AssertInt(1, pComplex->mai[0]);
	AssertInt(2, pComplex->mai[1]);
	
	AssertLongLongInt(INVALID_O_INDEX, pComplex->mcSimple.GetOI());
	AssertInt(85, pComplex->mcSimple.miAmANumber);
	AssertFloat(58.0f, pComplex->mcSimple.mfSoAmI, 0);

	AssertLongLongInt(INVALID_O_INDEX, pComplex->mcContainer.GetOI());
	AssertInt(73, pComplex->mcContainer.mi);
	AssertFloat(666.0f, pComplex->mcContainer.mf, 0);
	AssertString("And", pComplex->mcContainer.msz);

	AssertLongLongInt(INVALID_O_INDEX, pComplex->mcContainer.mcOne.GetOI());
	AssertInt(85, pComplex->mcContainer.mcOne.miAmANumber);
	AssertFloat(58.0f, pComplex->mcContainer.mcOne.mfSoAmI, 0);

	AssertLongLongInt(INVALID_O_INDEX, pComplex->mcContainer.mcTwo.GetOI());
	AssertInt(85, pComplex->mcContainer.mcTwo.miAmANumber);
	AssertFloat(58.0f, pComplex->mcContainer.mcTwo.mfSoAmI, 0);

	AssertLongLongInt(3, gcObjects.NumMemoryIndexes());

	ObjectsKill();
	MemoryKill();
}
开发者ID:andrewpaterson,项目名称:Codaphela.Test,代码行数:67,代码来源:TestEmbedded.cpp


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