| IGLib 1.5 The IGLib base library for development of numerical, technical and business applications.

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
Public Member Functions | Properties | Private Attributes | List of all members
IG.Lib.IdGenerator Class Reference

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...

Inheritance diagram for IG.Lib.IdGenerator:
[legend]
Collaboration diagram for IG.Lib.IdGenerator:
[legend]

## Public Member Functions
| 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...

## Properties
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...
Properties inherited from IG.Lib.ILockable
object | Lock`[get]`

## Private Attributes
object | _mainLock = new object()
int | _currentId = 0
object | _lockId = new object()

## Detailed Description

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.

## Constructor & Destructor Documentation

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.

## Member Function Documentation

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().

## Member Data Documentation

object IG.Lib.IdGenerator._mainLock = new object()
| private

int IG.Lib.IdGenerator._currentId = 0
| private

object IG.Lib.IdGenerator._lockId = new object()
| private

## Property Documentation

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:

- igbase/utilities/UtilIdRegistration.cs