From 358c62df57da601e0c2c14f38e705b17fa0fc87c Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 12 Dec 2022 17:24:42 +0800 Subject: [PATCH] 1 --- a8/a8.h | 10 ++++++++++ a8/args.h | 20 ++++++++++++++++++++ a8/types.h | 2 ++ 3 files changed, 32 insertions(+) create mode 100644 a8/args.h diff --git a/a8/a8.h b/a8/a8.h index 40ec32e..d0a29ac 100644 --- a/a8/a8.h +++ b/a8/a8.h @@ -3,6 +3,7 @@ #include +#include #include #include #include @@ -13,6 +14,7 @@ #include #include +#include #include #include #include @@ -31,6 +33,14 @@ namespace std class condition_variable; }; +namespace google +{ + namespace protobuf + { + class Message; + } +} + #define NEW_NET #define A8_SAFE_DELETE(p) { if(p){delete(p); (p)=nullptr;} } #define A8_DEFINE_RANGE_BIT(type, begin, end) ((((type)1) << (end + 1)) - 1) & (~((((type)1) << (begin + 0)) - 1)) diff --git a/a8/args.h b/a8/args.h new file mode 100644 index 0000000..e6630ea --- /dev/null +++ b/a8/args.h @@ -0,0 +1,20 @@ +#ifndef A8_ARGS_H +#define A8_ARGS_H + +namespace a8 +{ + class Args + { + public: + + Args(std::vector args):args_(std::move(args)) {}; + + template + T Get(size_t index) const { return std::any_cast(args_.at(index));}; + + private: + std::vector args_; + }; +} + +#endif diff --git a/a8/types.h b/a8/types.h index 1122210..650cb81 100644 --- a/a8/types.h +++ b/a8/types.h @@ -14,6 +14,8 @@ namespace a8 SendQueueNode* next = nullptr; }; + typedef std::function CommonCbProc; + const int INVALID_FD = -1; const int INVALID_SOCKET = -1; const int INVALID_SOCKET_HANDLE = 0;