rts-sim-module/repository/signal.go
2023-10-20 10:21:35 +08:00

46 lines
1.0 KiB
Go

package repository
import "joylink.club/rtsssimulation/repository/model/proto"
type Signal struct {
Identity
code string
km *proto.Kilometer
//section *PhysicalSection
//turnoutPort TurnoutPort
linkPosition *LinkPosition
//信号机电路系统电子元器件
componentGroups []*ElectronicComponentGroup
model proto.Signal_Model
}
func NewSignal(id string, km *proto.Kilometer, code string, model proto.Signal_Model) *Signal {
return &Signal{
Identity: identity{id, proto.DeviceType_DeviceType_Signal},
km: km,
code: code,
model: model,
}
}
func (s *Signal) bindLinkPosition(position *LinkPosition) {
s.linkPosition = position
}
// func (s *Signal) bindSection(section *PhysicalSection) {
// s.section = section
// }
//
// func (s *Signal) bindTurnoutPort(tp TurnoutPort) {
// s.turnoutPort = tp
// }
func (s *Signal) RelayGroups() []*ElectronicComponentGroup {
return s.componentGroups
}
func (s *Signal) Code() string {
return s.code
}
func (s *Signal) Model() proto.Signal_Model {
return s.model
}