github.com/lirm/aeron-go@v0.0.0-20230415210743-920325491dc4/archive/codecs/ControlResponseCode.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 ControlResponseCodeEnum int32
    12  type ControlResponseCodeValues struct {
    13  	OK                   ControlResponseCodeEnum
    14  	ERROR                ControlResponseCodeEnum
    15  	RECORDING_UNKNOWN    ControlResponseCodeEnum
    16  	SUBSCRIPTION_UNKNOWN ControlResponseCodeEnum
    17  	NullValue            ControlResponseCodeEnum
    18  }
    19  
    20  var ControlResponseCode = ControlResponseCodeValues{0, 1, 2, 3, -2147483648}
    21  
    22  func (c ControlResponseCodeEnum) Encode(_m *SbeGoMarshaller, _w io.Writer) error {
    23  	if err := _m.WriteInt32(_w, int32(c)); err != nil {
    24  		return err
    25  	}
    26  	return nil
    27  }
    28  
    29  func (c *ControlResponseCodeEnum) Decode(_m *SbeGoMarshaller, _r io.Reader, actingVersion uint16) error {
    30  	if err := _m.ReadInt32(_r, (*int32)(c)); err != nil {
    31  		return err
    32  	}
    33  	return nil
    34  }
    35  
    36  func (c ControlResponseCodeEnum) RangeCheck(actingVersion uint16, schemaVersion uint16) error {
    37  	if actingVersion > schemaVersion {
    38  		return nil
    39  	}
    40  	value := reflect.ValueOf(ControlResponseCode)
    41  	for idx := 0; idx < value.NumField(); idx++ {
    42  		if c == value.Field(idx).Interface() {
    43  			return nil
    44  		}
    45  	}
    46  	return fmt.Errorf("Range check failed on ControlResponseCode, unknown enumeration value %d", c)
    47  }
    48  
    49  func (*ControlResponseCodeEnum) EncodedLength() int64 {
    50  	return 4
    51  }
    52  
    53  func (*ControlResponseCodeEnum) OKSinceVersion() uint16 {
    54  	return 0
    55  }
    56  
    57  func (c *ControlResponseCodeEnum) OKInActingVersion(actingVersion uint16) bool {
    58  	return actingVersion >= c.OKSinceVersion()
    59  }
    60  
    61  func (*ControlResponseCodeEnum) OKDeprecated() uint16 {
    62  	return 0
    63  }
    64  
    65  func (*ControlResponseCodeEnum) ERRORSinceVersion() uint16 {
    66  	return 0
    67  }
    68  
    69  func (c *ControlResponseCodeEnum) ERRORInActingVersion(actingVersion uint16) bool {
    70  	return actingVersion >= c.ERRORSinceVersion()
    71  }
    72  
    73  func (*ControlResponseCodeEnum) ERRORDeprecated() uint16 {
    74  	return 0
    75  }
    76  
    77  func (*ControlResponseCodeEnum) RECORDING_UNKNOWNSinceVersion() uint16 {
    78  	return 0
    79  }
    80  
    81  func (c *ControlResponseCodeEnum) RECORDING_UNKNOWNInActingVersion(actingVersion uint16) bool {
    82  	return actingVersion >= c.RECORDING_UNKNOWNSinceVersion()
    83  }
    84  
    85  func (*ControlResponseCodeEnum) RECORDING_UNKNOWNDeprecated() uint16 {
    86  	return 0
    87  }
    88  
    89  func (*ControlResponseCodeEnum) SUBSCRIPTION_UNKNOWNSinceVersion() uint16 {
    90  	return 0
    91  }
    92  
    93  func (c *ControlResponseCodeEnum) SUBSCRIPTION_UNKNOWNInActingVersion(actingVersion uint16) bool {
    94  	return actingVersion >= c.SUBSCRIPTION_UNKNOWNSinceVersion()
    95  }
    96  
    97  func (*ControlResponseCodeEnum) SUBSCRIPTION_UNKNOWNDeprecated() uint16 {
    98  	return 0
    99  }