DLT_Splitter/Inc/ID_Generator.hpp

25 lines
470 B
C++

#ifndef __ID_GENERATOR__
#define __ID_GENERATOR__
#include <vector>
// 唯一ID生成器
class Independent_ID_Generator
{
protected:
// 连续ID串
typedef struct
{
int begin;
int end;
} Continuous_ID_Section;
std::vector<Continuous_ID_Section> continuous_id_list;
public:
// 获取ID
int Request_ID(void);
// 释放ID true-> success / false -> fail
bool Release_ID(const int ID);
};
#endif