Example #1
0
 /// <summary>
 /// Creates a variable for the given spatial parameter variable and replaces it in parameter map.
 /// </summary>
 /// <param name="oldVar">Spatial parameter variable that needs to replaced.</param>
 /// <returns>A new ParameterVar instance created of <paramref name="oldVar"/>.</returns>
 /// <remarks>
 /// This method should be used only to replace external strong spatial parameter with a counterpart whose
 /// type is the appropriate union type for <paramref name="oldVar"/>.
 /// The operation invalidates the <paramref name="oldVar"/>. After the operation has completed 
 /// the <paramref name="oldVar"/>) is invalidated internally and should no longer be used.
 /// </remarks>
 internal ParameterVar ReplaceStrongSpatialParameterVar(ParameterVar oldVar)
 {
     return ReplaceParameterVar(oldVar, t => TypeHelpers.CreateSpatialUnionTypeUsage(t));
 }
Example #2
0
 /// <summary>
 /// Creates a variable for the given parameter variable and replaces it in parameter map.
 /// </summary>
 /// <param name="oldVar">Parameter variable that needs to replaced.</param>
 /// <param name="generateReplacementType">Delegate that generates the replacement parameter's type.</param>
 /// <returns>A new ParameterVar instance created of <paramref name="oldVar"/>.</returns>
 /// <remarks>
 /// This method should be used only to replace external enum or strong spatial parameters with a counterpart whose
 /// type is the underlying type of the enum type, or the union type contating the strong spatial type of the <paramref name="oldVar"/>.
 /// The operation invalidates the <paramref name="oldVar"/>. After the operation has completed 
 /// the <paramref name="oldVar"/>) is invalidated internally and should no longer be used.
 /// </remarks>Func<
 private ParameterVar ReplaceParameterVar(ParameterVar oldVar, Func<TypeUsage, TypeUsage> generateReplacementType)
 {
     Debug.Assert(oldVar != null, "oldVar != null");
     Debug.Assert(m_vars.Contains(oldVar));
     ParameterVar v = new ParameterVar(NewVarId(), generateReplacementType(oldVar.Type), oldVar.ParameterName);
     m_parameterMap[oldVar.ParameterName] = v;
     m_vars.Add(v);
     return v;
 }
Example #3
0
 /// <summary>
 /// Creates a variable for the given enum parameter variable and replaces it in parameter map.
 /// </summary>
 /// <param name="oldVar">Enum parameter variable that needs to replaced.</param>
 /// <returns>A new ParameterVar instance created of <paramref name="oldVar"/>.</returns>
 /// <remarks>
 /// This method should be used only to replace external enum parameter with a counterpart whose
 /// type is the underlying type of the enum type of the <paramref name="oldVar"/>.
 /// The operation invalidates the <paramref name="oldVar"/>. After the operation has completed 
 /// the <paramref name="oldVar"/>) is invalidated internally and should no longer be used.
 /// </remarks>
 internal ParameterVar ReplaceEnumParameterVar(ParameterVar oldVar)
 {
     return ReplaceParameterVar(oldVar, t => TypeHelpers.CreateEnumUnderlyingTypeUsage(t));
 }
Example #4
0
 /// <summary>
 /// Creates a variable for a parameter in the query
 /// </summary>
 /// <param name="parameterName">The name of the parameter for which to create the var</param>
 /// <param name="parameterType">The type of the parameter, and therefore the new var</param>
 /// <returns>A new ParameterVar instance with the specified name and type</returns>
 internal ParameterVar CreateParameterVar(string parameterName,
     TypeUsage parameterType)
 {
     if (m_parameterMap.ContainsKey(parameterName))
         throw new Exception("duplicate parameter name: " + parameterName);
     ParameterVar v = new ParameterVar(NewVarId(), parameterType, parameterName);
     m_vars.Add(v);
     m_parameterMap[parameterName] = v;
     return v;
 }