12345678910111213141516171819202122232425262728293031 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace bbiwarg.Recognition.Tracking
- {
- class TrackIDPool
- {
- private List<int> usedIDs;
- public TrackIDPool() {
- usedIDs = new List<int>();
- }
- public int getNextUnusedID()
- {
- int id = 1;
- while (usedIDs.Contains(id))
- id++;
- usedIDs.Add(id);
- return id;
- }
- public void setIDUnused(int id)
- {
- usedIDs.Remove(id);
- }
- }
- }
|