Provides implementation of register of objects of the specified type. Also generates unique IDs for objects of this type. This class utilizes implementation of IIdentifiable and IRegisterable interfaces. Implementation notes for IRegistable: For implementation, use a static instance of this class, and an a nonstatic instance of the IdProcy class (to generate and hold object's unique ID). subclass of this clas, initialized by that static instance. Example implementation can be found in the ExampleInterfaceImplementation subclass of this class.
More...
|
| ObjectRegister () |
| Creates an object that generates unique IDs (in the scope of the current instance) and provides registration of objects of the given type. More...
|
|
| ObjectRegister (int startId) |
| Creates an object that generates unique IDs (in the scope of the current instance) with the specified first ID generated, and provides registration of objects of the given type. More...
|
|
void | Register (T obj) |
| Adds the specified object to the register, using its Id property. If the object is already registered (i.e. the register already contains its Id) then More...
|
|
bool | IsRegistered (int id) |
| Returns true if object with the specified ID is already registered with the current object, false otherwise. More...
|
|
bool | IsRegistered (T obj) |
| Returns true if the specified object is registered with the current object, false otherwise. More...
|
|
T | GetRegisteredInstance (int id) |
| Returns object that is registered with this object with the specified id, or null if such an object is not registered. More...
|
|
void | Unregister (int id) |
| Unregisters object with the specified ID. WARNING: This method should only be used in finalization methods of objects that implement the IRegisterable interface. 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...
|
|
|
void | Register (int id, T obj) |
| Registers the specified object with the specified key (ID). Warning: this method does not check whether the specified key actually corresponds to object's ID that is obtained by the object's IIdentifiable.Id property. Therefore it is private. 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] |
|
Provides implementation of register of objects of the specified type. Also generates unique IDs for objects of this type. This class utilizes implementation of IIdentifiable and IRegisterable interfaces. Implementation notes for IRegistable: For implementation, use a static instance of this class, and an a nonstatic instance of the IdProcy class (to generate and hold object's unique ID). subclass of this clas, initialized by that static instance. Example implementation can be found in the ExampleInterfaceImplementation subclass of this class.
IG.Lib.ObjectRegister< T >.ObjectRegister |
( |
| ) |
|
|
inline |
Creates an object that generates unique IDs (in the scope of the current instance) and provides registration of objects of the given type.
IG.Lib.ObjectRegister< T >.ObjectRegister |
( |
int |
startId | ) |
|
|
inline |
Creates an object that generates unique IDs (in the scope of the current instance) with the specified first ID generated, and provides registration of objects of the given type.
- Parameters
-
startId | The first ID that will be generated with this object's GetNewId() method. |
void IG.Lib.ObjectRegister< T >.Register |
( |
int |
id, |
|
|
T |
obj |
|
) |
| |
|
inlineprivate |
Registers the specified object with the specified key (ID). Warning: this method does not check whether the specified key actually corresponds to object's ID that is obtained by the object's IIdentifiable.Id property. Therefore it is private.
- Parameters
-
void IG.Lib.ObjectRegister< T >.Register |
( |
T |
obj | ) |
|
|
inline |
Adds the specified object to the register, using its Id property. If the object is already registered (i.e. the register already contains its Id) then
bool IG.Lib.ObjectRegister< T >.IsRegistered |
( |
int |
id | ) |
|
|
inline |
Returns true if object with the specified ID is already registered with the current object, false otherwise.
- Parameters
-
bool IG.Lib.ObjectRegister< T >.IsRegistered |
( |
T |
obj | ) |
|
|
inline |
Returns true if the specified object is registered with the current object, false otherwise.
T IG.Lib.ObjectRegister< T >.GetRegisteredInstance |
( |
int |
id | ) |
|
|
inline |
Returns object that is registered with this object with the specified id, or null if such an object is not registered.
void IG.Lib.ObjectRegister< T >.Unregister |
( |
int |
id | ) |
|
|
inline |
Unregisters object with the specified ID. WARNING: This method should only be used in finalization methods of objects that implement the IRegisterable interface.
- Parameters
-
- Returns
- Reference of the object that has been
SortedDictionary<int, T> IG.Lib.ObjectRegister< T >._register = new SortedDictionary<int, T>() |
|
protected |
object IG.Lib.ObjectRegister< T >._internalLock = new object() |
|
protected |
The documentation for this class was generated from the following file: