Observation
|
00001 /* HiRISE MROSP_Header 00002 00003 PIRL CVS ID: MROSP_Header.hh,v 1.24 2020/02/14 01:17:18 schaller Exp 00004 00005 Copyright (C) 2004-2020 Arizona Board of Regents on behalf of the Lunar and 00006 Planetary Laboratory at the University of Arizona. 00007 00008 Licensed under the Apache License, Version 2.0 (the "License"); you may not use 00009 this file except in compliance with the License. You may obtain a copy of the 00010 License at 00011 00012 http://www.apache.org/licenses/LICENSE-2.0 00013 00014 Unless required by applicable law or agreed to in writing, software distributed 00015 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 00016 CONDITIONS OF ANY KIND, either express or implied. See the License for the 00017 specific language governing permissions and limitations under the License. 00018 */ 00019 #ifndef _HiRISE_MROSP_Header_ 00020 #define _HiRISE_MROSP_Header_ 00021 00022 // UA::HiRISE 00023 #include "Data_Component.hh" 00024 00025 #if defined (INCLUDE_PVL) 00026 // idaeim::PVL 00027 #include "PVL.hh" 00028 #endif 00029 00030 #include <iostream> 00031 00032 namespace UA 00033 { 00034 namespace HiRISE 00035 { 00036 /******************************************************************************* 00037 MROSP Header 00038 */ 00081 class MROSP_Header 00082 : public Data_Component 00083 { 00084 public: 00085 /*============================================================================== 00086 Constants: 00087 */ 00089 static const char* const 00090 ID; 00091 00093 static const char* const 00094 NAME; 00095 00106 enum Elements 00107 { 00108 Protocol_ID, 00109 Transaction, 00110 Transaction_ID, 00111 Data_Amount, 00112 Sync, 00113 Pad_0, 00114 Checksum, 00115 Pad_1, 00116 00117 // The total number of Elements: 00118 Total_Elements 00119 }; 00120 00122 static const char* 00123 NAMES[]; 00124 00126 static const Index 00127 COMPONENT_BYTES; 00128 00130 static const Index 00131 OFFSETS[]; 00132 00134 static const u_int_8 00135 PROTOCOL_ID; 00136 00137 /* Transaction Element bit fields: 00138 */ 00140 static const u_int_8 00141 TRANSACTION_TYPE_BIT_MASK; 00142 00144 enum Transaction_Type 00145 { 00146 SCIENCE = 1, 00147 ENGINEERING = 2 00148 }; 00149 00151 static const char* 00152 Transaction_Type_Names[]; 00153 00155 static const unsigned int 00156 Transaction_Types; 00157 00159 static const u_int_8 00160 TRANSACTION_SEGMENTATION_BIT_MASK; 00161 00163 enum Transaction_Segmentation 00164 { 00165 NONE, 00166 START, 00167 MIDDLE, 00168 END 00169 }; 00170 00172 static const char* 00173 Transaction_Segmentation_Names[]; 00174 00176 static const unsigned int 00177 Transaction_Segmentations; 00178 00180 static const u_int_8 00181 TRANSACTION_COMPRESSED_BIT_MASK; 00182 00184 static const u_int_32 00185 SYNC; 00186 00187 /*============================================================================== 00188 Constructors 00189 */ 00196 MROSP_Header (); 00197 00208 explicit MROSP_Header (std::istream& stream); 00209 00218 MROSP_Header (const MROSP_Header& component, bool data_duplicate = true); 00219 00225 MROSP_Header& operator= (const MROSP_Header& component); 00226 00227 /*============================================================================== 00228 Accessors 00229 */ 00236 std::string id () const; 00237 00243 const char* name () const; 00244 00249 u_int_8 protocol_ID () const; 00250 00256 MROSP_Header& protocol_ID (u_int_8 ID); 00257 00262 u_int_8 transaction () const; 00263 00269 MROSP_Header& transaction (u_int_8 value); 00270 00278 int transaction_type () const; 00279 00288 MROSP_Header& transaction_type (Transaction_Type type); 00289 00297 int transaction_segmentation () const; 00298 00308 MROSP_Header& transaction_segmentation (Transaction_Segmentation segmentation); 00309 00314 bool transaction_compressed () const; 00315 00321 MROSP_Header& transaction_compressed (bool compressed); 00322 00327 u_int_16 transaction_ID () const; 00328 00334 MROSP_Header& transaction_ID (u_int_16 ID); 00335 00340 u_int_32 data_amount () const; 00341 00347 MROSP_Header& data_amount (u_int_32 amount); 00348 00353 u_int_32 sync () const; 00354 00360 MROSP_Header& sync (u_int_32 sync_pattern); 00361 00366 u_int_16 checksum () const; 00367 00373 MROSP_Header& checksum (u_int_16 value); 00374 00379 u_int_16 pad_0 () const; 00380 00386 MROSP_Header& pad_0 (u_int_16 value); 00387 00392 u_int_32 pad_1 () const; 00393 00399 MROSP_Header& pad_1 (u_int_32 value); 00400 00401 /*============================================================================== 00402 Printing 00403 */ 00415 std::ostream& print 00416 (std::ostream& stream = std::cout, bool verbose = false) const; 00417 00418 #if defined (INCLUDE_PVL) 00419 /*============================================================================== 00420 PVL 00421 */ 00430 idaeim::PVL::Aggregate* PVL () const; 00431 00432 #endif // defined (INCLUDE_PVL) 00433 00434 /*============================================================================== 00435 Validation 00436 */ 00446 bool is_valid () const; 00447 00448 }; // class MROSP_Header 00449 00450 } // namespace HiRISE 00451 } // namespace UA 00452 #endif