/// <summary> /// Constructor. /// </summary> /// <param name="tag">The Tag of this instance.</param> /// <param name="vR">The Value Representation(s) of this instance.</param> /// <param name="name">The name of this instance.</param> /// <param name="parent">The parent of this instance.</param> public Attribute(Tag tag, VR valueRepresentations, string name, AttributesAndMacros parent) { this.tag = tag; this.valueRepresentations = valueRepresentations; this.name = name; this.parent = parent; }
/// <summary> /// Create a Macro instance using a raw xml file (that is generated by the ODD). /// </summary> /// <param name="macroNode">The Macro node.</param> /// <param name="parent">The parent.</param> /// <returns>The created Macro instance.</returns> public static Macro Create(XPathNavigator macroNode, AttributesAndMacros parent) { string name = string.Empty; // // Determine Macro name. // try { name = macroNode.GetAttribute("Name", ""); } catch (Exception exception) { throw (DefinitionFile.CreateException(macroNode, "Macro", "Unable to determine Name", exception)); } // // Construct Macro instance. // Macro macro = new Macro(name, parent); // // Add attribute instances and Macros instances to created Macro instance. // macro.AddAttributesAndMacros(macroNode); // // Return created instance. // return(macro); }
// ----------------------------- // - Begin constructors region - // ----------------------------- /// <summary> /// Constructor. /// </summary> /// <param name="tag">The tag of this instance.</param> /// <param name="valueRepresentations">The VR(s) of this instance.</param> /// <param name="name">The name of this instance.</param> /// <param name="parent">The parent of this instance.</param> public SingleAttribute(Tag tag, VR valueRepresentations, string name, AttributesAndMacros parent) : base(tag, valueRepresentations, name, parent) { // Do nothing. }
/// <summary> /// Create an (single or sequence) Attribute instance using a raw xml file (that is generated by the ODD). /// </summary> /// <param name="attributeNode">An Attribute node.</param> /// <returns>The created Attribute instance.</returns> public static Attribute Create(XPathNavigator attributeNode, AttributesAndMacros parent) { Attribute attribute = null; // Return value; string name = string.Empty; Tag tag = new Tag(); // // Determine attribute name. // try { name = attributeNode.GetAttribute("Name", ""); } catch (Exception exception) { throw (DefinitionFile.CreateException(attributeNode, "Attribute", "Unable to determine Name", exception)); } // // Determine tag. // tag = Tag.Create(attributeNode); // // Construct a single attribute or a sequence attribute. // VR valueRepresentations = VR.None; XPathNodeIterator vRNodes = attributeNode.Select("VR"); if (vRNodes.MoveNext()) { try { valueRepresentations = (VR)System.Enum.Parse(typeof(VR), vRNodes.Current.Value.Replace('/', ',')); } catch { throw (DefinitionFile.CreateException(attributeNode, "Attribute", "VR node does not contain a valid VR.", null)); } } else { throw (DefinitionFile.CreateException(attributeNode, "Attribute", "VR node not found.", null)); } if (valueRepresentations == VR.SQ) { attribute = SequenceAttribute.Create(tag, name, attributeNode, parent); } else { attribute = new SingleAttribute(tag, valueRepresentations, name, parent); } // // Return the constructed attribute. // return(attribute); }
public Macro(string name, AttributesAndMacros parent) { this.name = name; this.parent = parent; }
// --------------------- // - End fields region - // --------------------- #endregion #region - Constructors - // ----------------------------- // - Begin constructors region - // ----------------------------- /// <summary> /// Constructor. /// </summary> /// <param name="tag">The tag of this instance.</param> /// <param name="name">The name of this instance.</param> /// <param name="parent">The parent of this instance.</param> public SequenceAttribute(Tag tag, string name, AttributesAndMacros parent) : base(tag, VR.SQ, name, parent) { this.sequenceItem = new SequenceItem(this); }
/// <summary> /// Create a Sequence Attribute instance using a raw xml file (that is generated by the ODD). /// </summary> /// <param name="tag">The tag.</param> /// <param name="name">The name.</param> /// <param name="attributeNode">The Attribute node.</param> /// <param name="parent">The parent of the instance to create.</param> /// <returns>The created SequenceAttribute inistance.</returns> internal static SequenceAttribute Create(Tag tag, string name, XPathNavigator attributeNode, AttributesAndMacros parent) { SequenceAttribute sequenceAttribute = new SequenceAttribute(tag, name, parent); XPathNodeIterator itemNodes = attributeNode.Select("Values/Sequence/Item"); if (itemNodes.MoveNext()) { sequenceAttribute.sequenceItem = SequenceItem.Create(itemNodes.Current, sequenceAttribute); } else { throw (DefinitionFile.CreateException(attributeNode, "SequenceAttribute", "Values/Sequence/Item node not found", null)); } return(sequenceAttribute); }