C# Class MsgPack.Serialization.CollectionSerializers.DictionaryMessagePackSerializerBase

Inheritance: MessagePackSerializer, ICollectionInstanceFactory
Mostrar archivo Open project: BeamNG/msgpackInspector

Protected Methods

Method Description
AddItem ( dictionary, key, value ) : void

When implemented by derive class, adds the deserialized item to the collection on TDictionary specific manner to implement UnpackToCore(Unpacker,TDictionary).

CreateInstance ( int initialCapacity ) : TDictionary

Creates a new collection instance with specified initial capacity.

An author of Unpacker could implement unpacker for non-MessagePack format, so implementer of this interface should not rely on that initialCapacity reflects actual items count. For example, JSON unpacker cannot supply collection items count efficiently.

GetCount ( dictionary ) : int

When overridden in derived class, returns count of the dictionary.

PackToAsyncCore ( Packer packer, objectTree, CancellationToken cancellationToken ) : Task

Serializes specified object with specified Packer asynchronously.

Private Methods

Method Description
DictionaryMessagePackSerializerBase ( SerializationContext ownerContext, PolymorphismSchema schema ) : System
DictionaryMessagePackSerializerBase ( SerializationContext ownerContext, PolymorphismSchema schema, SerializerCapabilities capabilities ) : System
ICollectionInstanceFactory ( int initialCapacity ) : object
InternalUnpackFromAsyncCore ( Unpacker unpacker, CancellationToken cancellationToken ) : Task
InternalUnpackFromCore ( Unpacker unpacker ) : TDictionary
PackToCore ( Packer packer, objectTree ) : void
UnpackFromAsyncCore ( Unpacker unpacker, CancellationToken cancellationToken ) : Task
UnpackFromCore ( Unpacker unpacker ) : TDictionary
UnpackToAsyncCore ( Unpacker unpacker, collection, CancellationToken cancellationToken ) : Task
UnpackToAsyncCore ( Unpacker unpacker, collection, int itemsCount, CancellationToken cancellationToken ) : Task
UnpackToCore ( Unpacker unpacker, collection ) : void
UnpackToCore ( Unpacker unpacker, collection, int itemsCount ) : void

Method Details

AddItem() protected method

When implemented by derive class, adds the deserialized item to the collection on TDictionary specific manner to implement UnpackToCore(Unpacker,TDictionary).
/// This implementation always throws it. ///
protected AddItem ( dictionary, key, value ) : void
dictionary The dictionary to be added.
key The key to be added.
value The value to be added.
return void

CreateInstance() protected abstract method

Creates a new collection instance with specified initial capacity.
An author of Unpacker could implement unpacker for non-MessagePack format, so implementer of this interface should not rely on that initialCapacity reflects actual items count. For example, JSON unpacker cannot supply collection items count efficiently.
protected abstract CreateInstance ( int initialCapacity ) : TDictionary
initialCapacity int /// The initial capacy of creating collection. /// Note that this parameter may 0 for non-empty collection. ///
return TDictionary

GetCount() protected abstract method

When overridden in derived class, returns count of the dictionary.
protected abstract GetCount ( dictionary ) : int
dictionary A collection. This value will not be null.
return int

PackToAsyncCore() protected method

Serializes specified object with specified Packer asynchronously.
/// Failed to serialize object. /// /// is not serializable even if it can be deserialized. ///
protected PackToAsyncCore ( Packer packer, objectTree, CancellationToken cancellationToken ) : Task
packer Packer which packs values in . This value will not be null.
objectTree Object to be serialized.
cancellationToken CancellationToken The token to monitor for cancellation requests. The default value is .
return Task