/// <summary> /// Consructor initislizing header,data /// </summary> /// <param name="hdr"></param> /// <param name="datum"></param> public BinaryTableHDU(Header hdr, Data datum) : base((TableData)datum) { myHeader = hdr; myData = datum; table = (BinaryTable) datum; }
/// <summary> /// Create an ascii table header/data unit /// </summary> /// <param name="h">The template specifying the ascii table.</param> /// <param name="d"> The FITS data structure containing the table data.</param> /// <exception cref="FitsException"> FitsException if there was a problem with the header.</exception> public AsciiTableHDU(Header h, Data d) : base((TableData) d) { myHeader = h; data = (AsciiTable) d; myData = d; }
/// <summary>Create a header which points to the given data object.</summary> /// <param name="o">The data object to be described.</param> /// <exception cref="FitsException"> FitsException if the data was not valid for this header.</exception> public Header(Data o) { InitBlock(); o.FillHeader(this); }
/// <summary>Make a header point to the given object.</summary> /// <param name="odata">The random groups data the header should describe.</param> internal static Header ManufactureHeader(Data d) { if (d == null) { throw new FitsException("Attempt to create null Random Groups data"); } Header h = new Header(); d.FillHeader(h); return h; }
//internal Object dataArray; /// <summary>Create an HDU from the given header and data</summary> public RandomGroupsHDU(Header h, Data d) { myHeader = h; myData = d; }
/// <summary>Create a header that describes the given /// image data. /// </summary> /// <param name="o">The image to be described. /// </param> /// <exception cref=""> FitsException if the object does not contain /// valid image data. /// /// </exception> public static Header ManufactureHeader(Data d) { Header h = new Header(); d.FillHeader(h); return h; }
/// <summary>Build an image HDU using the supplied data.</summary> /// <param name="obj">the data used to build the image.</param> /// <exception cref=""> FitsException if there was a problem with the data.</exception> public UndefinedHDU(Header h, Data d) { myData = d; myHeader = h; }
/// <summary>Create a header to match the input data.</summary> public static Header ManufactureHeader(Data d) { Header hdr = new Header(); d.FillHeader(hdr); Cursor c = hdr.GetCursor(); return hdr; }
/// <summary>Create an HDU from the given Data.</summary> /// <param name="datum">The data to be described in this HDU.</param> public static BasicHDU MakeHDU(Data datum) { Header hdr = new Header(); datum.FillHeader(hdr); return FitsFactory.HDUFactory(hdr, datum); }
/// <summary> Create an ascii table header/data unit.</summary> /// <param name="header">the template specifying the ascii table.</param> /// <exception cref=""> FitsException if there was a problem with the header.</exception> public AsciiTableHDU(Header h, Data d) : base((TableData)d) { myHeader = h; data = (AsciiTable)d; myData = d; }
/// <summary>Build a binary table HDU from the supplied data.</summary> /// <param name="data">the array used to build the binary table.</param> /// <exception cref="FitsException"> If there was a problem with the data.</exception> public static Header ManufactureHeader(Data data) { Header hdr = new Header(); data.FillHeader(hdr); return hdr; }
// change suggested in .99.5 version: Method made public from protected. /// <summary>Given Header and data objects return the appropriate type of HDU.</summary> public static BasicHDU HDUFactory(Header hdr, Data d) { if (d is ImageData) { return new ImageHDU(hdr, d); } else if (d is RandomGroupsData) { return new RandomGroupsHDU(hdr, d); } else if (d is AsciiTable) { return new AsciiTableHDU(hdr, d); } else if (d is BinaryTable) { return new BinaryTableHDU(hdr, d); } else if (d is UndefinedData) { return new UndefinedHDU(hdr, d); } return null; }
/// <summary>Build an image HDU using the supplied data.</summary> /// <param name="obj">the data used to build the image.</param> /// <exception cref="FitsException">If there was a problem with the data.</exception> public ImageHDU(Header h, Data d) { myData = d; myHeader = h; }
/// <summary>Create a header that describes the given image data.</summary> /// <param name="o">The image to be described.</param> /// <exception cref=""> FitsException if the object does not contain valid image data.</exception> public static Header ManufactureHeader(Data d) { if (d == null) { return null; } Header h = new Header(); d.FillHeader(h); return h; }
/// <summary>Read in the Data object for this HDU.</summary> /// <param name="stream">the stream from which the data is read.</param> /// <exception cref="FitsException"> FitsException if the Data object could not be created from this HDU's Header</exception> public virtual void ReadData(ArrayDataIO stream) { myData = null; try { myData = ManufactureData(); } finally { // if we cannot build a Data object, skip this section if (myData == null) { try { SkipData(stream, myHeader); } catch(Exception) { } } } myData.Read(stream); }
/// <summary>Read out the HDU from the data stream. This /// will overwrite any existing header and data components. /// </summary> public virtual void Read(ArrayDataIO stream) { myHeader = Header.ReadHeader(stream); myData = myHeader.MakeData(); myData.Read(stream); }