1 /* Contributed in the public domain.
2 * Licensed to CS GROUP (CS) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * CS licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package org.orekit.files.spice.binary.daf.generic;
18
19 import java.util.Collections;
20 import java.util.List;
21
22 /**
23 * Class representing a generic DAF file, containing file-wide metadata,
24 * optional comments, and multiple {@link DAFArray}.
25 *
26 * DAF (Double Precision Array File) is a binary file architecture designed to
27 * store arrays of double precision arrays used by SPICE, NAIF toolkit software library.
28 * The architecture forms the basis of multiple file formats used to store different
29 * data related to astrodynamics, such as SPK, PCK and CK files
30 * (https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/daf.html).
31 *
32 * DAF files provide a generic architecture onto which more specific file
33 * formats are implemented. They are organized in records of fixed length (1024 bytes)
34 * containing different information. The first record is called the file record,
35 * and contains global metadata for the file. This is followed by an optional block
36 * comprising any number of comment records. After this, the file consits of sets of
37 * summary records, name records and element records. These are structured as blocks
38 * of 1 summary record (which contains multiple array summaries, providing metadata
39 * about each array), followed by 1 name record (comprising names for the corresponding
40 * arrays whose summaries were in the previous summary record) and finally by as many
41 * element records as required to store the arrays described in the corresponding summary
42 * records. For a detailed description of the DAF architecture, see NAIF documentation
43 * (https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/daf.html).
44 *
45 * @author Rafael Ayala
46 * @since XX.XX
47 */
48 public class DAF {
49
50 /**
51 * Global file-wide metadata found in the file record (the first record of the file).
52 */
53 private final DAFFileRecord metadata;
54
55 /**
56 * Comments from the DAF file. Not always present.
57 */
58 private final String comments;
59
60 /**
61 * DAF arrays contained in the DAF file.
62 */
63 private final List<DAFArray> arrays;
64
65 /**
66 * Simple constructor.
67 *
68 * @param metadata global file-wide metadata for the DAF file contained in
69 * the file record
70 * @param comments comments from the DAF file. Not always present
71 * @param arrays list of {@link DAFArray} (each comprising an array summary,
72 * an array name and array elements)
73 */
74 public DAF(final DAFFileRecord metadata,
75 final String comments,
76 final List<DAFArray> arrays) {
77 this.metadata = metadata;
78 this.comments = comments;
79 this.arrays = arrays;
80 }
81
82 /**
83 * Get thefile record, storing global file-wide metadata.
84 *
85 * @return the {@link DAFFileRecord}
86 */
87 public DAFFileRecord getMetadata() {
88 return metadata;
89 }
90
91 /**
92 * Get the comments from the DAF file.
93 *
94 * @return comments from the DAF file
95 */
96 public String getComments() {
97 return comments;
98 }
99
100 /**
101 * Get the arrays contained in the DAF file.
102 *
103 * @return list of {@link DAFArray}
104 */
105 public List<DAFArray> getArrays() {
106 return Collections.unmodifiableList(arrays);
107 }
108 }