Debian Codegraph @

src/main/java/nom/tam/fits/header/Checksum.java

raw
1 package nom.tam.fits.header;
2
3 /*
4 * #%L
5 * nom.tam FITS library
6 * %%
7 * Copyright (C) 1996 - 2024 nom-tam-fits
8 * %%
9 * This is free and unencumbered software released into the public domain.
10 *
11 * Anyone is free to copy, modify, publish, use, compile, sell, or
12 * distribute this software, either in source code form or as a compiled
13 * binary, for any purpose, commercial or non-commercial, and by any
14 * means.
15 *
16 * In jurisdictions that recognize copyright laws, the author or authors
17 * of this software dedicate any and all copyright interest in the
18 * software to the public domain. We make this dedication for the benefit
19 * of the public at large and to the detriment of our heirs and
20 * successors. We intend this dedication to be an overt act of
21 * relinquishment in perpetuity of all present and future rights to this
22 * software under copyright law.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
27 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
28 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
29 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
30 * OTHER DEALINGS IN THE SOFTWARE.
31 * #L%
32 */
33
34 /**
35 * <p>
36 * File checksum keywords. This data dictionary contains FITS keywords that have been widely used within the
37 * astronomical community. It is recommended that these keywords only be used as defined here.
38 * </p>
39 * <p>
40 * See <a href=
41 * "http://heasarc.gsfc.nasa.gov/docs/fcg/common_dict.html">http://heasarc.gsfc.nasa.gov/docs/fcg/common_dict.html</a>
42 * </p>
43 *
44 * @author Richard van Nieuwenhoven
45 */
46 public enum Checksum implements IFitsHeader {
47 /**
48 * The value field of the CHECKSUM keyword shall contain a 16 character string, left justified starting in column
49 * 12, containing the ASCII encoded complement of the checksum of the FITS HDU (Header and Data Unit). The algorithm
50 * shall be the 32-bit 1's complement checksum and the ASCII encoding that are described in the checksum proposal.
51 * The checksum is accumulated in FITS datastream order on the same HDU, identical in all respects, except that the
52 * value of the CHECKSUM keyword shall be set to the string '0000000000000000' (ASCII 0's, hex 30) before the
53 * checksum is computed.
54 */
55 CHECKSUM(HDU.ANY, VALUE.STRING, "complement checksum for the current HDU"),
56 /**
57 * The value field of the CHECKVER keyword shall contain a string, unique in the first 8 characters, which
58 * distinguishes between any future alternative checksum algorithms which may be defined. The default value for a
59 * missing keyword shall be 'COMPLEMENT' which will represent the algorithm defined in the current proposal. It is
60 * recommended that this keyword be omitted from headers which implement the default ASCII encoded 32-bit 1's
61 * complement algorithm.
62 */
63 CHECKVER(HDU.ANY, VALUE.STRING, "version of checksum algorithm"),
64
65 /**
66 * The value field of the DATASUM keyword shall be a character string containing the unsigned integer value of the
67 * checksum of the data records of the HDU. For dataless HDU's, this keyword may either be omitted, or the value
68 * field shall contain the string value '0', which is preferred. A missing DATASUM keyword asserts no knowledge of
69 * the checksum of the data records.
70 */
71 DATASUM(HDU.ANY, VALUE.STRING, "checksum of the data records");
72
73 private final FitsKey key;
74
75 Checksum(HDU hdu, VALUE valueType, String comment) {
76 key = new FitsKey(name(), IFitsHeader.SOURCE.CHECKSUM, hdu, valueType, comment);
77 FitsKey.registerStandard(this);
78 }
79
80 @Override
81 public FitsKey impl() {
82 return key;
83 }
84 }