/// <summary> /// Appends a new field group in the namespace /// </summary> /// <param name="nameSpace">The namespace in which the field group should be added</param> /// <param name="name">The name of the field group</param> /// <param name="fieldGroup">The field group to append</param> private void AppendFieldGroup(DataDictionary.Types.NameSpace nameSpace, string name, FieldGroup fieldGroup) { DataDictionary.Types.NameSpace enclosingNameSpace = GetNameSpaceBasedOnName(nameSpace, name); // create a structure for the field group DataDictionary.Types.Structure structure = (DataDictionary.Types.Structure)DataDictionary.Generated.acceptor.getFactory().createStructure(); structure.Name = "Message"; structure.Comment = fieldGroup.description; enclosingNameSpace.appendStructures(structure); numberOfSubStructures = 1; numberOfCollections = 1; RenameDuplicates(fieldGroup.field_sequence.Items); foreach (object obj in fieldGroup.field_sequence.Items) { AppendField(obj, structure, fieldGroup.discriminant_value.ToString()); } // Handles root elements if (!Utils.Utils.isEmpty(fieldGroup.main)) { DataDictionary.Variables.Variable variable = (DataDictionary.Variables.Variable)DataDictionary.Generated.acceptor.getFactory().createVariable(); variable.Name = fieldGroup.main; variable.setTypeName(structure.FullName); variable.Mode = DataDictionary.Generated.acceptor.VariableModeEnumType.aInOut; nameSpace.appendVariables(variable); } }
/// <summary> /// Creates a structure in the namespace provided /// </summary> /// <param name="enclosing"></param> /// <param name="name"></param> /// <returns></returns> protected Structure CreateStructure(NameSpace enclosing, string name) { Structure retVal = (Structure)Factory.createStructure(); enclosing.appendStructures(retVal); retVal.Name = name; return(retVal); }
/// <summary> /// Creates a structure in the namespace provided /// </summary> /// <param name="enclosing"></param> /// <param name="name"></param> /// <returns></returns> protected Structure CreateStructure(NameSpace enclosing, string name) { Structure retVal = (Structure) Factory.createStructure(); enclosing.appendStructures(retVal); retVal.Name = name; return retVal; }