Ejemplo n.º 1
0
        /// <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);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Creates a variable in the namespace provided
        /// </summary>
        /// <param name="enclosing"></param>
        /// <param name="name"></param>
        /// <param name="typeName"></param>
        /// <returns></returns>
        protected Variable CreateVariable(NameSpace enclosing, string name, string typeName)
        {
            Variable retVal = (Variable)Factory.createVariable();

            enclosing.appendVariables(retVal);
            retVal.Name     = name;
            retVal.TypeName = typeName;

            return(retVal);
        }
        /// <summary>
        ///     Creates a variable in the namespace provided
        /// </summary>
        /// <param name="enclosing"></param>
        /// <param name="name"></param>
        /// <param name="typeName"></param>
        /// <returns></returns>
        protected Variable CreateVariable(NameSpace enclosing, string name, string typeName)
        {
            Variable retVal = (Variable) Factory.createVariable();

            enclosing.appendVariables(retVal);
            retVal.Name = name;
            retVal.TypeName = typeName;

            return retVal;
        }