github.com/jshiv/can-go@v0.2.1-0.20210224011015-069e90e90bdf/pkg/dbc/objecttype.go (about) 1 package dbc 2 3 import "fmt" 4 5 // ObjectType identifies the type of a DBC object. 6 type ObjectType string 7 8 const ( 9 ObjectTypeUnspecified ObjectType = "" 10 ObjectTypeNetworkNode ObjectType = "BU_" 11 ObjectTypeMessage ObjectType = "BO_" 12 ObjectTypeSignal ObjectType = "SG_" 13 ObjectTypeEnvironmentVariable ObjectType = "EV_" 14 ) 15 16 // Validate returns an error for invalid object types. 17 func (o ObjectType) Validate() error { 18 switch o { 19 case ObjectTypeUnspecified: 20 case ObjectTypeNetworkNode: 21 case ObjectTypeMessage: 22 case ObjectTypeSignal: 23 case ObjectTypeEnvironmentVariable: 24 default: 25 return fmt.Errorf("invalid object type: %v", o) 26 } 27 return nil 28 }