载入中...
搜索中...
未找到
QueryIds.h
浏览该文件的文档.
1#pragma once
2
3#include <vector>
4
5namespace eve::spatial {
6
11class QueryIds {
12public:
14 void clear() { ids_.clear(); }
15
17 void addUnique(int id) {
18 for (int existing : ids_) {
19 if (existing == id) return;
20 }
21 ids_.push_back(id);
22 }
23
25 void addUnchecked(int id) { ids_.push_back(id); }
26
28 int getCount() const { return static_cast<int>(ids_.size()); }
29
31 int getId(int index) const {
33 if (index < 0 || index >= getCount()) return -1;
34 return ids_[static_cast<size_t>(index)];
35 }
36
37 const std::vector<int> &ids() const { return ids_; }
38 std::vector<int> &ids() { return ids_; }
39
40private:
41 std::vector<int> ids_;
42};
43
44} // namespace eve::spatial
uint32_t index
Last-query hit buffer shared by spatial indexes. Script pattern: call query* → getResultCount / getRe...
Definition QueryIds.h:11
std::vector< int > & ids()
Definition QueryIds.h:38
void clear()
Removes all stored entries.
Definition QueryIds.h:14
void addUnchecked(int id)
Appends id without uniqueness checks.
Definition QueryIds.h:25
int getId(int index) const
Id at dense index, or -1 if out of range.
Definition QueryIds.h:31
int getCount() const
Number of stored ids.
Definition QueryIds.h:28
const std::vector< int > & ids() const
Definition QueryIds.h:37
void addUnique(int id)
Appends id if not already present.
Definition QueryIds.h:17