C# Class 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.
Afficher le fichier Open project: antmicro/Migrant Class Usage Examples

Méthodes publiques

Méthode Description
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.

Method Details

Clear() public méthode

Clears internal elements.
public Clear ( ) : void
Résultat void

GetContext() public méthode

Gets the context of object identifier that can be used for open stream serialization.
public GetContext ( ) : Antmicro.Migrant.ObjectIdentifierContext
Résultat Antmicro.Migrant.ObjectIdentifierContext

GetId() public méthode

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. ///
Résultat int

GetId() public méthode

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. ///
Résultat int

GetObject() public méthode

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. ///
Résultat object

ObjectIdentifier() public méthode

Initializes a new instance of the Antmicro.Migrant.ObjectIdentifier class.
public ObjectIdentifier ( ) : System
Résultat System

ObjectIdentifier() public méthode

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.
Résultat System

SetIdentifierForObject() public méthode

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
Résultat void

this() public méthode

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. ///
Résultat object