commit 2025-09-04 22:02 add ZCppMainTest/ZtCObjList_000.cpp & ZCppMainTest/ZtCThreadEx_001.cpp
This commit is contained in:
178
ZCppMainTest/ZtCObjList_000.cpp
Normal file
178
ZCppMainTest/ZtCObjList_000.cpp
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include "ZCppMain/ZtCObjList.H"
|
||||||
|
#include "ZCppMain/ZtCStringEx.H"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace std ;
|
||||||
|
using namespace ZNsMain ;
|
||||||
|
|
||||||
|
|
||||||
|
namespace ZNsMain
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace ZNsExam
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename TDummy=void*> class ZtCExamCObjList
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef ZtCStringBase<char> CStringBase ;
|
||||||
|
typedef const CStringBase CCStringBase;
|
||||||
|
|
||||||
|
/* 아래 자료형에 대해, CStringBase::Fetch() 호출 여부 실험.
|
||||||
|
|
||||||
|
ZtCObjList<CStringBase&, CCStringBase&>
|
||||||
|
ZtCObjList<CStringBase&, CCCStringBase&>
|
||||||
|
|
||||||
|
*/
|
||||||
|
typedef ZtCObjList
|
||||||
|
<CStringBase, CStringBase& > CStringList1 ;
|
||||||
|
typedef ZtCObjList
|
||||||
|
<CStringBase, CCStringBase&> CStringList2 ;
|
||||||
|
|
||||||
|
|
||||||
|
static void ShowDataInNode(const CStringBase& AR_Data)
|
||||||
|
{
|
||||||
|
cout<<"* Data : "<<AR_Data<<endl;
|
||||||
|
}/*
|
||||||
|
static void ShowDataInNode(const CStringBase& AR_Data)*/
|
||||||
|
|
||||||
|
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||||
|
{
|
||||||
|
CStringBase VO_CStringBase;
|
||||||
|
CStringList1 VO_ListOfStr1 ;
|
||||||
|
CStringList2 VO_ListOfStr2 ;
|
||||||
|
|
||||||
|
VO_ListOfStr1.AddTail(VO_CStringBase("data 10"));
|
||||||
|
VO_ListOfStr1.AddTail(VO_CStringBase("data 40"));
|
||||||
|
VO_ListOfStr1.AddTail(VO_CStringBase("data 20"));
|
||||||
|
VO_ListOfStr1.AddTail(VO_CStringBase("data 40"));
|
||||||
|
VO_ListOfStr1.AddTail(VO_CStringBase("data 04"));
|
||||||
|
|
||||||
|
cout<<"# VO_CStringBase data : " <<VO_CStringBase<<endl;
|
||||||
|
|
||||||
|
cout<<"# 1th IterElement ####" <<endl;
|
||||||
|
{
|
||||||
|
VO_ListOfStr1.IterElement(&ShowDataInNode);
|
||||||
|
}
|
||||||
|
/*///////////////////////////////////*/
|
||||||
|
|
||||||
|
|
||||||
|
cout<<endl;
|
||||||
|
|
||||||
|
|
||||||
|
VO_ListOfStr2.AddTail(VO_CStringBase("data 10"));
|
||||||
|
VO_ListOfStr2.AddTail(VO_CStringBase("data 40"));
|
||||||
|
VO_ListOfStr2.AddTail(VO_CStringBase("data 20"));
|
||||||
|
VO_ListOfStr2.AddTail(VO_CStringBase("data 40"));
|
||||||
|
VO_ListOfStr2.AddTail(VO_CStringBase("data 04"));
|
||||||
|
|
||||||
|
cout<<"# VO_CStringBase data : " <<VO_CStringBase<<endl;
|
||||||
|
|
||||||
|
cout<<"# 2th IterElement ####" <<endl;
|
||||||
|
{
|
||||||
|
VO_ListOfStr2.IterElement(&ShowDataInNode);
|
||||||
|
}
|
||||||
|
/*///////////////////////////////////*/
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}/*
|
||||||
|
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
};/*
|
||||||
|
template<typename TDummy=void*> class ZtCExamCObjList*/
|
||||||
|
|
||||||
|
}/*
|
||||||
|
namespace ZNsExam*/
|
||||||
|
|
||||||
|
}/*
|
||||||
|
namespace ZNsMain*/
|
||||||
|
|
||||||
|
|
||||||
|
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||||
|
{
|
||||||
|
return ZNsMain::ZNsExam::
|
||||||
|
|
||||||
|
ZtCExamCObjList<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||||
|
}/*
|
||||||
|
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||||
|
|
||||||
|
|
||||||
|
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
■ cigwin 컴파일
|
||||||
|
|
||||||
|
// g++ -mno-cygwin -o ZtCObjList_000.exe ZtCObjList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||||
|
// g++ -mno-cygwin -o ZtCObjList_000_D.exe ZtCObjList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||||
|
|
||||||
|
■ mingw 컴파일
|
||||||
|
|
||||||
|
g++.exe -o ZtCObjList_000_mw.exe ZtCObjList_000.cpp -I../ -lWs2_32
|
||||||
|
g++.exe -o ZtCObjList_000_mw_D.exe ZtCObjList_000.cpp -I../ -lWs2_32 -D_DEBUG
|
||||||
|
|
||||||
|
./ZtCObjList_000_mw.exe
|
||||||
|
./ZtCObjList_000_mw_D.exe
|
||||||
|
|
||||||
|
|
||||||
|
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||||
|
# date
|
||||||
|
Sun Aug 24 10:47:09 KST 2025
|
||||||
|
|
||||||
|
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||||
|
# g++ --version
|
||||||
|
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||||
|
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||||
|
This is free software; see the source for copying conditions. There is NO
|
||||||
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
|
||||||
|
■ Linux 컴파일
|
||||||
|
|
||||||
|
g++ -std=c++98 -o ZtCObjList_000.exe ZtCObjList_000.cpp -I../
|
||||||
|
g++ -std=c++98 -o ZtCObjList_000_D.exe ZtCObjList_000.cpp -I../ -D_DEBUG
|
||||||
|
|
||||||
|
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||||
|
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||||
|
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||||
|
This is free software; see the source for copying conditions. There is NO
|
||||||
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||||
|
Sun Aug 24 00:05:51 DST 2025
|
||||||
|
|
||||||
|
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||||
|
NAME="Ubuntu"
|
||||||
|
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||||
|
ID=ubuntu
|
||||||
|
ID_LIKE=debian
|
||||||
|
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||||
|
VERSION_ID="20.04"
|
||||||
|
HOME_URL="https://www.ubuntu.com/"
|
||||||
|
SUPPORT_URL="https://help.ubuntu.com/"
|
||||||
|
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||||
|
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||||
|
VERSION_CODENAME=focal
|
||||||
|
UBUNTU_CODENAME=focal
|
||||||
|
|
||||||
|
|
||||||
|
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||||
|
CentOS Linux release 7.9.2009 (Core)
|
||||||
|
|
||||||
|
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||||
|
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||||
|
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||||
|
This is free software; see the source for copying conditions. There is NO
|
||||||
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
■ 실행
|
||||||
|
|
||||||
|
./ZtCObjList_000.exe
|
||||||
|
./ZtCObjList_000_D.exe
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////*/
|
225
ZCppMainTest/ZtCThreadEx_001.cpp
Normal file
225
ZCppMainTest/ZtCThreadEx_001.cpp
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#ifndef _REENTRANT_EX
|
||||||
|
#define _REENTRANT_EX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include "ZCppMain/ZCProcess.H"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace std ;
|
||||||
|
using namespace ZNsMain;
|
||||||
|
|
||||||
|
|
||||||
|
namespace ZNsMain
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace ZNsExam
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename TDummy=void*> class ZtCExamThread_001
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
class ZCThreadMy : public ZNsMain::ZtCThreadEx<ZCThreadMy>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef ZNsMain::ZtCThreadEx<ZCThreadMy> TypeBase;
|
||||||
|
public:
|
||||||
|
static int GI_CallCnt;
|
||||||
|
public:
|
||||||
|
|
||||||
|
void Init()
|
||||||
|
{
|
||||||
|
this->TypeBase::Init(); cout<<"* Init0() : "<<++ZCThreadMy::GI_CallCnt<<endl;
|
||||||
|
}
|
||||||
|
void Exec()
|
||||||
|
{
|
||||||
|
this->TypeBase::Exec(); cout<<"* Exec0() : "<<++ZCThreadMy::GI_CallCnt<<endl;
|
||||||
|
}
|
||||||
|
void Fini()
|
||||||
|
{
|
||||||
|
this->TypeBase::Fini(); cout<<"* Fini0() : "<<++ZCThreadMy::GI_CallCnt<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Init(int& ARRI_CallCnt)
|
||||||
|
{
|
||||||
|
this->TypeBase::template Init<int&>(ARRI_CallCnt); cout<<"* Init1() : "<<++ARRI_CallCnt<<endl;
|
||||||
|
}
|
||||||
|
void Exec(int& ARRI_CallCnt)
|
||||||
|
{
|
||||||
|
this->TypeBase::template Exec<int&>(ARRI_CallCnt); cout<<"* Exec1() : "<<++ARRI_CallCnt<<endl;
|
||||||
|
}
|
||||||
|
void Fini(int& ARRI_CallCnt)
|
||||||
|
{
|
||||||
|
this->TypeBase::template Fini<int&>(ARRI_CallCnt); cout<<"* Fini1() : "<<++ARRI_CallCnt<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Init(int& ARRI_CallCnt, int& ARRI_CallCnt2)
|
||||||
|
{
|
||||||
|
this->TypeBase::template Init
|
||||||
|
<int&, int&>(ARRI_CallCnt, ARRI_CallCnt2);
|
||||||
|
|
||||||
|
cout<<"* Init2() : "<<++ARRI_CallCnt<<", "<<ARRI_CallCnt2<<endl;
|
||||||
|
}
|
||||||
|
void Exec(int& ARRI_CallCnt, int& ARRI_CallCnt2)
|
||||||
|
{
|
||||||
|
this->TypeBase::template Exec
|
||||||
|
<int&, int&>(ARRI_CallCnt, ARRI_CallCnt2);
|
||||||
|
|
||||||
|
cout<<"* Init2() : "<<++ARRI_CallCnt<<", "<<ARRI_CallCnt2<<endl;
|
||||||
|
}
|
||||||
|
void Fini(int& ARRI_CallCnt, int& ARRI_CallCnt2)
|
||||||
|
{
|
||||||
|
this->TypeBase::template Fini
|
||||||
|
<int&, int&>(ARRI_CallCnt, ARRI_CallCnt2);
|
||||||
|
|
||||||
|
cout<<"* Init2() : "<<++ARRI_CallCnt<<", "<<ARRI_CallCnt2<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Init(int& ARRI_CallCnt, int& ARRI_CallCnt2, int& ARRI_CallCnt3)
|
||||||
|
{
|
||||||
|
this->TypeBase::template Init<int&, int&, int&>
|
||||||
|
( ARRI_CallCnt, ARRI_CallCnt2, ARRI_CallCnt3 ) ;
|
||||||
|
|
||||||
|
cout<<"* Init3() : "<<++ARRI_CallCnt<<", "<<ARRI_CallCnt2<<", "<<ARRI_CallCnt3<<endl;
|
||||||
|
}
|
||||||
|
void Exec(int& ARRI_CallCnt, int& ARRI_CallCnt2, int& ARRI_CallCnt3)
|
||||||
|
{
|
||||||
|
this->TypeBase::template Exec<int&, int&, int&>
|
||||||
|
( ARRI_CallCnt, ARRI_CallCnt2, ARRI_CallCnt3 ) ;
|
||||||
|
|
||||||
|
cout<<"* Init3() : "<<++ARRI_CallCnt<<", "<<ARRI_CallCnt2<<", "<<ARRI_CallCnt3<<endl;
|
||||||
|
}
|
||||||
|
void Fini(int& ARRI_CallCnt, int& ARRI_CallCnt2, int& ARRI_CallCnt3)
|
||||||
|
{
|
||||||
|
this->TypeBase::template Fini<int&, int&, int&>
|
||||||
|
( ARRI_CallCnt, ARRI_CallCnt2, ARRI_CallCnt3 ) ;
|
||||||
|
|
||||||
|
cout<<"* Init3() : "<<++ARRI_CallCnt<<", "<<ARRI_CallCnt2<<", "<<ARRI_CallCnt3<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
};/*
|
||||||
|
class ZCThreadMy : public ZNsMain::ZtCThreadEx<ZCThreadMy>*/
|
||||||
|
|
||||||
|
|
||||||
|
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)
|
||||||
|
{
|
||||||
|
ZCThreadMy VO_CThreadMy ;
|
||||||
|
|
||||||
|
VO_CThreadMy.Make();
|
||||||
|
cout<<"# Press Enter to continue."<<endl; cin.get();
|
||||||
|
VO_CThreadMy.Make(ZftMCP(ZCThreadMy::GI_CallCnt));
|
||||||
|
cout<<"# Press Enter to continue."<<endl; cin.get();
|
||||||
|
VO_CThreadMy.Make(ZftMCP(ZCThreadMy::GI_CallCnt), ZftMCP(ZCThreadMy::GI_CallCnt));
|
||||||
|
cout<<"# Press Enter to continue."<<endl; cin.get();
|
||||||
|
VO_CThreadMy.Make(ZftMCP(ZCThreadMy::GI_CallCnt), ZftMCP(ZCThreadMy::GI_CallCnt), ZftMCP(ZCThreadMy::GI_CallCnt));
|
||||||
|
cout<<"# Press Enter to continue."<<endl; cin.get();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}/*
|
||||||
|
static int Main(int AI_ArgCnt=0, char* APP_ArgVal[]=0)*/
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
};/*
|
||||||
|
template<typename TDummy=void*> class ZtCExamThread_001*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template<typename TDummy> int
|
||||||
|
ZtCExamThread_001<TDummy>::ZCThreadMy::GI_CallCnt =0 ;
|
||||||
|
|
||||||
|
}/*
|
||||||
|
namespace ZNsExam*/
|
||||||
|
|
||||||
|
}/*
|
||||||
|
namespace ZNsMain*/
|
||||||
|
|
||||||
|
|
||||||
|
int main(int AI_ArgCnt, char* APP_ArgVal[])
|
||||||
|
{
|
||||||
|
return ZNsMain::ZNsExam::
|
||||||
|
|
||||||
|
ZtCExamThread_001<>::Main(AI_ArgCnt, APP_ArgVal);
|
||||||
|
}/*
|
||||||
|
int main(int AI_ArgCnt, char* APP_ArgVal[])*/
|
||||||
|
|
||||||
|
|
||||||
|
/*////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
■ cigwin 컴파일
|
||||||
|
|
||||||
|
// g++ -mno-cygwin -o ZtCThreadEx_001.exe ZtCThreadEx_001.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300
|
||||||
|
// g++ -mno-cygwin -o ZtCThreadEx_001_D.exe ZtCThreadEx_001.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG
|
||||||
|
|
||||||
|
■ mingw 컴파일
|
||||||
|
|
||||||
|
g++.exe -o ZtCThreadEx_001_mw.exe ZtCThreadEx_001.cpp -I../
|
||||||
|
g++.exe -o ZtCThreadEx_001_mw_D.exe ZtCThreadEx_001.cpp -I../ -D_DEBUG
|
||||||
|
|
||||||
|
./ZtCThreadEx_001_mw.exe
|
||||||
|
./ZtCThreadEx_001_mw_D.exe
|
||||||
|
|
||||||
|
|
||||||
|
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||||
|
# date
|
||||||
|
Sun Aug 24 10:47:09 KST 2025
|
||||||
|
|
||||||
|
Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest
|
||||||
|
# g++ --version
|
||||||
|
g++.exe (Rev2, Built by MSYS2 project) 13.2.0
|
||||||
|
Copyright (C) 2023 Free Software Foundation, Inc.
|
||||||
|
This is free software; see the source for copying conditions. There is NO
|
||||||
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
|
||||||
|
■ Linux 컴파일
|
||||||
|
|
||||||
|
g++ -std=c++98 -o ZtCThreadEx_001.exe ZtCThreadEx_001.cpp -I../ -lpthread
|
||||||
|
g++ -std=c++98 -o ZtCThreadEx_001_D.exe ZtCThreadEx_001.cpp -I../ -lpthread -D_DEBUG
|
||||||
|
|
||||||
|
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version
|
||||||
|
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
|
||||||
|
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||||
|
This is free software; see the source for copying conditions. There is NO
|
||||||
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date
|
||||||
|
Sun Aug 24 00:05:51 DST 2025
|
||||||
|
|
||||||
|
sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release
|
||||||
|
NAME="Ubuntu"
|
||||||
|
VERSION="20.04.6 LTS (Focal Fossa)"
|
||||||
|
ID=ubuntu
|
||||||
|
ID_LIKE=debian
|
||||||
|
PRETTY_NAME="Ubuntu 20.04.6 LTS"
|
||||||
|
VERSION_ID="20.04"
|
||||||
|
HOME_URL="https://www.ubuntu.com/"
|
||||||
|
SUPPORT_URL="https://help.ubuntu.com/"
|
||||||
|
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
|
||||||
|
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
|
||||||
|
VERSION_CODENAME=focal
|
||||||
|
UBUNTU_CODENAME=focal
|
||||||
|
|
||||||
|
|
||||||
|
[sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release
|
||||||
|
CentOS Linux release 7.9.2009 (Core)
|
||||||
|
|
||||||
|
[sauron@q381-2657 ZCppMainTest]$ g++ --version
|
||||||
|
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
|
||||||
|
Copyright (C) 2015 Free Software Foundation, Inc.
|
||||||
|
This is free software; see the source for copying conditions. There is NO
|
||||||
|
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
■ 실행
|
||||||
|
|
||||||
|
./ZtCThreadEx_001.exe
|
||||||
|
./ZtCThreadEx_001_D.exe
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////*/
|
Reference in New Issue
Block a user