using System;
using System.Collections.Generic;
namespace WIDESEAWCS_S7Simulator.Core.Interfaces
{
///
/// 内存存储接口
/// 提供统一的内存访问接口,支持地址格式读写
///
public interface IMemoryStore : IDisposable
{
///
/// 读取字节数据
///
/// 地址(如 "M100", "DB1.DBD0", "I0.0", "T1")
/// 长度
/// 字节数组
byte[] ReadBytes(string address, ushort length);
///
/// 读取指定类型数据
///
/// 值类型
/// 地址
/// 数据值
T Read(string address) where T : struct;
///
/// 写入字节数据
///
/// 地址
/// 数据
void WriteBytes(string address, byte[] data);
///
/// 写入指定类型数据
///
/// 值类型
/// 地址
/// 数据值
void Write(string address, T value) where T : struct;
///
/// 获取内存区域
///
/// 区域类型(M/DB/I/Q/T/C)
/// 内存区域接口
IMemoryRegion GetRegion(string regionType);
///
/// 清空所有内存
///
void Clear();
///
/// 导出内存数据
///
/// 区域类型 -> 字节数组的字典
Dictionary Export();
///
/// 导入内存数据
///
/// 区域类型 -> 字节数组的字典
void Import(Dictionary data);
}
}