Class CodeParameter
Represents a parsed parameter of a G/M/T-code Initial parsing is done whenever a code is processed
[JsonConverter(typeof(CodeParameterConverter))]
public class CodeParameter
- Inheritance
-
CodeParameter
- Inherited Members
Constructors
CodeParameter(char, object?)
Creates a new CodeParameter instance and with the given value
public CodeParameter(char letter, object? value)
Parameters
lettercharLetter of the code parameter (automatically converted to upper-case)
valueobjectValue of this parameter
CodeParameter(char, string, bool, bool)
Creates a new CodeParameter instance and parses value to a native data type if applicable
public CodeParameter(char letter, string value, bool isString, bool isDriverId)
Parameters
lettercharLetter of the code parameter
valuestringString representation of the value
isStringboolWhether this is a string. This is set to true if the parameter was inside quotation marks
isDriverIdboolWhether this is a driver ID
Remarks
This constructor does not parsed long (aka int64) values because RRF cannot handle them
Properties
IsDriverId
Indicates if this parameter is a driver identifier
public bool IsDriverId { get; }
Property Value
IsExpression
Indicates if this parameter is an expression that can be evaluated
public bool IsExpression { get; }
Property Value
IsNull
Check if the parameter does not have any data
[JsonIgnore]
public bool IsNull { get; }
Property Value
Letter
Letter of the code parameter (e.g. P in M106 P3)
public char Letter { get; }
Property Value
Remarks
If this is an unprecedented parameter without a letter, '@' is used
Type
Data type of the internally parsed value
[JsonIgnore]
public Type? Type { get; }
Property Value
Methods
Equals(object?)
Checks if the other obj equals this instance
public override bool Equals(object? obj)
Parameters
objobjectOther object
Returns
- bool
True if both objects are not equal
GetHashCode()
Returns the hash code of this instance
public override int GetHashCode()
Returns
- int
Computed hash code
ToString()
Converts this parameter to a string
public override string ToString()
Returns
- string
String representation
Operators
operator ==(CodeParameter?, object?)
Equality operator
public static bool operator ==(CodeParameter? a, object? b)
Parameters
aCodeParameterCode parameter
bobjectOther object
Returns
- bool
True if both objects are equal
explicit operator DriverId?(CodeParameter?)
Explicit conversion operator to a driver ID
public static explicit operator DriverId?(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- DriverId
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
explicit operator DriverId[]?(CodeParameter?)
Explicit conversion operator to a driver ID array
public static explicit operator DriverId[]?(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- DriverId[]
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
explicit operator bool(CodeParameter?)
Explicit conversion operator to bool
public static explicit operator bool(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- bool
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
explicit operator int(CodeParameter?)
Explicit conversion operator to int
public static explicit operator int(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- int
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
explicit operator int[]?(CodeParameter?)
Explicit conversion operator to integer array
public static explicit operator int[]?(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- int[]
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
explicit operator long(CodeParameter?)
Explicit conversion operator to long
public static explicit operator long(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- long
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
explicit operator long[]?(CodeParameter?)
Explicit conversion operator to long array
public static explicit operator long[]?(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- long[]
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
explicit operator IPAddress?(CodeParameter?)
Explicit conversion operator to an IP address
public static explicit operator IPAddress?(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- IPAddress
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
explicit operator bool?(CodeParameter?)
Explicit conversion operator to bool?
public static explicit operator bool?(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- bool?
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
explicit operator int?(CodeParameter?)
Explicit conversion operator to int?
public static explicit operator int?(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- int?
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
explicit operator long?(CodeParameter?)
Explicit conversion operator to long?
public static explicit operator long?(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- long?
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
explicit operator float?(CodeParameter?)
Explicit conversion operator to float?
public static explicit operator float?(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- float?
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
explicit operator uint?(CodeParameter?)
Explicit conversion operator to uint?
public static explicit operator uint?(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- uint?
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
explicit operator float(CodeParameter?)
Explicit conversion operator to float
public static explicit operator float(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- float
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
explicit operator float[]?(CodeParameter?)
Explicit conversion operator to float array
public static explicit operator float[]?(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- float[]
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
explicit operator string?(CodeParameter?)
Explicit conversion operator to string
public static explicit operator string?(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- string
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
explicit operator uint(CodeParameter?)
Explicit conversion operator to uint
public static explicit operator uint(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- uint
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
explicit operator uint[]?(CodeParameter?)
Explicit conversion operator to unsigned integer array
public static explicit operator uint[]?(CodeParameter? codeParameter)
Parameters
codeParameterCodeParameterTarget object
Returns
- uint[]
Converted value
Exceptions
- InvalidParameterTypeException
Failed to convert parameter value
operator !=(CodeParameter?, object?)
Inequality operator
public static bool operator !=(CodeParameter? a, object? b)
Parameters
aCodeParameterCode parameter
bobjectOther object
Returns
- bool
True if both objects are not equal