move "data collection <>" to new folder.

This commit is contained in:
hyzboy 2024-10-31 01:49:20 +08:00
parent 7b70926751
commit 768004d109
16 changed files with 186 additions and 147 deletions

View File

@ -1,4 +1,7 @@
macro(cm_example_project sub_folder project_name)
add_executable(${project_name} ${ARGN})
target_link_libraries(${project_name} PRIVATE CMCore CMPlatform CMUtil tsl::robin_map)
if(UNIX)
@ -22,164 +25,81 @@
set_property(TARGET ${project_name} PROPERTY FOLDER "CM/Examples/${sub_folder}")
endmacro()
macro(set_example_project_folder sub_folder project_name)
set_property(TARGET ${project_name} PROPERTY FOLDER "CM/Examples/${sub_folder}")
endmacro()
####################################################################################################
cm_example_project("Debug" DebugObject debug/DebugObject.cpp)
####################################################################################################
add_executable(DebugObject debug/DebugObject.cpp)
CM_EXAMPLE_PROJECT("Debug" DebugObject)
cm_example_project("DataType/RAM" RuntimeAssetManagerTest datatype/ram/RuntimeAssetManagerTest.cpp
datatype/ram/RuntimeAssetManager.h
datatype/ram/RAM_TestClass.h
datatype/ram/RAM_TestClass.cpp)
####################################################################################################
add_executable(TypeSizeof datatype/TypeSizeof.cpp)
CM_EXAMPLE_PROJECT("DataType" TypeSizeof)
cm_example_project("DataType" TypeSizeof datatype/TypeSizeof.cpp)
cm_example_project("DataType" TypeCastTest datatype/TypeCastTest.cpp)
cm_example_project("DataType" HalfFloatTest datatype/HalfFloatTest.cpp)
cm_example_project("DataType" SplitStringTest datatype/SplitStringTest.cpp)
cm_example_project("DataType" StrChrTest datatype/strchr_test.cpp)
cm_example_project("DataType" Uint2StrTest datatype/utos_test.cpp)
cm_example_project("DataType" Size2Test datatype/Size2Test.cpp)
cm_example_project("DataType" Uint2HexStrTest datatype/Uint2HexStrTest.cpp)
add_executable(TypeCastTest datatype/TypeCastTest.cpp)
cm_example_project("DataType" TypeCastTest)
add_executable(HalfFloatTest datatype/HalfFloatTest.cpp)
cm_example_project("DataType" HalfFloatTest)
add_executable(SplitStringTest datatype/SplitStringTest.cpp)
cm_example_project("DataType" SplitStringTest ${CM_NATVIS})
add_executable(StrChrTest datatype/strchr_test.cpp)
cm_example_project("DataType" StrChrTest)
add_executable(Uint2StrTest datatype/utos_test.cpp)
cm_example_project("DataType" Uint2StrTest)
add_executable(RuntimeAssetManagerTest datatype/ram/RuntimeAssetManagerTest.cpp
datatype/ram/RuntimeAssetManager.h
datatype/ram/RAM_TestClass.h
datatype/ram/RAM_TestClass.cpp)
cm_example_project("DataType/RAM" RuntimeAssetManagerTest)
add_executable(Size2Test datatype/Size2Test.cpp)
cm_example_project("DataType" Size2Test)
add_executable(Uint2HexStrTest datatype/Uint2HexStrTest.cpp)
cm_example_project("DataType" Uint2HexStrTest)
add_executable(ConstStringSetTest datatype/ConstStringSetTest.cpp)
cm_example_project("DataType" ConstStringSetTest)
add_executable(IDNameTest datatype/IDNameTest.cpp)
cm_example_project("DataType" IDNameTest)
cm_example_project("DataType" ConstStringSetTest datatype/ConstStringSetTest.cpp)
cm_example_project("DataType" IDNameTest datatype/IDNameTest.cpp)
####################################################################################################
add_executable(OutputEpsilon math/OutputEpsilon.cpp)
CM_EXAMPLE_PROJECT("Math" OutputEpsilon)
add_executable(TransformBenchmark math/TransformBenchmark.cpp)
CM_EXAMPLE_PROJECT("Math" TransformBenchmark)
cm_example_project("Math" OutputEpsilon math/OutputEpsilon.cpp)
cm_example_project("Math" TransformBenchmark math/TransformBenchmark.cpp)
####################################################################################################
add_executable(LifetimeTest datatype/LifetimeTest.cpp)
set_example_project_folder("DataType/DataArray" LifetimeTest)
add_executable(CollectionTest datatype/CollectionTest.cpp)
cm_example_project("DataType/DataArray" CollectionTest)
add_executable(DataArrayTest datatype/DataArrayTest.cpp)
set_example_project_folder("DataType/DataArray" DataArrayTest)
add_executable(StackTest datatype/StackTest.cpp)
set_example_project_folder("DataType/DataArray" StackTest)
add_executable(QueueTest datatype/QueueTest.cpp)
set_example_project_folder("DataType/DataArray" QueueTest)
add_executable(PoolTest datatype/PoolTest.cpp)
set_example_project_folder("DataType/DataArray" PoolTest)
add_executable(MapTest datatype/MapTest.cpp)
set_example_project_folder("DataType/DataArray" MapTest)
add_executable(StackPoolTest datatype/StackPoolTest.cpp)
set_example_project_folder("DataType/DataArray" StackPoolTest)
add_executable(DataChainTest datatype/DataChainTest.cpp)
cm_example_project("DataType/DataArray" DataChainTest)
add_executable(DataChainTest2 datatype/DataChainTest2.cpp)
cm_example_project("DataType/DataArray" DataChainTest2)
cm_example_project("DataType/Collection" LifetimeTest datatype/collection/LifetimeTest.cpp)
cm_example_project("DataType/Collection" CollectionTest datatype/collection/CollectionTest.cpp)
cm_example_project("DataType/Collection" DataArrayTest datatype/collection/DataArrayTest.cpp)
cm_example_project("DataType/Collection" StackTest datatype/collection/StackTest.cpp)
cm_example_project("DataType/Collection" QueueTest datatype/collection/QueueTest.cpp)
cm_example_project("DataType/Collection" PoolTest datatype/collection/PoolTest.cpp)
cm_example_project("DataType/Collection" MapTest datatype/collection/MapTest.cpp)
cm_example_project("DataType/Collection" MultiMapTest datatype/collection/MultiMapTest.cpp)
cm_example_project("DataType/Collection" StackPoolTest datatype/collection/StackPoolTest.cpp)
cm_example_project("DataType/Collection" DataChainTest datatype/collection/DataChainTest.cpp)
cm_example_project("DataType/Collection" DataChainTest2 datatype/collection/DataChainTest2.cpp)
cm_example_project("DataType/Collection" ResManagerTest datatype/collection/ResourceManagerTest.cpp)
####################################################################################################
add_executable(Pick2DTest pick/Pick2DTest.cpp)
cm_example_project("Pick" Pick2DTest)
cm_example_project("Pick" Pick2DTest pick/Pick2DTest.cpp)
target_link_libraries(Pick2DTest PRIVATE CM2D)
####################################################################################################
add_executable(1_ActiveIDManagerTest datatype/ActiveIDManagerTest.cpp)
cm_example_project("DataType/ActiveManager" 1_ActiveIDManagerTest)
add_executable(2_ActiveMemoryBlockManagerTest datatype/ActiveMemoryBlockManagerTest.cpp)
cm_example_project("DataType/ActiveManager" 2_ActiveMemoryBlockManagerTest)
add_executable(3_ActiveDataManagerTest datatype/ActiveDataManagerTest.cpp)
cm_example_project("DataType/ActiveManager" 3_ActiveDataManagerTest)
cm_example_project("DataType/ActiveManager" 1_ActiveIDManagerTest datatype/ActiveIDManagerTest.cpp)
cm_example_project("DataType/ActiveManager" 2_ActiveMemoryBlockManagerTest datatype/ActiveMemoryBlockManagerTest.cpp)
cm_example_project("DataType/ActiveManager" 3_ActiveDataManagerTest datatype/ActiveDataManagerTest.cpp)
####################################################################################################
add_executable(FixFilenameTest filesystem/FixFilenameTest.cpp)
cm_example_project("File System" FixFilenameTest)
add_executable(EnumFileTest filesystem/EnumFileTest.cpp)
cm_example_project("File System" EnumFileTest)
cm_example_project("File System" FixFilenameTest filesystem/FixFilenameTest.cpp)
cm_example_project("File System" EnumFileTest filesystem/EnumFileTest.cpp)
IF(WIN32)
add_executable(EnumVolumeTest filesystem/EnumVolumeTest.cpp)
cm_example_project("File System" EnumVolumeTest)
cm_example_project("File System" EnumVolumeTest filesystem/EnumVolumeTest.cpp)
ENDIF(WIN32)
####################################################################################################
add_executable(GetCpuInfo GetCpuInfo.cpp)
cm_example_project("Hareware" GetCpuInfo)
add_executable(CreateBinaryH CreateBinaryH.cpp)
cm_example_project("" CreateBinaryH)
add_executable(NormalCompressTest NormalCompressTest.cpp)
CM_EXAMPLE_PROJECT("" NormalCompressTest)
add_executable(OSFontList OSFontList.cpp)
cm_example_project("os" OSFontList)
target_link_libraries(OSFontList PRIVATE CMUtil)
add_executable(TimeCount time/time_count.cpp)
cm_example_project("time" TimeCount)
cm_example_project("Hareware" GetCpuInfo GetCpuInfo.cpp)
cm_example_project("Source" CreateBinaryH CreateBinaryH.cpp)
cm_example_project("Image" NormalCompressTest NormalCompressTest.cpp)
cm_example_project("os" OSFontList OSFontList.cpp)
cm_example_project("time" TimeCount time/time_count.cpp)
####################################################################################################
add_executable(DistributionChart2D DistributionChart2D.cpp BitmapFont.cpp BitmapFont.h)
cm_example_project("chart" DistributionChart2D)
cm_example_project("chart" DistributionChart2D DistributionChart2D.cpp BitmapFont.cpp BitmapFont.h)
target_link_libraries(DistributionChart2D PRIVATE CM2D)
add_executable(PlayerTraceChart2D PlayerTraceChart2D.cpp BitmapFont.cpp BitmapFont.h)
cm_example_project("chart" PlayerTraceChart2D)
cm_example_project("chart" PlayerTraceChart2D PlayerTraceChart2D.cpp BitmapFont.cpp BitmapFont.h)
target_link_libraries(PlayerTraceChart2D PRIVATE CM2D)
####################################################################################################
add_executable(PAttribTest utils/PAttribTest.cpp)
cm_example_project("utils" PAttribTest)
add_executable(Base64Test utils/base64test.cpp)
cm_example_project("utils" Base64Test)
add_executable(HashTest utils/HashTest.cpp)
cm_example_project("utils" HashTest)
add_executable(SeriesPoolTest utils/SeriesPoolTest.cpp)
cm_example_project("utils" SeriesPoolTest)
cm_example_project("utils" PAttribTest utils/PAttribTest.cpp)
cm_example_project("utils" Base64Test utils/base64test.cpp)
cm_example_project("utils" HashTest utils/HashTest.cpp)
cm_example_project("utils" SeriesPoolTest utils/SeriesPoolTest.cpp)
####################################################################################################
OPTION(CM_EXAMPLES_ABOUT_ANDROID OFF)

View File

@ -1,8 +0,0 @@
struct Person
{
char name[128];
bool sex;
int age;
};
template<typename T> Table

View File

@ -30,7 +30,9 @@ void out_data_chain(DataChain *dc)
int os_main(int,os_char **)
{
DataChain dc(100); ///数据链管理器(预定100个块)
DataChain dc;
dc.Init(100); ///数据链管理器(预定100个块)
cout<<"DataChain Test"<<endl;

View File

@ -33,7 +33,9 @@ int os_main(int,os_char **)
{
constexpr const int BLOCK_SIZE=100;
DataChain dc(BLOCK_SIZE); ///数据链管理器
DataChain dc;
dc.Init(BLOCK_SIZE); ///数据链管理器
cout<<"DataChain Test"<<endl;

View File

@ -80,13 +80,13 @@ public:
}
};
template<typename T> class TestRawArray:public TestArray<T,DataLifetimeCallback<T>>
template<typename T> class TestRawArray:public TestArray<T,DataLifecycleManager<T>>
{
DataLifetimeCallback<T> life_cb;
DataLifecycleManager<T> life_cb;
public:
TestRawArray():TestArray<T,DataLifetimeCallback<T>>(&life_cb){}
TestRawArray():TestArray<T,DataLifecycleManager<T>>(&life_cb){}
~TestRawArray()=default;
};
@ -124,13 +124,13 @@ public:
int Get()const{return value;}
};
template<typename T> class TestObjectArray:public TestArray<T *,ObjectLifetimeCallback<T>>
template<typename T> class TestObjectArray:public TestArray<T *,ObjectLifecycleManager<T>>
{
DefaultObjectLifetimeCallback<T> life_cb;
public:
TestObjectArray():TestArray<T *,ObjectLifetimeCallback<T>>(&life_cb){}
TestObjectArray():TestArray<T *,ObjectLifecycleManager<T>>(&life_cb){}
virtual ~TestObjectArray()
{
for(T *p:*this)
@ -144,7 +144,7 @@ public:
if(!life_cb.Create(&p))
return nullptr;
TestArray<T *,ObjectLifetimeCallback<T>>::Add(p);
TestArray<T *,ObjectLifecycleManager<T>>::Add(p);
return p;
}

View File

@ -0,0 +1,23 @@
//多重map测试
//多重map指的是一套数据含有多个关键字每个关键字都可以用来查找数据这样的数据结构称为多重map。
struct Person
{
char name[128];
bool sex;
int age;
};
template<typename T> class MultiMapIndex
{
};
template<typename T> class MultiMap
{
List<T> data_list;
public:
};

View File

@ -0,0 +1,76 @@
/**
*
*
*
*
*
*
*
*/
#include<hgl/type/LifetimeCallback.h>
#include<hgl/type/object/ObjectBaseInfo.h>
#include<hgl/type/object/ObjectManager.h>
#include<hgl/type/List.h>
using namespace hgl;
struct RefRecord;
struct RefUser;
struct ResObject;
/**
*
*/
struct RefRecord
{
constexpr const static unsigned int ACTION_INC=1; ///<增加引用
constexpr const static unsigned int ACTION_DEC=2; ///<减少引用
public:
ObjectSimpleInfo user_osi; ///<引用者对象简单信息
uint action; ///<动作
int new_ref_count; ///<新的引用计数
};
/**
*
*/
struct RefUser
{
ObjectSimpleInfo user_osi; ///<对象简单信息
};
/**
*
*/
class ResObject:public ObjectSimpleInfo
{
int ref_count; ///<引用计数
List<RefRecord> ref_record_list; ///<引用记录列表
public:
const int GetRefCount()const noexcept{return ref_count;}
/**
*
*/
virtual void IncRef() noexcept
{
++ref_count;
}
public:
};//class ResObject
class ResManager:public ObjectManager
{
public:
};

24
math/DirectMatrix.cpp Normal file
View File

@ -0,0 +1,24 @@
#include<hgl/Time.h>
#include<hgl/math/Matrix.h>
#include<iostream>
#include<random>
const hgl::Matrix4f DirectTranslate(const hgl::Vector3f &off)
{
hgl::Matrix4f result;
result[0][0]=1; result[1][0]=0; result[2][0]=0; result[3][0]=off.x;
result[0][1]=0; result[1][1]=1; result[2][1]=0; result[3][1]=off.y;
result[0][2]=0; result[1][2]=0; result[2][2]=1; result[3][2]=off.z;
result[0][3]=0; result[1][3]=0; result[2][3]=0; result[3][3]=1;
hgl::Matrix4f m=hgl::translate(off);
return(result);
}
int main()
{
DirectTranslate(hgl::Vector3f(4,5,6));
return 0;
}