Utility class for generaton of unique IDs for objects of specific type. IDs generated by calls of GetNewId() from a specific object of this class are unique. Utilizes definition of IIdentifiable interface. Implementation notes: In every class whose instances should have unique IDs, instantiate a private static object of this type, and an instance member of the Proxy subtype of this class. Both objexts should be instantiated by appropriate initializers, and constructor of the proxy object should be called with static object as argument. Example implementation can be found in the ExampleInterfaceImplementation subclass of this class.
More...
|
| IdGenerator () |
| Creates a new ID generator. The first ID generated will be 0. Subsequent IDs are generated by obtained by incrementing the last generated ID. More...
|
|
| IdGenerator (int firstId) |
| Created a new ID generator with the specified ID generated first. Subsequent IDs are generated by obtained by incrementing the last generated ID. More...
|
|
int | GetNewId () |
| Returns a new unique command ID (process-unique over all objects of this type and its subtypes). More...
|
|
|
object | Lock [get] |
| This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock. More...
|
|
object | Lock [get] |
|
Utility class for generaton of unique IDs for objects of specific type. IDs generated by calls of GetNewId() from a specific object of this class are unique. Utilizes definition of IIdentifiable interface. Implementation notes: In every class whose instances should have unique IDs, instantiate a private static object of this type, and an instance member of the Proxy subtype of this class. Both objexts should be instantiated by appropriate initializers, and constructor of the proxy object should be called with static object as argument. Example implementation can be found in the ExampleInterfaceImplementation subclass of this class.
IG.Lib.IdGenerator.IdGenerator |
( |
| ) |
|
|
inline |
Creates a new ID generator. The first ID generated will be 0. Subsequent IDs are generated by obtained by incrementing the last generated ID.
IG.Lib.IdGenerator.IdGenerator |
( |
int |
firstId | ) |
|
|
inline |
Created a new ID generator with the specified ID generated first. Subsequent IDs are generated by obtained by incrementing the last generated ID.
- Parameters
-
firstId | The first ID generated by the current object. |
int IG.Lib.IdGenerator.GetNewId |
( |
| ) |
|
|
inline |
Returns a new unique command ID (process-unique over all objects of this type and its subtypes).
Referenced by IG.Lib.IdProxy.IdProxy().
object IG.Lib.IdGenerator._mainLock = new object() |
|
private |
int IG.Lib.IdGenerator._currentId = 0 |
|
private |
object IG.Lib.IdGenerator._lockId = new object() |
|
private |
object IG.Lib.IdGenerator.Lock |
|
get |
This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock.
The documentation for this class was generated from the following file: