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

- Main Page
- Namespaces
- Classes
- Files
- Directories

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

Public Member Functions | Properties | Private Attributes

# 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]

List of all members.

## 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.
| 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.
int | GetNewId ()
| Returns a new unique command ID (process-unique over all objects of this type and its subtypes).
## 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.
## 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).

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

Implements IG::Lib::ILockable.

The documentation for this class was generated from the following file:

- UtilIdRegistration.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events