/// <summary> /// Attach the given item to the public dictionaries of the table /// </summary> /// <param name="llDataItem"></param> /// <returns></returns> private LlDataItem AttachDataItem(LlDataItem llDataItem) { _hlDictionary.Add(llDataItem.HlItemName, llDataItem); _llDictionary.Add(llDataItem.ItemName, llDataItem); return(llDataItem); }
/// <summary> /// Define a single constant low-level input item based on the given primitive input macro parameter value access /// </summary> /// <param name="hlValueAccess"></param> /// <param name="assignedValue"></param> /// <returns></returns> public LlDataItem DefineConstantInputParameter(LanguageValueAccess hlValueAccess, ILanguageValuePrimitive assignedValue) { if (!(hlValueAccess.ExpressionType is TypePrimitive)) { throw new InvalidOperationException("The given parameter is not of primitive type"); } if (!(hlValueAccess.ExpressionType.IsSameType(assignedValue.ExpressionType))) { throw new InvalidOperationException("The given constant value must be of type " + hlValueAccess.ExpressionType.TypeSignature); } var llAssignedValue = assignedValue.ToScalarValue(); var llDataItem = LlDataItem.CreateConstantInputParameter(GetNewDataItemName(), hlValueAccess, llAssignedValue); return(AttachDataItem(llDataItem)); }
/// <summary> /// Define a collection of variable low-level output items based on the given output macro parameter value access /// </summary> /// <param name="hlValueAccess"></param> public void DefineOutputParameter(LanguageValueAccess hlValueAccess) { if (hlValueAccess.ExpressionType is TypePrimitive) { AttachDataItem( LlDataItem.CreateOutputParameter(GetNewDataItemName(), hlValueAccess) ); } else { var valueAccessList = hlValueAccess.ExpandAll(); foreach (var childValueAccess in valueAccessList) { AttachDataItem( LlDataItem.CreateOutputParameter(GetNewDataItemName(), childValueAccess) ); } } }
/// <summary> /// Define a single low-level temp item based on the given primitive local variable value access /// </summary> /// <param name="hlValueAccess"></param> /// <param name="assignedValue"></param> /// <returns></returns> private LlDataItem DefineTemp(LanguageValueAccess hlValueAccess, ValuePrimitive <MathematicaScalar> assignedValue) { var llDataItem = LlDataItem.CreateTemp(GetNewDataItemName(), hlValueAccess, assignedValue, _llVarEvaluationOrder++); return(AttachDataItem(llDataItem)); }