C# Класс Antmicro.Migrant.ObjectIdentifier

Gives consecutive, unique identifiers for presented objects during its lifetime. Can also be used to retrive an object by its ID.
The first returned id is 0. For given object, if it was presented to the class earlier, the previously returned identificator is returned again. Note that the objects presented to class are remembered, so they will not be collected until the ObjectIdentifier lives.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Clear ( ) : void

Clears internal elements.

GetContext ( ) : Antmicro.Migrant.ObjectIdentifierContext

Gets the context of object identifier that can be used for open stream serialization.

GetId ( object o ) : int

For a given object, returns its unique ID. The new ID is used if object was not presented to this class earlier, otherwise the previously returned is used.

GetId ( object o, bool &isNew ) : int

For a given object, returns its unique ID. The new ID is used if object was not presented to this class earlier, otherwise the previously returned is used.

GetObject ( int id ) : object

For an ID which was previously returned by the Antmicro.Migrant.ObjectIdentifier.GetId(object, out bool) method, returns an object for which this ID was generated.

ObjectIdentifier ( ) : System

Initializes a new instance of the Antmicro.Migrant.ObjectIdentifier class.

ObjectIdentifier ( Antmicro.Migrant.ObjectIdentifierContext context ) : System

Initializes a new instance of the Antmicro.Migrant.ObjectIdentifier class, reusing given context.

SetIdentifierForObject ( object o, int id ) : void

Sets new identifier for object. REMARK: Setting new mapping of object to id does not remove the old one. As a reuslt, after this operation asking for id of old object and new object results in returing the same identifier. This behaviour is intended to support surrogated objects.

this ( int id ) : object

For an ID which was previously returned by the Antmicro.Migrant.ObjectIdentifier.GetId(object, out bool) method, returns an object for which this ID was generated.

Описание методов

Clear() публичный Метод

Clears internal elements.
public Clear ( ) : void
Результат void

GetContext() публичный Метод

Gets the context of object identifier that can be used for open stream serialization.
public GetContext ( ) : Antmicro.Migrant.ObjectIdentifierContext
Результат Antmicro.Migrant.ObjectIdentifierContext

GetId() публичный Метод

For a given object, returns its unique ID. The new ID is used if object was not presented to this class earlier, otherwise the previously returned is used.
public GetId ( object o ) : int
o object /// An object to give unique ID for. ///
Результат int

GetId() публичный Метод

For a given object, returns its unique ID. The new ID is used if object was not presented to this class earlier, otherwise the previously returned is used.
public GetId ( object o, bool &isNew ) : int
o object /// An object to give unique ID for. ///
isNew bool /// Out parameter specifying if returned id has just been generated. ///
Результат int

GetObject() публичный Метод

For an ID which was previously returned by the Antmicro.Migrant.ObjectIdentifier.GetId(object, out bool) method, returns an object for which this ID was generated.
public GetObject ( int id ) : object
id int /// The unique ID, previously returned by the method. ///
Результат object

ObjectIdentifier() публичный Метод

Initializes a new instance of the Antmicro.Migrant.ObjectIdentifier class.
public ObjectIdentifier ( ) : System
Результат System

ObjectIdentifier() публичный Метод

Initializes a new instance of the Antmicro.Migrant.ObjectIdentifier class, reusing given context.
public ObjectIdentifier ( Antmicro.Migrant.ObjectIdentifierContext context ) : System
context Antmicro.Migrant.ObjectIdentifierContext Context to reuse.
Результат System

SetIdentifierForObject() публичный Метод

Sets new identifier for object. REMARK: Setting new mapping of object to id does not remove the old one. As a reuslt, after this operation asking for id of old object and new object results in returing the same identifier. This behaviour is intended to support surrogated objects.
public SetIdentifierForObject ( object o, int id ) : void
o object Object
id int Identifier
Результат void

this() публичный Метод

For an ID which was previously returned by the Antmicro.Migrant.ObjectIdentifier.GetId(object, out bool) method, returns an object for which this ID was generated.
public this ( int id ) : object
id int /// The unique ID, previously returned by the method. ///
Результат object