From 1711af9db5f5aea4ffb8a0c39e76fe26eeeb93ef Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 21 Dec 2024 19:32:42 +0800 Subject: [PATCH] 1 --- third_party/a8/a8/a8.h | 1 - third_party/a8/a8/perfmonitor.h | 7 ++---- third_party/a8/a8/singleton.h | 35 ----------------------------- third_party/f8/f8/btmgr.h | 7 ++---- third_party/f8/f8/dbpool.h | 7 ++---- third_party/f8/f8/httpclientpool.cc | 5 +++++ third_party/f8/f8/httpclientpool.h | 7 ++---- third_party/f8/f8/jsonlog.h | 7 ++---- third_party/f8/f8/msgqueue.cc | 5 +++++ third_party/f8/f8/msgqueue.h | 7 ++---- third_party/f8/f8/scriptengine.h | 8 +++---- third_party/f8/f8/tglog.cc | 5 +++++ third_party/f8/f8/tglog.h | 7 ++---- third_party/f8/f8/timer.cc | 5 +++++ third_party/f8/f8/timer.h | 8 ++----- third_party/f8/f8/udplog.h | 7 ++---- 16 files changed, 41 insertions(+), 87 deletions(-) delete mode 100644 third_party/a8/a8/singleton.h diff --git a/third_party/a8/a8/a8.h b/third_party/a8/a8/a8.h index bbebc81..68052af 100644 --- a/third_party/a8/a8/a8.h +++ b/third_party/a8/a8/a8.h @@ -19,7 +19,6 @@ #include #include #include -#include #include #include diff --git a/third_party/a8/a8/perfmonitor.h b/third_party/a8/a8/perfmonitor.h index 1a69c78..7882d77 100644 --- a/third_party/a8/a8/perfmonitor.h +++ b/third_party/a8/a8/perfmonitor.h @@ -3,12 +3,9 @@ namespace a8 { - class PerfMonitor : public a8::Singleton + class PerfMonitor { - private: - PerfMonitor(); - friend class a8::Singleton; - + A8_DECLARE_SINGLETON(PerfMonitor); public: void Init(); void UnInit(); diff --git a/third_party/a8/a8/singleton.h b/third_party/a8/a8/singleton.h deleted file mode 100644 index 7cf1ca8..0000000 --- a/third_party/a8/a8/singleton.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include - -namespace a8 -{ - - template - class Singleton - { - public: - - static T* Instance() - { - if (!instance_) { - // 二次检查 - if (!instance_) { - instance_ = std::shared_ptr (new T()); - } - } - - return instance_.get(); - } - - protected: - Singleton() {} //防止实例 - Singleton(const Singleton&) {} //防止拷贝构造一个实例 - Singleton& operator=(const Singleton&){} //防止赋值出另一个实例 - ~Singleton() {} - - private: - static inline std::shared_ptr instance_; - }; - -} diff --git a/third_party/f8/f8/btmgr.h b/third_party/f8/f8/btmgr.h index 459296f..93d4374 100644 --- a/third_party/f8/f8/btmgr.h +++ b/third_party/f8/f8/btmgr.h @@ -12,12 +12,9 @@ namespace behaviac namespace f8 { - class BtMgr : public a8::Singleton + class BtMgr { - private: - BtMgr() {}; - friend class a8::Singleton; - + A8_DECLARE_SINGLETON(BtMgr); public: void Init(const std::string& file_path); void UnInit(); diff --git a/third_party/f8/f8/dbpool.h b/third_party/f8/f8/dbpool.h index 4b436f9..ce9c092 100644 --- a/third_party/f8/f8/dbpool.h +++ b/third_party/f8/f8/dbpool.h @@ -28,12 +28,9 @@ namespace f8 typedef std::function)> DbQueryResultCb; typedef std::function)> DbExecResultCb; - class DBPool : public a8::Singleton + class DBPool { - private: - DBPool() {}; - friend class a8::Singleton; - + A8_DECLARE_SINGLETON(DBPool); public: void Init(); void UnInit(); diff --git a/third_party/f8/f8/httpclientpool.cc b/third_party/f8/f8/httpclientpool.cc index e958504..f1cafa1 100644 --- a/third_party/f8/f8/httpclientpool.cc +++ b/third_party/f8/f8/httpclientpool.cc @@ -428,6 +428,11 @@ namespace f8 size_t mutex_buf_size = 0; }; + HttpClientPool::HttpClientPool() + { + + } + void HttpClientPool::Init(int thread_num, int sys_num, int user_num) { if (thread_num < 0 || sys_num < 0 || user_num < 0) { diff --git a/third_party/f8/f8/httpclientpool.h b/third_party/f8/f8/httpclientpool.h index c0e6e80..288415b 100644 --- a/third_party/f8/f8/httpclientpool.h +++ b/third_party/f8/f8/httpclientpool.h @@ -11,12 +11,9 @@ namespace f8 typedef std::function HttpProxyCb; class HttpClientPoolImpl; - class HttpClientPool : public a8::Singleton + class HttpClientPool { - private: - HttpClientPool() {}; - friend class a8::Singleton; - + A8_DECLARE_SINGLETON(HttpClientPool); public: volatile long long max_sys_request_delay = 0; volatile long long max_user_request_delay = 0; diff --git a/third_party/f8/f8/jsonlog.h b/third_party/f8/f8/jsonlog.h index 22e0024..ace5847 100644 --- a/third_party/f8/f8/jsonlog.h +++ b/third_party/f8/f8/jsonlog.h @@ -3,12 +3,9 @@ namespace f8 { - class JsonLog : public a8::Singleton + class JsonLog { - private: - JsonLog(); - friend class a8::Singleton; - + A8_DECLARE_SINGLETON(JsonLog); public: ~JsonLog(); diff --git a/third_party/f8/f8/msgqueue.cc b/third_party/f8/f8/msgqueue.cc index 3c8fb29..a4d3c5e 100644 --- a/third_party/f8/f8/msgqueue.cc +++ b/third_party/f8/f8/msgqueue.cc @@ -146,6 +146,11 @@ namespace f8 }; + MsgQueue::MsgQueue() + { + + } + void MsgQueue::Init() { imp_ = std::make_shared(); diff --git a/third_party/f8/f8/msgqueue.h b/third_party/f8/f8/msgqueue.h index bbea8f9..b6a4783 100644 --- a/third_party/f8/f8/msgqueue.h +++ b/third_party/f8/f8/msgqueue.h @@ -5,12 +5,9 @@ namespace f8 typedef std::function MsgHandleFunc; typedef list_head* CallBackHandle; - class MsgQueue : public a8::Singleton + class MsgQueue { - private: - MsgQueue() {}; - friend class a8::Singleton; - + A8_DECLARE_SINGLETON(MsgQueue); public: void Init(); void UnInit(); diff --git a/third_party/f8/f8/scriptengine.h b/third_party/f8/f8/scriptengine.h index 63e5be4..4307f30 100644 --- a/third_party/f8/f8/scriptengine.h +++ b/third_party/f8/f8/scriptengine.h @@ -7,12 +7,10 @@ namespace a8 namespace f8 { - class ScriptEngine : public a8::Singleton - { - private: - ScriptEngine() {}; - friend class a8::Singleton; + class ScriptEngine + { + A8_DECLARE_SINGLETON(ScriptEngine); public: void Init(); void UnInit(); diff --git a/third_party/f8/f8/tglog.cc b/third_party/f8/f8/tglog.cc index b9e7aa4..856801e 100644 --- a/third_party/f8/f8/tglog.cc +++ b/third_party/f8/f8/tglog.cc @@ -78,6 +78,11 @@ namespace f8 } }; + TGLog::TGLog() + { + + } + void TGLog::Init(const std::string& project_name, bool is_poly_log, int time_zone) { time_zone_ = time_zone; diff --git a/third_party/f8/f8/tglog.h b/third_party/f8/f8/tglog.h index 8e687fc..952fe7f 100644 --- a/third_party/f8/f8/tglog.h +++ b/third_party/f8/f8/tglog.h @@ -3,12 +3,9 @@ namespace f8 { struct TGLogImpl; - class TGLog : public a8::Singleton + class TGLog { - private: - TGLog() {}; - friend class a8::Singleton; - + A8_DECLARE_SINGLETON(TGLog); public: void Init(const std::string& project_name, bool is_poly_log, int time_zone = 8); void UnInit(); diff --git a/third_party/f8/f8/timer.cc b/third_party/f8/f8/timer.cc index e2230e3..bfb86c8 100644 --- a/third_party/f8/f8/timer.cc +++ b/third_party/f8/f8/timer.cc @@ -25,6 +25,11 @@ namespace f8 real_obj_.ClearTimerList(); } + Timer::Timer() + { + + } + void Timer::Init() { impl_ = std::make_shared(); diff --git a/third_party/f8/f8/timer.h b/third_party/f8/f8/timer.h index b0d3017..69c3ae6 100644 --- a/third_party/f8/f8/timer.h +++ b/third_party/f8/f8/timer.h @@ -3,13 +3,9 @@ namespace f8 { - class Timer : public a8::Singleton + class Timer { - - private: - Timer() {}; - friend class a8::Singleton; - + A8_DECLARE_SINGLETON(Timer); public: void Init(); void UnInit(); diff --git a/third_party/f8/f8/udplog.h b/third_party/f8/f8/udplog.h index f5535d9..96e3984 100644 --- a/third_party/f8/f8/udplog.h +++ b/third_party/f8/f8/udplog.h @@ -3,12 +3,9 @@ namespace f8 { - class UdpLog : public a8::Singleton + class UdpLog { - private: - UdpLog(); - friend class a8::Singleton; - + A8_DECLARE_SINGLETON(UdpLog); public: ~UdpLog();