From 662860689df2803bf57df6ee09cc22b50a104aac Mon Sep 17 00:00:00 2001 From: caiyuzheng <290198252@qq.com> Date: Mon, 3 May 2021 02:11:53 +0800 Subject: [PATCH] no message --- general/src/pattern/Observer.hpp | 3 +++ general/src/pattern/ringbuffer.hpp | 9 ++++++++- test/src/cpp11/conanfile.txt | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/general/src/pattern/Observer.hpp b/general/src/pattern/Observer.hpp index d909968..fae7c56 100644 --- a/general/src/pattern/Observer.hpp +++ b/general/src/pattern/Observer.hpp @@ -27,6 +27,7 @@ public: private: }; + template int Observed::AddObserver(Observer *p) { if(nullptr == p){ @@ -42,6 +43,7 @@ int Observed::AddObserver(Observer *p) { this->m_vObservers.push_back(p); return 0; } + template int Observed::DeleteObserver(Observer *p) { for(typename std::vector*>::iterator itr = m_vObservers.begin(); @@ -63,4 +65,5 @@ int Observed::NoticeObserver(T *p) { } return 0; } + #endif //GENERAL_OBSERVER_H diff --git a/general/src/pattern/ringbuffer.hpp b/general/src/pattern/ringbuffer.hpp index 7dffc63..6e381c2 100644 --- a/general/src/pattern/ringbuffer.hpp +++ b/general/src/pattern/ringbuffer.hpp @@ -11,7 +11,7 @@ public: T At(uint64_t pos); RingBuffer(uint64_t size); int Add(T *data,uint64_t len); - int Take(T *data,uint64_t data); + int Take(T *data,uint64_t len); uint32_t CanReadCount(); uint32_t CanWriteCount(); ~RingBuffer(); @@ -48,6 +48,9 @@ T RingBuffer::At(uint64_t pos){ template int RingBuffer::Add(T *data,uint64_t len){ + if(data == nullptr){ + return -1; + } /// 0->n |start|head|.....|tail| if(mCurrentTail > mCurrentHead){ if(mCurrentTail + len > mSize - 1){ @@ -60,6 +63,10 @@ int RingBuffer::Add(T *data,uint64_t len){ } } } +template +int RingBuffer::Take(T *data,uint64_t len){ + +} template uint32_t RingBuffer::CanReadCount(){ diff --git a/test/src/cpp11/conanfile.txt b/test/src/cpp11/conanfile.txt index 852c13c..6093c3c 100644 --- a/test/src/cpp11/conanfile.txt +++ b/test/src/cpp11/conanfile.txt @@ -1,4 +1,4 @@ [requires] -jsoncpp/1.1.1 +lua/1.1.1 [imports] .,* -> ./third @ folder=True, ignore_case=True, excludes=*.html *.jpeg \ No newline at end of file