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.
파일 보기 프로젝트 열기: antmicro/Migrant 1 사용 예제들

공개 메소드들

메소드 설명
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