36 lines
716 B
Go
36 lines
716 B
Go
|
package device
|
||
|
|
||
|
import "strings"
|
||
|
|
||
|
//设备模型基类
|
||
|
type DeviceModel struct {
|
||
|
//图形id,即由前端作图时生成,且全局唯一
|
||
|
GraphicId string
|
||
|
//索引编号,同类设备唯一,不同类设备不唯一
|
||
|
Index string
|
||
|
}
|
||
|
|
||
|
type DeviceModeler interface {
|
||
|
//判断是否同一个设备
|
||
|
IsSame(other *DeviceModel) bool
|
||
|
}
|
||
|
|
||
|
//判断是否同一个设备
|
||
|
func (dm *DeviceModel) IsSame(other *DeviceModel) bool {
|
||
|
return strings.EqualFold(dm.GraphicId, other.GraphicId)
|
||
|
}
|
||
|
|
||
|
//////////////////////////////////////////////////////////////
|
||
|
|
||
|
//设备端口枚举定义
|
||
|
type PortEnum int8
|
||
|
|
||
|
//设备端口枚举值
|
||
|
const (
|
||
|
A PortEnum = iota
|
||
|
B
|
||
|
C
|
||
|
)
|
||
|
|
||
|
/////////////////////////////////////////////////////////////
|