Generates IDs sequentially and reuses old IDs which are returned to pool by calling Return method. Protection count and time can be set to protect returned IDs. Protection is useful especially in multiplayer where clients can still have objects with those IDs.
More...
|
| SequenceIdGenerator (int reuseProtectionCount=2048, uint reuseProtectionTime=60, Func< uint > timeFunc=null) |
|
void | Reserve (uint reservedIdCount) |
| Reserves first several IDs, so it's never returned by generator. Zero is never returned, when reservedIdCount is 2, IDs 1 and 2 won't be ever returned. More...
|
|
uint | NextId () |
|
void | Return (uint id) |
|
Generates IDs sequentially and reuses old IDs which are returned to pool by calling Return method. Protection count and time can be set to protect returned IDs. Protection is useful especially in multiplayer where clients can still have objects with those IDs.
Definition at line 15 of file SequenceIdGenerator.cs.
VRage.Library.Algorithms.SequenceIdGenerator.SequenceIdGenerator |
( |
int |
reuseProtectionCount = 2048 , |
|
|
uint |
reuseProtectionTime = 60 , |
|
|
Func< uint > |
timeFunc = null |
|
) |
| |
|
inline |
static SequenceIdGenerator VRage.Library.Algorithms.SequenceIdGenerator.CreateWithStopwatch |
( |
TimeSpan |
reuseProtectionTime, |
|
|
int |
reuseProtectionCount = 2048 |
|
) |
| |
|
inlinestatic |
Creates new sequence id generator with stopwatch to measure protection time.
- Parameters
-
reuseProtectionTime | Time to protect returned IDs. |
reuseProtectionCount | Minimum number of IDs in protection queue, before first ID will be reused. |
Definition at line 77 of file SequenceIdGenerator.cs.
uint VRage.Library.Algorithms.SequenceIdGenerator.NextId |
( |
| ) |
|
|
inline |
void VRage.Library.Algorithms.SequenceIdGenerator.Reserve |
( |
uint |
reservedIdCount | ) |
|
|
inline |
Reserves first several IDs, so it's never returned by generator. Zero is never returned, when reservedIdCount is 2, IDs 1 and 2 won't be ever returned.
- Parameters
-
reservedIdCount | Number of reserved IDs which will be never returned by generator. |
Definition at line 95 of file SequenceIdGenerator.cs.
void VRage.Library.Algorithms.SequenceIdGenerator.Return |
( |
uint |
id | ) |
|
|
inline |
uint VRage.Library.Algorithms.SequenceIdGenerator.ReservedCount |
|
get |
int VRage.Library.Algorithms.SequenceIdGenerator.WaitingInQueue |
|
get |
The documentation for this class was generated from the following file: