并入zoost库。
This commit is contained in:
27
include/zoost/zt.mem.h
Normal file
27
include/zoost/zt.mem.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user