// Deserialization public Int32 Deserialize() { // Read info about storage format Int32StorageFormats format = (Int32StorageFormats)SerializerStorage.ReadStorageFormatId(Int32StorageBase.FormatIdSizeInBits); // Is it default value if (format == Int32StorageFormats.DefaultValue) { return(0); } if (format == Int32StorageFormats.ValueInConfig) { ValueInConfig valInConfig = new ValueInConfig(); valInConfig.FormatConfig.Bits = SerializerStorage.ReadStorageFormatData(ValueInConfig.UsedConfigBitsForValue); return(valInConfig.Value); } // Value stored in PackedData ValueInDataStream valInDataStream = new ValueInDataStream(); valInDataStream.FormatConfig.Bits = SerializerStorage.ReadStorageFormatData(ValueInDataStream.UsedConfigBitsForCase); byte[] encodedValue = SerializerStorage.ReadPackedData(valInDataStream.PackedDataSize); // Return decoded value return(BitToolkit.ConvertByteArrayToInt32(encodedValue)); }
// Constructor that requires config case value public Int32StorageBase(Int32StorageFormats confCase, byte usedConfigBits) : base((byte)confCase, FormatIdSizeInBits, usedConfigBits) { }