-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
137 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,4 @@ enable_testing() | |
set_property(GLOBAL PROPERTY USE_FOLDERS ON) | ||
add_subdirectory(code) | ||
|
||
add_subdirectory(Template) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FILE(GLOB_RECURSE newList *.h) | ||
set(dirList "") | ||
foreach(arg ${newList}) | ||
get_filename_component(dirPath ${arg} PATH) | ||
get_filename_component(folderName ${dirPath} NAME) | ||
set(dirList ${dirList} ${folderName}) | ||
endforeach() | ||
LIST(REMOVE_DUPLICATES dirList) | ||
foreach(subDir ${dirList}) | ||
add_subdirectory(${subDir}) | ||
endforeach() | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
add_subdirectory(Behavior) | ||
add_subdirectory(Create) | ||
add_subdirectory(Struct) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FILE(GLOB_RECURSE newList *.hpp) | ||
set(dirList "") | ||
foreach(arg ${newList}) | ||
get_filename_component(dirPath ${arg} PATH) | ||
get_filename_component(folderName ${dirPath} NAME) | ||
set(dirList ${dirList} ${folderName}) | ||
endforeach() | ||
LIST(REMOVE_DUPLICATES dirList) | ||
foreach(subDir ${dirList}) | ||
add_subdirectory(${subDir}) | ||
endforeach() | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
get_filename_component(tarName ${CMAKE_CURRENT_SOURCE_DIR} NAME) | ||
aux_source_directory(. SRC) | ||
file(GLOB_RECURSE CURRENT_HEADERS *.h *.hpp) | ||
add_executable(${tarName} ${SRC} ${CURRENT_HEADERS}) | ||
add_test(NAME ${tarName} COMMAND ${tarName}) | ||
set_target_properties(${tarName} PROPERTIES FOLDER TemplatePattern) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
template <class T> | ||
class SingleTon | ||
{ | ||
public: | ||
static T &GetInstance() | ||
{ | ||
static T t; | ||
return t; | ||
} | ||
virtual ~SingleTon() {} | ||
SingleTon(const SingleTon &) = delete; | ||
SingleTon(SingleTon &&) = delete; | ||
SingleTon &operator=(const SingleTon &) = delete; | ||
SingleTon &operator=(SingleTon &&) = delete; | ||
|
||
protected: | ||
SingleTon() {} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "SingleTon.hpp" | ||
#include <chrono> | ||
#include <iostream> | ||
#include <string> | ||
#include <thread> | ||
#include <vector> | ||
using namespace std; | ||
class App : public SingleTon<App> | ||
{ | ||
friend class SingleTon<App>; | ||
|
||
public: | ||
~App() {} | ||
void showName() | ||
{ | ||
cout << "name " << endl; | ||
} | ||
|
||
protected: | ||
App() {} | ||
}; | ||
void show(int n) | ||
{ | ||
this_thread::sleep_for(chrono::milliseconds(n)); | ||
cout << &App::GetInstance() << endl; | ||
} | ||
int main() | ||
{ | ||
std::vector<std::thread> threadList; | ||
const int N = 10; | ||
for (int i = 0; i < N; ++i) | ||
{ | ||
threadList.push_back(thread(show, N - i)); | ||
} | ||
for (int i = 0; i < N; ++i) | ||
{ | ||
threadList[i].join(); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FILE(GLOB_RECURSE newList *.h) | ||
set(dirList "") | ||
foreach(arg ${newList}) | ||
get_filename_component(dirPath ${arg} PATH) | ||
get_filename_component(folderName ${dirPath} NAME) | ||
set(dirList ${dirList} ${folderName}) | ||
endforeach() | ||
LIST(REMOVE_DUPLICATES dirList) | ||
foreach(subDir ${dirList}) | ||
add_subdirectory(${subDir}) | ||
endforeach() | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters