#ifndef _PreAllocBufferPriorityList_H_ #define _PreAllocBufferPriorityList_H_ #include #include class PreAllocBuffers { public: struct Config { bool multithreadSafe; bool fullQueueDropFront; bool fullQueueSync; size_t count; size_t maxBuffSize; buffer_ud_deleter bud_deleter;//#todo no-impl Config() : multithreadSafe(false), fullQueueDropFront(false), fullQueueSync(false), count(0), maxBuffSize(0), bud_deleter(nullptr) { } }; struct Buffer { uint8_t* buffer; size_t buffSize; void* userData; Buffer() : buffer(nullptr), buffSize(0), userData(nullptr) { } }; PreAllocBufferPriorityList(const Config& _cfg); ~PreAllocBufferPriorityList(); Buffer* GetFree(); void Release(Buffer* buffer); bool Empty() const; bool Full() const; private: const Config cfg; void* mtsMux; typedef std::vector buffers_vec_t; buffers_vec_t allBuffers; buffers_vec_t freeBuffers; }; #endif