Beispiel #1
0
 /// <summary>
 /// Tests for type safety when accessing a GRIB value.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="requestedType">The requested type.</param>
 /// <param name="actualType">The actual type.</param>
 /// <exception cref="GribValueTypeException"></exception>
 private static void AssertTypeSafe(string key, GribValueType requestedType, GribValueType actualType)
 {
     if (requestedType != actualType)
     {
         throw new GribValueTypeException(String.Format("Invalid type conversion. Key {0} is GRIB type {1}",
                                                        key, actualType.AsString()));
     }
 }
Beispiel #2
0
        /// <summary>
        /// Retrieves the GRIB key's type name.
        /// </summary>
        /// <param name="vt">The vt.</param>
        /// <returns></returns>
        public static string AsString(this GribValueType vt)
        {
            if ((int)vt >= (int)GribValueType.IntArray)
            {
                return(vt.ToString());
            }

            return(GribApiProxy.GribGetTypeName((int)vt));
        }
Beispiel #3
0
 /// <summary>
 /// Tests for type safety when accessing a GRIB value.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="requestedType">The requested type.</param>
 /// <param name="actualType">The actual type.</param>
 /// <exception cref="GribValueTypeException"></exception>
 private static void AssertTypeSafe(string key, GribValueType requestedType, GribValueType actualType)
 {
     if (requestedType != actualType)
     {
         throw new GribValueTypeException(String.Format("Invalid type conversion. Key {0} is GRIB type {1}",
                                                         key, actualType.AsString()));
     }
 }
Beispiel #4
0
 /// <summary>
 /// Tests for type safety when accessing this value.
 /// </summary>
 /// <param name="requestedType">The expected type.</param>
 private void AssertTypeSafe (GribValueType requestedType)
 {
     GribValue.AssertTypeSafe(Key, requestedType, NativeType);
 }
Beispiel #5
0
 /// <summary>
 /// Tests for type safety when accessing this value.
 /// </summary>
 /// <param name="requestedType">The expected type.</param>
 private void AssertTypeSafe(GribValueType requestedType)
 {
     GribKeyValue.AssertTypeSafe(Key, requestedType, NativeType);
 }
 /// <summary>
 /// Tests for type safety when accessing this value.
 /// </summary>
 /// <param name="expectedType">The expected type.</param>
 private void AssertTypeSafe(GribValueType expectedType)
 {
     GribValue.AssertTypeSafe(Key, expectedType, NativeType);
 }
Beispiel #7
0
 /// <summary>
 /// Tests for type safety when accessing this value.
 /// </summary>
 /// <param name="expectedType">The expected type.</param>
 private void AssertTypeSafe (GribValueType expectedType)
 {
     GribValue.AssertTypeSafe(Key, expectedType, NativeType);
 }