12345678910111213141516171819202122232425262728293031323334353637383940 |
- #include "vehicle_manager/iobuffer.h"
- #include "vehicle_manager/pool.h"
- #include <stdio.h>
- CIOBuffer::CIOBuffer()
- {
- Length = (0);
- NextBuf = (nullptr);
- PrevBuf = (nullptr);
- }
- CIOBuffer::~CIOBuffer()
- {
- }
- CIOBuffer* CIOBuffer::Alloc(const char * file, int line)
- {
- //std::cout<<"alloc:"<<file<<","<<line<<std::endl;
- return Alloc_Pool<CIOBuffer>::GetInstance().Alloc();
- }
- void CIOBuffer::OnFree()
- {
- Alloc_Pool<CIOBuffer>::GetInstance().Free(this);
- }
- CRef::CRef() :m_lRef(1)
- {
- }
- void CRef::AddRef()
- {
- m_lRef++;
- }
- long CRef::Release(const char * file, int line)
- {
- //std::cout<<"free:"<<file<<","<<line<<std::endl;
- long result = --m_lRef;
- if (result == 0)
- OnFree();
- return result;
- }
|