/// <summary> /// /// </summary> /// <param name="bits"></param> /// <param name="index"></param> /// <param name="ctx"></param> /// <returns></returns> public static GribMessage Create(byte[] bits, int index, GribContext ctx) { var buff = Marshal.AllocHGlobal(bits.Length); Marshal.Copy(bits, 0, buff, bits.Length); int err = 0; SizeT sz = (SizeT)bits.Length; GribMessage msg = null; GribHandle handle = null; lock (_fileLock) { // grib_api moves to the next message in a stream for each new handle handle = GribApiProxy.GribHandleNewFromMultiMessage(ctx, out buff, ref sz, out err); } if (err != 0) { Marshal.AllocHGlobal(buff); throw GribApiException.Create(err); } if (handle != null) { msg = new GribMessage(handle, ctx, buff, index); } return(msg); }
/// <summary> /// Initializes a new instance of the <see cref="GribMessage" /> class. /// </summary> /// <param name="handle">The handle.</param> /// <param name="context">The context.</param> /// <param name="index">The index.</param> protected GribMessage(GribHandle handle, GribContext context = null, int index = 0) : base() { Handle = handle; Namespace = Namespaces[0]; KeyFilters = Interop.KeyFilters.All; Index = index; }
/// <summary> /// Initializes a new instance of the <see cref="GribMessage" /> class. /// </summary> /// <param name="handle"></param> /// <param name="context"></param> /// <param name="buffer"></param> /// <param name="index"></param> protected GribMessage(GribHandle handle, GribContext context, GCHandle buffer, int index = 0) : base() { Handle = handle; Namespace = Namespaces[0]; KeyFilters = Interop.KeyFilters.All; Index = index; BufferHandle = buffer; }
/// <summary> /// Initializes a new instance of the <see cref="GribMessage" /> class. /// </summary> /// <param name="handle">The handle.</param> /// <param name="context">The context.</param> /// <param name="buffer">Pointer to a native array containing the message bytes.</param> /// <param name="index">The index.</param> protected GribMessage(GribHandle handle, GribContext context, IntPtr buffer, int index = 0) : base() { Handle = handle; Namespace = Namespaces[0]; KeyFilters = Interop.KeyFilters.All; Index = index; NativeBuffer = buffer; OwnsMemory = buffer != IntPtr.Zero; }
public static void GribGetGribexMode(GribContext c) { int ret = GribApiProxyPINVOKE.GribGetGribexMode(c.Reference); if (ret != 0) { throw Grib.Api.Interop.GribApiException.Create(ret); } }
public static void GribGtsHeaderOff(GribContext c) { GribApiProxyPINVOKE.GribGtsHeaderOff(c.Reference); }
public static SWIGTYPE_p_grib_index GribIndexRead(GribContext c, string filename, out int err) { global::System.IntPtr cPtr = GribApiProxyPINVOKE.GribIndexRead(c.Reference, filename, out err); SWIGTYPE_p_grib_index ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_grib_index(cPtr, false); return ret; }
public static string GribSamplesPath(GribContext c) { string ret = GribApiProxyPINVOKE.GribSamplesPath(c.Reference); return ret; }
public static void GribMultiSupportOff(GribContext c) { GribApiProxyPINVOKE.GribMultiSupportOff(c.Reference); }
public static void GribContextSetPrintProc(GribContext c, SWIGTYPE_p_f_p_q_const__grib_context_p_void_p_q_const__char__void printp) { GribApiProxyPINVOKE.GribContextSetPrintProc(c.Reference, SWIGTYPE_p_f_p_q_const__grib_context_p_void_p_q_const__char__void.getCPtr(printp)); }
public static GribHandle GribHandleNewFromMultiMessage(GribContext c, out System.IntPtr data, ref SizeT data_len, out int error) { System.IntPtr pVal = GribApiProxyPINVOKE.GribHandleNewFromMultiMessage(c.Reference, out data, ref data_len.Value, out error); return pVal == System.IntPtr.Zero ? null : new GribHandle(pVal); }
public static void GribCountInFile(GribContext c, GribFile f, out int n) { int ret = GribApiProxyPINVOKE.GribCountInFile(c.Reference, f.Reference, out n); if (ret != 0) { throw Grib.Api.Interop.GribApiException.Create(ret); } }
public static SWIGTYPE_p_grib_fieldset GribFieldsetNewFromFiles(GribContext c, string[] filenames, int nfiles, string[] keys, int nkeys, string where_string, string order_by_string, out int err) { global::System.IntPtr cPtr = GribApiProxyPINVOKE.GribFieldsetNewFromFiles(c.Reference, filenames, nfiles, keys, nkeys, where_string, order_by_string, out err); SWIGTYPE_p_grib_fieldset ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_grib_fieldset(cPtr, false); return ret; }
/// <summary> /// Initializes a new instance of the <see cref="GribMessage" /> class. /// </summary> /// <param name="handle">The handle.</param> /// <param name="context">The context.</param> /// <param name="index">The index.</param> protected GribMessage(GribHandle handle, GribContext context, int index = 0) : this(handle, context, IntPtr.Zero, index) { }
public static void GribGribexModeOff(GribContext c) { GribApiProxyPINVOKE.GribGribexModeOff(c.Reference); }
public static GribHandle GribHandleNewFromSamples(GribContext c, string res_name) { System.IntPtr pVal = GribApiProxyPINVOKE.GribHandleNewFromSamples(c.Reference, res_name); return pVal == System.IntPtr.Zero ? null : new GribHandle(pVal); }
public static void GribContextSetBufferMemoryProc(GribContext c, SWIGTYPE_p_f_p_q_const__grib_context_size_t__p_void griballoc, SWIGTYPE_p_f_p_q_const__grib_context_p_void__void gribfree, SWIGTYPE_p_f_p_q_const__grib_context_p_void_size_t__p_void gribrealloc) { GribApiProxyPINVOKE.GribContextSetBufferMemoryProc(c.Reference, SWIGTYPE_p_f_p_q_const__grib_context_size_t__p_void.getCPtr(griballoc), SWIGTYPE_p_f_p_q_const__grib_context_p_void__void.getCPtr(gribfree), SWIGTYPE_p_f_p_q_const__grib_context_p_void_size_t__p_void.getCPtr(gribrealloc)); }
public static SWIGTYPE_p_grib_multi_handle GribMultiHandleNew(GribContext c) { global::System.IntPtr cPtr = GribApiProxyPINVOKE.GribMultiHandleNew(c.Reference); SWIGTYPE_p_grib_multi_handle ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_grib_multi_handle(cPtr, false); return ret; }
public static void GribContextSetLoggingProc(GribContext c, SWIGTYPE_p_f_p_q_const__grib_context_int_p_q_const__char__void logp) { GribApiProxyPINVOKE.GribContextSetLoggingProc(c.Reference, SWIGTYPE_p_f_p_q_const__grib_context_int_p_q_const__char__void.getCPtr(logp)); }
public static void GribDumpActionTree(GribContext c, GribFile f) { GribApiProxyPINVOKE.GribDumpActionTree(c.Reference, f.Reference); }
public static void GribMultiSupportResetFile(GribContext c, GribFile f) { GribApiProxyPINVOKE.GribMultiSupportResetFile(c.Reference, f.Reference); }
public static GribContext GribContextNew(GribContext c) { System.IntPtr pVal = GribApiProxyPINVOKE.GribContextNew(c.Reference); return pVal == System.IntPtr.Zero ? null : new GribContext(pVal); }
public static GribHandle GribHandleNewFromPartialMessage(GribContext c, byte[] data, SizeT buflen) { System.IntPtr pVal = GribApiProxyPINVOKE.GribHandleNewFromPartialMessage(c.Reference, data, buflen.Value); return pVal == System.IntPtr.Zero ? null : new GribHandle(pVal); }
public static void GribContextDelete(GribContext c) { GribApiProxyPINVOKE.GribContextDelete(c.Reference); }
public static GribHandle EccodeGribNewFromFile(GribContext c, GribFile f, int headers_only, out int error) { System.IntPtr pVal = GribApiProxyPINVOKE.EccodeGribNewFromFile(c.Reference, f.Reference, headers_only, out error); return pVal == System.IntPtr.Zero ? null : new GribHandle(pVal); }
/// <summary> /// Initializes a new instance of the <see cref="GribMessage" /> class. /// </summary> /// <param name="handle">The handle.</param> /// <param name="context">The context.</param> /// <param name="index">The index.</param> protected GribMessage(GribHandle handle, GribContext context, int index = 0) : this(handle, context, new GCHandle(), index) { }