no message
parent
b08b85026e
commit
662860689d
|
@ -27,6 +27,7 @@ public:
|
|||
private:
|
||||
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
int Observed<T>::AddObserver(Observer<T> *p) {
|
||||
if(nullptr == p){
|
||||
|
@ -42,6 +43,7 @@ int Observed<T>::AddObserver(Observer<T> *p) {
|
|||
this->m_vObservers.push_back(p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
int Observed<T>::DeleteObserver(Observer<T> *p) {
|
||||
for(typename std::vector<Observer<T>*>::iterator itr = m_vObservers.begin();
|
||||
|
@ -63,4 +65,5 @@ int Observed<T>::NoticeObserver(T *p) {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif //GENERAL_OBSERVER_H
|
||||
|
|
|
@ -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<T>::At(uint64_t pos){
|
|||
|
||||
template<typename T>
|
||||
int RingBuffer<T>::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<T>::Add(T *data,uint64_t len){
|
|||
}
|
||||
}
|
||||
}
|
||||
template<typename T>
|
||||
int RingBuffer<T>::Take(T *data,uint64_t len){
|
||||
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
uint32_t RingBuffer<T>::CanReadCount(){
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[requires]
|
||||
jsoncpp/1.1.1
|
||||
lua/1.1.1
|
||||
[imports]
|
||||
.,* -> ./third @ folder=True, ignore_case=True, excludes=*.html *.jpeg
|
Loading…
Reference in New Issue