1 /* Copyright 2002-2026 CS GROUP
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.ccsds.ndm.cdm;
18
19 import java.util.List;
20 import java.util.Optional;
21
22 import org.orekit.data.DataContext;
23 import org.orekit.files.ccsds.ndm.NdmConstituent;
24 import org.orekit.files.ccsds.ndm.odm.UserDefined;
25 import org.orekit.utils.IERSConventions;
26
27 /**
28 * This class stores all the information of the Conjunction Data Message (CDM) File parsed
29 * by CdmParser. It contains the header and a list of segments each
30 * containing metadata and a list of data lines.
31 * @author Melina Vanel
32 * @since 11.2
33 */
34 public class Cdm extends NdmConstituent<CdmHeader, CdmSegment> {
35
36 /** Root element for XML files. */
37 public static final String ROOT = "cdm";
38
39 /** Key for format version. */
40 public static final String FORMAT_VERSION_KEY = "CCSDS_CDM_VERS";
41
42 /** Simple constructor.
43 * @param header file header
44 * @param segments file segments
45 * @param conventions IERS conventions
46 * @param dataContext used for creating frames, time scales, etc.
47 */
48 public Cdm(final CdmHeader header, final List<CdmSegment> segments,
49 final IERSConventions conventions, final DataContext dataContext) {
50 super(header, segments, conventions, dataContext);
51 }
52
53 /** Get the file metadata.
54 * @return file metadata
55 */
56 public CdmRelativeMetadata getRelativeMetadata() {
57 return getSegments().getFirst().getMetadata().getRelativeMetadata();
58 }
59
60 /** Get the file metadata.
61 * @return file metadata
62 */
63 public CdmMetadata getMetadataObject1() {
64 return getSegments().getFirst().getMetadata();
65 }
66
67 /** Get the file metadata.
68 * @return file metadata
69 */
70 public CdmMetadata getMetadataObject2() {
71 return getSegments().get(1).getMetadata();
72 }
73
74 /** Get the file data.
75 * @return file data
76 */
77 public CdmData getDataObject1() {
78 return getSegments().getFirst().getData();
79 }
80
81 /** Get the file data.
82 * @return file data
83 */
84 public CdmData getDataObject2() {
85 return getSegments().get(1).getData();
86 }
87
88 /** Get user defined parameters.
89 * <p> This method will return null if the user defined block is not present in the CDM</p>
90 * @return file data
91 */
92 public Optional<UserDefined> getUserDefinedParameters() {
93 return getSegments().getFirst().getData().getUserDefinedBlock();
94 }
95
96 }