添加命令模式

master
caiyuzheng 2020-06-10 21:23:42 +08:00
parent b9c99ae265
commit c0e9ef9b27
3 changed files with 8 additions and 7 deletions

View File

@ -30,9 +30,9 @@
</component>
<component name="ChangeListManager">
<list default="true" id="0facce0d-c642-4d80-b2fb-daf5f3e68dff" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/general/src/pattern/cmd.hpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/src/encrypt/aes.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/general/src/encrypt/aes.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/general/CMakeLists.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/general/src/pattern/cmd.hpp" beforeDir="false" afterPath="$PROJECT_DIR$/general/src/pattern/cmd.hpp" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -159,7 +159,7 @@
<workItem from="1589465397742" duration="4077000" />
<workItem from="1590041861831" duration="3306000" />
<workItem from="1590548574620" duration="180000" />
<workItem from="1590676222894" duration="1966000" />
<workItem from="1590676222894" duration="3290000" />
</task>
<servers />
</component>

View File

@ -34,7 +34,7 @@ aux_source_directory(src DIRSRCS)
aux_source_directory(src/pattern PaternSrc)
add_library(General OBJECT ${DIRSRCS} ${PaternSrc} src/pattern/signleton.hpp src/pattern/Observer.hpp src/pattern/stratergy.hpp "src/pattern/adapter.hpp" src/encrypt/base64.cpp src/encrypt/base64.h src/encrypt/aes.cpp src/encrypt/aes.h src/encrypt/rsa.cpp
add_library(General OBJECT ${DIRSRCS} ${PaternSrc} src/pattern/signleton.hpp src/pattern/cmd.hpp src/pattern/Observer.hpp src/pattern/stratergy.hpp "src/pattern/adapter.hpp" src/encrypt/base64.cpp src/encrypt/base64.h src/encrypt/aes.cpp src/encrypt/aes.h src/encrypt/rsa.cpp
src/math/BigInt.hpp src/net/TcpClient.cpp src/net/TcpClient.h src/net/PackageReceiver.cpp src/net/PackageReceiver.h src/function/Timer.cpp src/function/btree.cpp src/function/btree.h src/algorithm/sorter.hpp)
set(COPYITEM inc)

View File

@ -1,3 +1,4 @@
#ifndef GENERAL_CMD_H
#define GENERAL_CMD_H
#include <vector>
template<typename T>
@ -7,11 +8,11 @@ public:
return 0;
}
};
template<typename T>
class CommandBroker{
public:
void AddCommand(Command order){
void AddCommand(Command<T> order){
}
void DoCommand(){
for (Order order : orderList) {
@ -20,6 +21,6 @@ public:
orderList.clear();
}
private:
std::vector<Command> mCommands;
std::vector<Command<T>> mCommands;
};
#endif