27 lines
571 B
C
27 lines
571 B
C
|
|
#ifndef ZOOST_MEM_H
|
||
|
|
#define ZOOST_MEM_H
|
||
|
|
|
||
|
|
#include <mutex>
|
||
|
|
#include <vector>
|
||
|
|
|
||
|
|
class zoostMutBuffer
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
zoostMutBuffer() = default;
|
||
|
|
zoostMutBuffer(const zoostMutBuffer&) = delete;
|
||
|
|
zoostMutBuffer& operator=(const zoostMutBuffer&) = delete;
|
||
|
|
|
||
|
|
public:
|
||
|
|
void Push(const char* data, int size);
|
||
|
|
int IndexOf(const char* data, int size, int start = 0);
|
||
|
|
const char* Data() const;
|
||
|
|
int GetSize() const;
|
||
|
|
void RemoveOf(int start, int size);
|
||
|
|
void Clear();
|
||
|
|
|
||
|
|
private:
|
||
|
|
std::vector<char> buffer_;
|
||
|
|
std::mutex mutex_;
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif // ZOOST_MEM_H
|