import {AxdrType} from "../asn1.axdr/AxdrType"; import {ReverseByteArrayOutputStream} from "../ReverseByteArrayOutputStream"; import {ReverseByteArrayInputStream} from "../ReverseByteArrayInputStream"; import {Buffer} from "buffer"; import {AxdrNull} from "../asn1.axdr/AxdrNull"; import {DataSequence} from "./DataSequence"; import {AxdrBoolean} from "../asn1.axdr/AxdrBoolean"; import {AxdrBitString} from "../asn1.axdr/AxdrBitString"; import {Integer32} from "./Integer32"; import {Unsigned32} from "./Unsigned32"; import {AxdrOctetString} from "../asn1.axdr/AxdrOctetString"; import {Integer8} from "./Integer8"; import {Integer16} from "./Integer16"; import {Unsigned8} from "./Unsigned8"; import {Unsigned16} from "./Unsigned16"; import {Integer64} from "./Integer64"; import {Unsigned64} from "./Unsigned64"; import {Enum} from "./Enum"; import {Float32} from "./Float32"; import {Float64} from "./Float64"; import {Date_time} from "./Date_time"; import {Date} from "./Date"; import {Time} from "./Time"; import {Date_time_s} from "./Date_time_s"; import {OAD} from "./OAD"; import {ROAD} from "./ROAD"; import {OMD} from "./OMD"; import {TI} from "./TI"; import {TSA} from "./TSA"; import {MAC} from "./MAC"; import {RN} from "./RN"; import {Region} from "./Region"; import {Scaler_Unit} from "./Scaler_Unit"; import {RSD} from "./RSD"; import {CSD} from "./CSD"; import {MS} from "./MS"; import {SID} from "./SID"; import {SID_MAC} from "./SID_MAC"; import {COMDCB} from "./COMDCB"; import {RCSD} from "./RCSD"; import {AxdrEnum} from "../asn1.axdr/AxdrEnum"; export enum Choice { _ERR_NONE_SELECTED = -1, NULL_DATA = 0, ARRAY = 1, STRUCTURE = 2, BOOL = 3, BIT_STRING = 4, DOUBLE_LONG = 5, DOUBLE_LONG_UNSIGNED = 6, OCTET_STRING = 9, VISIBLE_STRING = 10, UTF8_STRING = 12, INTEGER = 15, LONGDATA = 16, UNSIGNED = 17, LONG_UNSIGNED = 18, LONG64 = 20, LONG64_UNSIGNED = 21, ENUMDATA = 22, FLOAT32 = 23, FLOAT64 = 24, DATE_TIME = 25, DATE = 26, TIME = 27, DATE_TIME_S = 28, OI = 80, OAD = 81, ROAD = 82, OMD = 83, TI = 84, TSA = 85, MAC = 86, RN = 87, REGION = 88, SCALER_UNIT = 89, RSD = 90, CSD = 91, MS = 92, SID = 93, SID_MAC = 94, COMDCB = 95, RCSD = 96, DONT_CARE = 255, } export class Data implements AxdrType{ dataCode : Buffer | null = null; choice : Choice = Choice._ERR_NONE_SELECTED; null_data : AxdrNull | null = null; array : DataSequence | null = null; structure : DataSequence | null = null; bool : AxdrBoolean | null = null; bit_string : AxdrBitString | null = null; double_long : Integer32 | null = null; double_long_unsigned : Unsigned32 | null = null; octet_string : AxdrOctetString | null = null; visible_string : AxdrOctetString | null = null; utf8_string : AxdrOctetString | null = null; integer : Integer8 | null = null; longdata : Integer16 | null = null; unsigned : Unsigned8 | null = null; long_unsigned : Unsigned16 | null = null; long64 : Integer64 | null = null; long64_unsigned : Unsigned64 | null = null; enumdata : Enum | null = null; float32 : Float32 | null = null; float64 : Float64 | null = null; date_time : Date_time | null = null; date : Date | null = null; time : Time | null = null; date_time_s : Date_time_s | null = null; oi : Unsigned16 | null = null; oad : OAD | null = null; road : ROAD | null = null; omd : OMD | null = null; ti : TI | null = null; tsa : TSA | null = null; mac : MAC | null = null; rn : RN | null = null; region : Region | null = null; scaler_unit : Scaler_Unit | null = null; rsd : RSD | null = null; csd : CSD | null = null; ms : MS | null = null; sid : SID | null = null; sid_mac : SID_MAC | null = null; comdcb : COMDCB | null = null; rcsd : RCSD | null = null; dont_care : AxdrNull | null = null; constructor() { } set_dataCode(dataCode : Buffer){ this.dataCode = dataCode; } decode(input: ReverseByteArrayInputStream): number { let codeLength = 0; let choosen = new AxdrEnum(); choosen.set_const(); codeLength += choosen.decode(input); this.resetChoices(); this.choice = choosen.getValue(); if (this.choice == Choice.NULL_DATA) { this.null_data = new AxdrNull(); codeLength += this.null_data.decode(input); return codeLength; } if (this.choice == Choice.ARRAY) { this.array = new DataSequence(); codeLength += this.array.decode(input); return codeLength; } if (this.choice == Choice.STRUCTURE) { this.structure = new DataSequence(); codeLength += this.structure.decode(input); return codeLength; } if (this.choice == Choice.BOOL) { this.bool = new AxdrBoolean(); codeLength += this.bool.decode(input); return codeLength; } if (this.choice == Choice.BIT_STRING) { this.bit_string = new AxdrBitString(); codeLength += this.bit_string.decode(input); return codeLength; } if (this.choice == Choice.DOUBLE_LONG) { this.double_long = new Integer32(); this.double_long.set_const(); codeLength += this.double_long.decode(input); return codeLength; } if (this.choice == Choice.DOUBLE_LONG_UNSIGNED) { this.double_long_unsigned = new Unsigned32(); this.double_long_unsigned.set_const(); codeLength += this.double_long_unsigned.decode(input); return codeLength; } if (this.choice == Choice.OCTET_STRING) { this.octet_string = new AxdrOctetString(); codeLength += this.octet_string.decode(input); return codeLength; } if (this.choice == Choice.VISIBLE_STRING) { this.visible_string = new AxdrOctetString(); codeLength += this.visible_string.decode(input); return codeLength; } if (this.choice == Choice.UTF8_STRING) { this.utf8_string = new AxdrOctetString(); codeLength += this.utf8_string.decode(input); return codeLength; } if (this.choice == Choice.INTEGER) { this.integer = new Integer8(); this.integer.set_const(); codeLength += this.integer.decode(input); return codeLength; } if (this.choice == Choice.LONGDATA) { this.longdata = new Integer16(); this.longdata.set_const(); codeLength += this.longdata.decode(input); return codeLength; } if (this.choice == Choice.UNSIGNED) { this.unsigned = new Unsigned8(); this.unsigned.set_const(); codeLength += this.unsigned.decode(input); return codeLength; } if (this.choice == Choice.LONG_UNSIGNED) { this.long_unsigned = new Unsigned16(); this.long_unsigned.set_const(); codeLength += this.long_unsigned.decode(input); return codeLength; } if (this.choice == Choice.LONG64) { this.long64 = new Integer64(); this.long64.set_const(); codeLength += this.long64.decode(input); return codeLength; } if (this.choice == Choice.LONG64_UNSIGNED) { this.long64_unsigned = new Unsigned64(); this.long_unsigned.set_const(); codeLength += this.long64_unsigned.decode(input); return codeLength; } if (this.choice == Choice.ENUMDATA) { this.enumdata = new Enum(); this.enumdata.set_const(); codeLength += this.enumdata.decode(input); return codeLength; } if (this.choice == Choice.FLOAT32) { this.float32 = new Float32(); codeLength += this.float32.decode(input); return codeLength; } if (this.choice == Choice.FLOAT64) { this.float64 = new Float64(); codeLength += this.float64.decode(input); return codeLength; } if (this.choice == Choice.DATE_TIME) { this.date_time = new Date_time(); codeLength += this.date_time.decode(input); return codeLength; } if (this.choice == Choice.DATE) { this.date = new Date(); codeLength += this.date.decode(input); return codeLength; } if (this.choice == Choice.TIME) { this.time = new Time(); codeLength += this.time.decode(input); return codeLength; } if (this.choice == Choice.DATE_TIME_S) { this.date_time_s = new Date_time_s(); codeLength += this.date_time_s.decode(input); return codeLength; } if (this.choice == Choice.OI) { this.oi = new Unsigned16(); this.oi.set_const(); codeLength += this.oi.decode(input); return codeLength; } if (this.choice == Choice.OAD) { this.oad = new OAD(); codeLength += this.oad.decode(input); return codeLength; } if (this.choice == Choice.ROAD) { this.road = new ROAD(); codeLength += this.road.decode(input); return codeLength; } if (this.choice == Choice.OMD) { this.omd = new OMD(); codeLength += this.omd.decode(input); return codeLength; } if (this.choice == Choice.TI) { this.ti = new TI(); codeLength += this.ti.decode(input); return codeLength; } if (this.choice == Choice.TSA) { this.tsa = new TSA(); codeLength += this.tsa.decode(input); return codeLength; } if (this.choice == Choice.MAC) { this.mac = new MAC(); codeLength += this.mac.decode(input); return codeLength; } if (this.choice == Choice.RN) { this.rn = new RN(); codeLength += this.rn.decode(input); return codeLength; } if (this.choice == Choice.REGION) { this.region = new Region(); codeLength += this.region.decode(input); return codeLength; } if (this.choice == Choice.SCALER_UNIT) { this.scaler_unit = new Scaler_Unit(); codeLength += this.scaler_unit.decode(input); return codeLength; } if (this.choice == Choice.RSD) { this.rsd = new RSD(); codeLength += this.rsd.decode(input); return codeLength; } if (this.choice == Choice.CSD) { this.csd = new CSD(); codeLength += this.csd.decode(input); return codeLength; } if (this.choice == Choice.MS) { this.ms = new MS(); codeLength += this.ms.decode(input); return codeLength; } if (this.choice == Choice.SID) { this.sid = new SID(); codeLength += this.sid.decode(input); return codeLength; } if (this.choice == Choice.SID_MAC) { this.sid_mac = new SID_MAC(); codeLength += this.sid_mac.decode(input); return codeLength; } if (this.choice == Choice.COMDCB) { this.comdcb = new COMDCB(); codeLength += this.comdcb.decode(input); return codeLength; } if (this.choice == Choice.RCSD) { this.rcsd = new RCSD(); codeLength += this.rcsd.decode(input); return codeLength; } if (this.choice == Choice.DONT_CARE) { this.dont_care = new AxdrNull(); codeLength += this.dont_care.decode(input); return codeLength; } throw new Error("Error decoding AxdrChoice: Identifier matched to no item."); } encode(output: ReverseByteArrayOutputStream): number { if (this.dataCode != null) { for (let i = this.dataCode.length - 1; i >= 0; i--) { output.write(this.dataCode[i]); } return this.dataCode.length; } if (this.choice == Choice._ERR_NONE_SELECTED) { throw new Error("Error encoding AxdrChoice: No item in choice was selected."); } let codeLength = 0; if (this.choice == Choice.DONT_CARE) { codeLength += this.dont_care.encode(output); let c = new AxdrEnum(); c.set_min_max_val(255); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.RCSD) { codeLength += this.rcsd.encode(output); let c = new AxdrEnum(); c.set_min_max_val(96); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.COMDCB) { codeLength += this.comdcb.encode(output); let c = new AxdrEnum(); c.set_min_max_val(95); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.SID_MAC) { codeLength += this.sid_mac.encode(output); let c = new AxdrEnum(); c.set_min_max_val(94); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.SID) { codeLength += this.sid.encode(output); let c = new AxdrEnum(); c.set_min_max_val(93); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.MS) { codeLength += this.ms.encode(output); let c = new AxdrEnum(); c.set_min_max_val(92); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.CSD) { codeLength += this.csd.encode(output); let c = new AxdrEnum(); c.set_min_max_val(91) codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.RSD) { codeLength += this.rsd.encode(output); let c = new AxdrEnum(); c.set_min_max_val(90); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.SCALER_UNIT) { codeLength += this.scaler_unit.encode(output); let c = new AxdrEnum(); c.set_min_max_val(89); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.REGION) { codeLength += this.region.encode(output); let c = new AxdrEnum(); c.set_min_max_val(88); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.RN) { codeLength += this.rn.encode(output); let c = new AxdrEnum(); c.set_min_max_val(87); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.MAC) { codeLength += this.mac.encode(output); let c = new AxdrEnum(); c.set_min_max_val(86); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.TSA) { codeLength += this.tsa.encode(output); let c = new AxdrEnum(); c.set_min_max_val(85); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.TI) { codeLength += this.ti.encode(output); let c = new AxdrEnum(); c.set_min_max_val(84); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.OMD) { codeLength += this.omd.encode(output); let c = new AxdrEnum(); c.set_min_max_val(83); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.ROAD) { codeLength += this.road.encode(output); let c = new AxdrEnum(); c.set_min_max_val(82); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.OAD) { codeLength += this.oad.encode(output); let c = new AxdrEnum(); c.set_min_max_val(81); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.OI) { codeLength += this.oi.encode(output); let c = new AxdrEnum(); c.set_min_max_val(80); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.DATE_TIME_S) { codeLength += this.date_time_s.encode(output); let c = new AxdrEnum(); c.set_min_max_val(28); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.TIME) { codeLength += this.time.encode(output); let c = new AxdrEnum(); c.set_min_max_val(27); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.DATE) { codeLength += this.date.encode(output); let c = new AxdrEnum(); c.set_min_max_val(26); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.DATE_TIME) { codeLength += this.date_time.encode(output); let c = new AxdrEnum(); c.set_min_max_val(25); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.FLOAT64) { codeLength += this.float64.encode(output); let c = new AxdrEnum(); c.set_min_max_val(24); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.FLOAT32) { codeLength += this.float32.encode(output); let c = new AxdrEnum(); c.set_min_max_val(23); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.ENUMDATA) { codeLength += this.enumdata.encode(output); let c = new AxdrEnum(); c.set_min_max_val(22); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.LONG64_UNSIGNED) { codeLength += this.long64_unsigned.encode(output); let c = new AxdrEnum(); c.set_min_max_val(21); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.LONG64) { codeLength += this.long64.encode(output); let c = new AxdrEnum(); c.set_min_max_val(20); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.LONG_UNSIGNED) { codeLength += this.long_unsigned.encode(output); let c = new AxdrEnum(); c.set_min_max_val(18); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.UNSIGNED) { codeLength += this.unsigned.encode(output); let c = new AxdrEnum(); c.set_min_max_val(17); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.LONGDATA) { codeLength += this.longdata.encode(output); let c = new AxdrEnum(); c.set_min_max_val(16) codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.INTEGER) { codeLength += this.integer.encode(output); let c = new AxdrEnum(); c.set_min_max_val(15); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.UTF8_STRING) { codeLength += this.utf8_string.encode(output); let c = new AxdrEnum(); c.set_min_max_val(12); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.VISIBLE_STRING) { codeLength += this.visible_string.encode(output); let c = new AxdrEnum(); c.set_min_max_val(10); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.OCTET_STRING) { codeLength += this.octet_string.encode(output); let c = new AxdrEnum(); c.set_min_max_val(9); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.DOUBLE_LONG_UNSIGNED) { codeLength += this.double_long_unsigned.encode(output); let c = new AxdrEnum(); c.set_min_max_val(6) codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.DOUBLE_LONG) { codeLength += this.double_long.encode(output); let c = new AxdrEnum(); c.set_min_max_val(5); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.BIT_STRING) { codeLength += this.bit_string.encode(output); let c = new AxdrEnum(); c.set_min_max_val(4); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.BOOL) { codeLength += this.bool.encode(output); let c = new AxdrEnum(); c.set_min_max_val(3); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.STRUCTURE) { codeLength += this.structure.encode(output); let c = new AxdrEnum(); c.set_min_max_val(2); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.ARRAY) { codeLength += this.array.encode(output); let c = new AxdrEnum(); c.set_min_max_val(1); codeLength += c.encode(output); return codeLength; } if (this.choice == Choice.NULL_DATA) { codeLength += this.null_data.encode(output); let c = new AxdrEnum(); c.set_min_max_val(0) codeLength += c.encode(output); return codeLength; } throw new Error("Error encoding AxdrChoice: No item in choice was encoded."); } encodeAndSave(encodingSizeGuess: number) { let revOStream = new ReverseByteArrayOutputStream(); revOStream.setBufSize(encodingSizeGuess); this.encode(revOStream); this.dataCode = revOStream.getArray(); } getChoiceIndex(): Choice { return this.choice; } resetChoices() { this.choice = Choice._ERR_NONE_SELECTED; this.null_data = null; this.array = null; this.structure = null; this.bool = null; this.bit_string = null; this.double_long = null; this.double_long_unsigned = null; this.octet_string = null; this.visible_string = null; this.utf8_string = null; this.integer = null; this.longdata = null; this.unsigned = null; this.long_unsigned = null; this.long64 = null; this.long64_unsigned = null; this.enumdata = null; this.float32 = null; this.float64 = null; this.date_time = null; this.date = null; this.time = null; this.date_time_s = null; this.oi = null; this.oad = null; this.road = null; this.omd = null; this.ti = null; this.tsa = null; this.mac = null; this.rn = null; this.region = null; this.scaler_unit = null; this.rsd = null; this.csd = null; this.ms = null; this.sid = null; this.sid_mac = null; this.comdcb = null; this.rcsd = null; this.dont_care = null; } set_nullData(null_data : AxdrNull){ this.resetChoices(); this.choice = Choice.NULL_DATA; this.null_data = null_data; } set_array(array : DataSequence){ this.resetChoices(); this.choice = Choice.ARRAY; this.array = array; } set_structure(structure : DataSequence){ this.resetChoices(); this.choice = Choice.STRUCTURE; this.structure = structure; } set_bool(bool : AxdrBoolean){ this.resetChoices(); this.choice = Choice.BOOL; this.bool = bool; } set_bitString(bit_string : AxdrBitString){ this.resetChoices(); this.choice = Choice.BIT_STRING; this.bit_string = bit_string; } set_doubleLong(double_long : Integer32){ this.resetChoices(); this.choice = Choice.DOUBLE_LONG; this.double_long = double_long; } set_doubleLongUnsigned(double_long_unsigned : Unsigned32){ this.resetChoices(); this.choice = Choice.DOUBLE_LONG_UNSIGNED; this.double_long_unsigned = double_long_unsigned; } set_octString(octet_string : AxdrOctetString){ this.resetChoices(); this.choice = Choice.OCTET_STRING; this.octet_string = octet_string; } set_visibleString(visible_string : AxdrOctetString){ this.resetChoices(); this.choice = Choice.VISIBLE_STRING; this.visible_string = visible_string; } set_utf8String(utf8_string : AxdrOctetString){ this.resetChoices(); this.choice = Choice.UTF8_STRING; this.utf8_string = utf8_string; } set_integer(integer : Integer8){ this.resetChoices(); this.choice = Choice.INTEGER; this.integer = integer; } set_longData(long_data : Integer16){ this.resetChoices(); this.choice = Choice.LONGDATA; this.longdata = long_data; } set_unsigned(unsigned : Unsigned8){ this.resetChoices(); this.choice = Choice.UNSIGNED; this.unsigned = unsigned; } set_longUnsigned(long_unsigned : Unsigned16){ this.resetChoices(); this.choice = Choice.LONG_UNSIGNED; this.long_unsigned = long_unsigned; } set_long64(long64 : Integer64){ this.resetChoices(); this.choice = Choice.LONG64; this.long64 = long64; } set_long64Unsigned(long64_unsigned: Unsigned64) { this.resetChoices(); this.choice = Choice.LONG64_UNSIGNED; this.long64_unsigned = long64_unsigned; } set_enumData(enumdata : Enum){ this.resetChoices(); this.choice = Choice.ENUMDATA; this.enumdata = enumdata; } set_float32(float32: Float32){ this.resetChoices(); this.choice = Choice.FLOAT32; this.float32 = float32; } set_float64(float64 : Float64){ this.resetChoices(); this.choice = Choice.FLOAT64; this.float64 = float64; } set_dateTime(date_time : Date_time){ this.resetChoices(); this.choice = Choice.DATE_TIME; this.date_time = date_time; } setDate(date : Date){ this.resetChoices(); this.choice = Choice.DATE; this.date = date; } set_time(time : Time){ this.resetChoices(); this.choice = Choice.TIME; this.time = time; } set_dateTimes(date_time_s : Date_time_s){ this.resetChoices(); this.choice = Choice.DATE_TIME_S; this.date_time_s = date_time_s; } setOi(oi : Unsigned16){ this.resetChoices(); this.choice = Choice.OI; this.oi = oi; } set_oad(oad : OAD){ this.resetChoices(); this.choice = Choice.OAD; this.oad = oad; } set_road(road : ROAD){ this.resetChoices(); this.choice = Choice.ROAD; this.road = road; } set_omd(omd : OMD){ this.resetChoices(); this.choice = Choice.OMD; this.omd = omd; } set_ti(ti : TI){ this.resetChoices(); this.choice = Choice.TI; this.ti = ti; } set_tsa(tsa : TSA){ this.resetChoices(); this.choice = Choice.TSA; this.tsa = tsa; } set_mac(mac : MAC){ this.resetChoices(); this.choice = Choice.MAC; this.mac = mac; } set_rn(rn : RN){ this.resetChoices(); this.choice = Choice.RN; this.rn = rn; } set_region(region : Region){ this.resetChoices(); this.choice = Choice.REGION; this.region = region; } set_scalerUnit(scaler_unit : Scaler_Unit){ this.resetChoices(); this.choice = Choice.SCALER_UNIT; this.scaler_unit = scaler_unit; } set_rsd(rsd : RSD){ this.resetChoices(); this.choice = Choice.RSD; this.rsd = rsd; } set_csd(csd : CSD){ this.resetChoices(); this.choice = Choice.CSD; this.csd = csd; } set_ms(ms : MS){ this.resetChoices(); this.choice = Choice.MS; this.ms = ms; } set_sid(sid : SID){ this.resetChoices(); this.choice = Choice.SID; this.sid = sid; } set_sidMac(sid_mac : SID_MAC){ this.resetChoices(); this.choice = Choice.SID_MAC; this.sid_mac = sid_mac; } set_comdcb(comdcb : COMDCB){ this.resetChoices(); this.choice = Choice.COMDCB; this.comdcb = comdcb; } set_rcsd(rcsd : RCSD){ this.resetChoices(); this.choice = Choice.RCSD; this.rcsd = rcsd; } set_dontCare(dont_care : AxdrNull){ this.resetChoices(); this.choice = Choice.DONT_CARE; this.dont_care = dont_care; } toString(): string { if (this.choice == Choice.NULL_DATA) { if (this.null_data != null) { return "choice: {null_data: " + this.null_data + "}"; } else { return "choice is null_data but null_data is null"; } }else if(this.choice == Choice.ARRAY){ if(this.array != null){ return "choice: {array: " + this.array + "}"; }else{ return "choice is array but array is null"; } }else if(this.choice == Choice.STRUCTURE){ if(this.structure != null){ return "choice: {structure: " + this.structure + "}"; }else{ return "choice is structure but structure is null"; } }else if(this.choice == Choice.BOOL){ if(this.bool != null){ return "choice: {bool: " + this.bool + "}"; }else{ return "choice is bool but bool is null"; } }else if(this.choice == Choice.BIT_STRING){ if(this.bit_string != null){ return "choice: {bit_string: " + this.bit_string + "}"; }else{ return "choice is bit_string but bit_string is null"; } }else if(this.choice == Choice.DOUBLE_LONG){ if(this.double_long != null){ return "choice: {double_long: " + this.double_long + "}"; }else{ return "choice is double_long but double_long is null"; } }else if(this.choice == Choice.DOUBLE_LONG_UNSIGNED){ if(this.double_long_unsigned != null){ return "choice: {double_long_unsigned: " + this.double_long_unsigned + "}"; }else{ return "choice is double_long_unsigned but double_long_unsigned is null"; } }else if(this.choice == Choice.OCTET_STRING){ if(this.octet_string != null){ return "choice: {octet_string: " + this.octet_string + "}"; }else{ return "choice is octet_string but octet_string is null"; } }else if(this.choice == Choice.VISIBLE_STRING){ if(this.visible_string != null){ return "choice: {visible_string: " + this.visible_string + "}"; }else{ return "choice is visible_string but visible_string is null"; } }else if(this.choice == Choice.UTF8_STRING){ if(this.utf8_string != null){ return "choice: {utf8_string: " + this.utf8_string + "}"; }else{ return "choice is utf8_string but utf8_string is null"; } }else if(this.choice == Choice.INTEGER){ if(this.integer != null){ return "choice: {integer: " + this.integer + "}"; }else{ return "choice is integer but integer is null"; } }else if(this.choice == Choice.LONGDATA){ if(this.longdata != null){ return "choice: {longdata: " + this.longdata + "}"; }else{ return "choice is longdata but longdata is null"; } }else if(this.choice == Choice.UNSIGNED){ if(this.unsigned != null){ return "choice: {unsigned: " + this.unsigned + "}"; }else{ return "choice is unsigned but unsigned is null"; } }else if(this.choice == Choice.LONG_UNSIGNED){ if(this.long_unsigned != null){ return "choice: {long_unsigned: " + this.long_unsigned + "}"; }else{ return "choice is long_unsigned but long_unsigned is null"; } }else if(this.choice == Choice.LONG64){ if(this.long64 != null){ return "choice: {long64: " + this.long64 + "}"; }else{ return "choice is long64 but long64 is null"; } }else if(this.choice == Choice.LONG64_UNSIGNED){ if(this.long64_unsigned != null){ return "choice: {long64_unsigned: " + this.long64_unsigned + "}"; }else{ return "choice is long64_unsigned but long64_unsigned is null"; } }else if(this.choice == Choice.ENUMDATA){ if(this.enumdata != null){ return "choice: {enumdata: " + this.enumdata + "}"; }else{ return "choice is enumdata but enumdata is null"; } }else if(this.choice == Choice.FLOAT32){ if(this.float32 != null){ return "choice: {float32: " + this.float32 + "}"; }else{ return "choice is float32 but float32 is null"; } }else if(this.choice == Choice.FLOAT64){ if(this.float64 != null){ return "choice: {float64: " + this.float64 + "}"; }else{ return "choice is float64 but float64 is null"; } }else if(this.choice == Choice.DATE_TIME){ if(this.date_time != null){ return "choice: {date_time: " + this.date_time + "}"; }else{ return "choice is date_time but date_time is null"; } }else if(this.choice == Choice.DATE){ if(this.date != null){ return "choice: {date: " + this.date + "}"; }else{ return "choice is date but date is null"; } }else if(this.choice == Choice.TIME){ if(this.time != null){ return "choice: {time: " + this.time + "}"; }else{ return "choice is time but time is null"; } }else if(this.choice == Choice.DATE_TIME_S){ if(this.date_time_s != null){ return "choice: {date_time_s: " + this.date_time_s + "}"; }else{ return "choice is date_time_s but date_time_s is null"; } }else if(this.choice == Choice.OI){ if(this.oi != null){ return "choice: {oi: " + this.oi + "}"; }else{ return "choice is oi but oi is null"; } }else if(this.choice == Choice.OAD){ if(this.oad != null){ return "choice: {oad: " + this.oad + "}"; }else{ return "choice is oad but oad is null"; } }else if(this.choice == Choice.ROAD){ if(this.road != null){ return "choice: {road: " + this.road + "}"; }else{ return "choice is road but road is null"; } }else if(this.choice == Choice.OMD){ if(this.omd != null){ return "choice: {omd: " + this.omd + "}"; }else{ return "choice is omd but omd null"; } }else if(this.choice == Choice.TI){ if(this.ti != null){ return "choice: {ti: " + this.ti + "}"; }else{ return "choice is ti but oi null"; } }else if(this.choice == Choice.TSA){ if(this.tsa != null){ return "choice: {tsa: " + this.tsa + "}"; }else{ return "choice is tsa but tsa null"; } }else if(this.choice == Choice.MAC){ if(this.mac != null){ return "choice: {mac: " + this.mac + "}"; }else{ return "choice is mac but mac null"; } }else if(this.choice == Choice.RN){ if(this.rn != null){ return "choice: {rn: " + this.rn + "}"; }else{ return "choice is rn but rn null"; } }else if(this.choice == Choice.REGION){ if(this.region != null){ return "choice: {region: " + this.region + "}"; }else{ return "choice is region but region null"; } }else if(this.choice == Choice.SCALER_UNIT){ if(this.scaler_unit != null){ return "choice: {scaler_unit: " + this.scaler_unit + "}"; }else{ return "choice is scaler_unit but scaler_unit null"; } }else if(this.choice == Choice.RSD){ if(this.rsd != null){ return "choice: {rsd: " + this.rsd + "}"; }else{ return "choice is rsd but rsd null"; } }else if(this.choice == Choice.CSD){ if(this.csd != null){ return "choice: {csd: " + this.csd + "}"; }else{ return "choice is csd but csd null"; } }else if(this.choice == Choice.MS){ if(this.ms != null){ return "choice: {ms: " + this.ms + "}"; }else{ return "choice is ms but ms null"; } }else if(this.choice == Choice.SID){ if(this.sid != null){ return "choice: {sid: " + this.sid + "}"; }else{ return "choice is sid but sid null"; } }else if(this.choice == Choice.SID_MAC){ if(this.sid_mac != null){ return "choice: {sid_mac: " + this.sid_mac + "}"; }else{ return "choice is sid_mac but sid_mac null"; } }else if(this.choice == Choice.COMDCB){ if(this.comdcb != null){ return "choice: {comdcb: " + this.comdcb + "}"; }else{ return "choice is comdcb but comdcb null"; } }else if(this.choice == Choice.RCSD){ if(this.rcsd != null){ return "choice: {rcsd: " + this.rcsd + "}"; }else{ return "choice is rcsd but rcsd null"; } }else if(this.choice == Choice.DONT_CARE){ if(this.dont_care != null){ return "choice: {dont_care: " + this.dont_care + "}"; }else{ return "choice is dont_care but dont_care null"; } } else { return "unknown"; } } }