HiRISE
 Observation

MROSP_Header.hh
Go to the documentation of this file.
1 /* HiRISE MROSP_Header
2 
3 PIRL CVS ID: MROSP_Header.hh,v 1.24 2020/02/14 01:17:18 schaller Exp
4 
5 Copyright (C) 2004-2020 Arizona Board of Regents on behalf of the Lunar and
6 Planetary Laboratory at the University of Arizona.
7 
8 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
9 this file except in compliance with the License. You may obtain a copy of the
10 License at
11 
12  http://www.apache.org/licenses/LICENSE-2.0
13 
14 Unless required by applicable law or agreed to in writing, software distributed
15 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
16 CONDITIONS OF ANY KIND, either express or implied. See the License for the
17 specific language governing permissions and limitations under the License.
18 */
19 #ifndef _HiRISE_MROSP_Header_
20 #define _HiRISE_MROSP_Header_
21 
22 // UA::HiRISE
23 #include "Data_Component.hh"
24 
25 #if defined (INCLUDE_PVL)
26 // idaeim::PVL
27 #include "PVL.hh"
28 #endif
29 
30 #include <iostream>
31 
32 namespace UA
33 {
34 namespace HiRISE
35 {
36 /*******************************************************************************
37  MROSP Header
38 */
82 : public Data_Component
83 {
84 public:
85 /*==============================================================================
86  Constants:
87 */
89 static const char* const
90  ID;
91 
93 static const char* const
95 
107  {
116 
117  // The total number of Elements:
119  };
120 
122 static const char*
123  NAMES[];
124 
126 static const Index
128 
130 static const Index
132 
134 static const u_int_8
136 
137 /* Transaction Element bit fields:
138 */
140 static const u_int_8
142 
145  {
146  SCIENCE = 1,
147  ENGINEERING = 2
148  };
149 
151 static const char*
153 
155 static const unsigned int
157 
159 static const u_int_8
161 
164  {
168  END
169  };
170 
172 static const char*
174 
176 static const unsigned int
178 
180 static const u_int_8
182 
184 static const u_int_32
186 
187 /*==============================================================================
188  Constructors
189 */
196 MROSP_Header ();
197 
208 explicit MROSP_Header (std::istream& stream);
209 
218 MROSP_Header (const MROSP_Header& component, bool data_duplicate = true);
219 
225 MROSP_Header& operator= (const MROSP_Header& component);
226 
227 /*==============================================================================
228  Accessors
229 */
236 std::string id () const;
237 
243 const char* name () const;
244 
249 u_int_8 protocol_ID () const;
250 
257 
262 u_int_8 transaction () const;
263 
270 
278 int transaction_type () const;
279 
289 
297 int transaction_segmentation () const;
298 
309 
314 bool transaction_compressed () const;
315 
321 MROSP_Header& transaction_compressed (bool compressed);
322 
327 u_int_16 transaction_ID () const;
328 
335 
340 u_int_32 data_amount () const;
341 
348 
353 u_int_32 sync () const;
354 
360 MROSP_Header& sync (u_int_32 sync_pattern);
361 
366 u_int_16 checksum () const;
367 
374 
379 u_int_16 pad_0 () const;
380 
386 MROSP_Header& pad_0 (u_int_16 value);
387 
392 u_int_32 pad_1 () const;
393 
399 MROSP_Header& pad_1 (u_int_32 value);
400 
401 /*==============================================================================
402  Printing
403 */
415 std::ostream& print
416  (std::ostream& stream = std::cout, bool verbose = false) const;
417 
418 #if defined (INCLUDE_PVL)
419 /*==============================================================================
420  PVL
421 */
430 idaeim::PVL::Aggregate* PVL () const;
431 
432 #endif // defined (INCLUDE_PVL)
433 
434 /*==============================================================================
435  Validation
436 */
446 bool is_valid () const;
447 
448 }; // class MROSP_Header
449 
450 } // namespace HiRISE
451 } // namespace UA
452 #endif
A Data_Component provides a common, virtual interface for all HiRISE Observation data blocks.
Definition: Data_Component.hh:124
An MROSP_Header contains information used by the HiRISE instrument to identify a stored data block to...
Definition: MROSP_Header.hh:83
u_int_32 pad_1() const
Gets the Pad_1 Element value.
Definition: MROSP_Header.cc:396
u_int_8 transaction() const
Gets the Transaction Element value.
Definition: MROSP_Header.cc:221
static const u_int_8 TRANSACTION_SEGMENTATION_BIT_MASK
Transaction Element: segmentation bit fields.
Definition: MROSP_Header.hh:160
std::ostream & print(std::ostream &stream=std::cout, bool verbose=false) const
Prints the component structure and contents.
Definition: MROSP_Header.cc:419
MROSP_Header & operator=(const MROSP_Header &component)
Assigns another MROSP_Header to this one.
Definition: MROSP_Header.cc:180
static const unsigned int Transaction_Types
Total number of known transaction type values of the Transaction Element.
Definition: MROSP_Header.hh:156
bool transaction_compressed() const
Tests if the compression flag is set in the Transaction Element.
Definition: MROSP_Header.cc:280
static const char * Transaction_Segmentation_Names[]
Names of the known segmentation values of the Transaction Element.
Definition: MROSP_Header.hh:173
static const char * NAMES[]
The name of each Element.
Definition: MROSP_Header.hh:123
Elements
An Element refers to a data containing constituent of a component.
Definition: MROSP_Header.hh:107
@ Pad_0
Definition: MROSP_Header.hh:113
@ Total_Elements
Definition: MROSP_Header.hh:118
@ Transaction_ID
Definition: MROSP_Header.hh:110
@ Protocol_ID
Definition: MROSP_Header.hh:108
@ Pad_1
Definition: MROSP_Header.hh:115
@ Sync
Definition: MROSP_Header.hh:112
@ Transaction
Definition: MROSP_Header.hh:109
@ Checksum
Definition: MROSP_Header.hh:114
@ Data_Amount
Definition: MROSP_Header.hh:111
static const u_int_8 TRANSACTION_TYPE_BIT_MASK
Transaction Element: transaction type bit fields.
Definition: MROSP_Header.hh:141
std::string id() const
Provides the class ID on a line followed by the base Data_Component::id.
Definition: MROSP_Header.cc:193
static const u_int_8 PROTOCOL_ID
The expected Protocol_ID Element value.
Definition: MROSP_Header.hh:135
MROSP_Header()
Constructs an empty MROSP_Header.
Definition: MROSP_Header.cc:144
static const Index OFFSETS[]
Data_Block data storage address offset for each Element.
Definition: MROSP_Header.hh:131
static const u_int_8 TRANSACTION_COMPRESSED_BIT_MASK
Transaction Element: Compressed data flag bit.
Definition: MROSP_Header.hh:181
const char * name() const
Gets the NAME of this class.
Definition: MROSP_Header.cc:197
static const u_int_32 SYNC
Expected Sync Element value.
Definition: MROSP_Header.hh:185
bool is_valid() const
Tests if the component data is valid.
Definition: MROSP_Header.cc:527
u_int_8 protocol_ID() const
Gets the Protocol_ID Element value.
Definition: MROSP_Header.cc:202
u_int_16 checksum() const
Gets the Checksum Element value.
Definition: MROSP_Header.cc:358
int transaction_segmentation() const
Gets the segmentation value from the Transaction Element.
Definition: MROSP_Header.cc:260
u_int_16 transaction_ID() const
Gets the Transaction_ID Element value.
Definition: MROSP_Header.cc:301
static const unsigned int Transaction_Segmentations
Total number of known segmentation values of the Transaction Element.
Definition: MROSP_Header.hh:177
Transaction_Type
Known transaction type values for the Transaction Element.
Definition: MROSP_Header.hh:145
@ ENGINEERING
Definition: MROSP_Header.hh:147
@ SCIENCE
Definition: MROSP_Header.hh:146
Transaction_Segmentation
Known segmentation values for the Transaction Element.
Definition: MROSP_Header.hh:164
@ START
Definition: MROSP_Header.hh:166
@ MIDDLE
Definition: MROSP_Header.hh:167
@ NONE
Definition: MROSP_Header.hh:165
@ END
Definition: MROSP_Header.hh:168
int transaction_type() const
Gets the transaction type value from the Transaction Element.
Definition: MROSP_Header.cc:240
u_int_32 data_amount() const
Gets the Data_Amount Element value.
Definition: MROSP_Header.cc:320
u_int_16 pad_0() const
Gets the Pad_0 Element value.
Definition: MROSP_Header.cc:377
static const char *const ID
Class identification name with source code version and date.
Definition: MROSP_Header.hh:90
static const char *const NAME
The component name.
Definition: MROSP_Header.hh:94
static const char * Transaction_Type_Names[]
Names of the known transaction type values of the Transaction Element.
Definition: MROSP_Header.hh:152
idaeim::PVL::Aggregate * PVL() const
Produces a PVL rendition of the component.
Definition: MROSP_Header.cc:479
u_int_32 sync() const
Gets the Sync Element value.
Definition: MROSP_Header.cc:339
static const Index COMPONENT_BYTES
Total number of bytes in the Data_Block.
Definition: MROSP_Header.hh:127
U_INT_16_TYPE u_int_16
16-bit unsigned integer type.
Definition: Data_Component.hh:68
unsigned int u_int_32
U_INT_8_TYPE u_int_8
8-bit unsigned integer type.
Definition: Data_Component.hh:56
PIRL::Data_Block::Index Index
Data_Block element index type.
Definition: Data_Component.hh:95
University of Arizona.