github.com/lirm/aeron-go@v0.0.0-20230415210743-920325491dc4/archive/codecs/SourceLocation.go (about) 1 // Generated SBE (Simple Binary Encoding) message codec 2 3 package codecs 4 5 import ( 6 "fmt" 7 "io" 8 "reflect" 9 ) 10 11 type SourceLocationEnum int32 12 type SourceLocationValues struct { 13 LOCAL SourceLocationEnum 14 REMOTE SourceLocationEnum 15 NullValue SourceLocationEnum 16 } 17 18 var SourceLocation = SourceLocationValues{0, 1, -2147483648} 19 20 func (s SourceLocationEnum) Encode(_m *SbeGoMarshaller, _w io.Writer) error { 21 if err := _m.WriteInt32(_w, int32(s)); err != nil { 22 return err 23 } 24 return nil 25 } 26 27 func (s *SourceLocationEnum) Decode(_m *SbeGoMarshaller, _r io.Reader, actingVersion uint16) error { 28 if err := _m.ReadInt32(_r, (*int32)(s)); err != nil { 29 return err 30 } 31 return nil 32 } 33 34 func (s SourceLocationEnum) RangeCheck(actingVersion uint16, schemaVersion uint16) error { 35 if actingVersion > schemaVersion { 36 return nil 37 } 38 value := reflect.ValueOf(SourceLocation) 39 for idx := 0; idx < value.NumField(); idx++ { 40 if s == value.Field(idx).Interface() { 41 return nil 42 } 43 } 44 return fmt.Errorf("Range check failed on SourceLocation, unknown enumeration value %d", s) 45 } 46 47 func (*SourceLocationEnum) EncodedLength() int64 { 48 return 4 49 } 50 51 func (*SourceLocationEnum) LOCALSinceVersion() uint16 { 52 return 0 53 } 54 55 func (s *SourceLocationEnum) LOCALInActingVersion(actingVersion uint16) bool { 56 return actingVersion >= s.LOCALSinceVersion() 57 } 58 59 func (*SourceLocationEnum) LOCALDeprecated() uint16 { 60 return 0 61 } 62 63 func (*SourceLocationEnum) REMOTESinceVersion() uint16 { 64 return 0 65 } 66 67 func (s *SourceLocationEnum) REMOTEInActingVersion(actingVersion uint16) bool { 68 return actingVersion >= s.REMOTESinceVersion() 69 } 70 71 func (*SourceLocationEnum) REMOTEDeprecated() uint16 { 72 return 0 73 }