![]() |
Observation
|
An MROSP_Header contains information used by the HiRISE instrument to identify a stored data block to the MRO spacecraft for downlink to Earth. More...
#include <MROSP_Header.hh>
Public Types | |
enum | Elements { Protocol_ID, Transaction, Transaction_ID, Data_Amount, Sync, Pad_0, Checksum, Pad_1, Total_Elements } |
An Element refers to a data containing constituent of a component. More... | |
enum | Transaction_Type { SCIENCE = 1, ENGINEERING = 2 } |
Known transaction type values for the Transaction Element. More... | |
enum | Transaction_Segmentation { NONE, START, MIDDLE, END } |
Known segmentation values for the Transaction Element. More... | |
Public Member Functions | |
MROSP_Header () | |
Constructs an empty MROSP_Header. | |
MROSP_Header (std::istream &stream) | |
Constructs an MROSP_Header loaded from a data stream. | |
MROSP_Header (const MROSP_Header &component, bool data_duplicate=true) | |
Copy constructor. | |
MROSP_Header & | operator= (const MROSP_Header &component) |
Assigns another MROSP_Header to this one. | |
std::string | id () const |
Provides the class ID on a line followed by the base Data_Component::id. | |
const char * | name () const |
Gets the NAME of this class. | |
u_int_8 | protocol_ID () const |
Gets the Protocol_ID Element value. | |
MROSP_Header & | protocol_ID (u_int_8 ID) |
Sets the Protocol_ID Element value. | |
u_int_8 | transaction () const |
Gets the Transaction Element value. | |
MROSP_Header & | transaction (u_int_8 value) |
Sets the Transaction Element value. | |
int | transaction_type () const |
Gets the transaction type value from the Transaction Element. | |
MROSP_Header & | transaction_type (Transaction_Type type) |
Sets the transaction type value in the Transaction Element. | |
int | transaction_segmentation () const |
Gets the segmentation value from the Transaction Element. | |
MROSP_Header & | transaction_segmentation (Transaction_Segmentation segmentation) |
Sets the segmentation value in the Transaction Element. | |
bool | transaction_compressed () const |
Tests if the compression flag is set in the Transaction Element. | |
MROSP_Header & | transaction_compressed (bool compressed) |
Sets or resets the compression flag in the Transaction Element. | |
u_int_16 | transaction_ID () const |
Gets the Transaction_ID Element value. | |
MROSP_Header & | transaction_ID (u_int_16 ID) |
Sets the Transaction_ID Element value. | |
u_int_32 | data_amount () const |
Gets the Data_Amount Element value. | |
MROSP_Header & | data_amount (u_int_32 amount) |
Sets the Data_Amount Element value. | |
u_int_32 | sync () const |
Gets the Sync Element value. | |
MROSP_Header & | sync (u_int_32 sync_pattern) |
Sets the Sync Element value. | |
u_int_16 | checksum () const |
Gets the Checksum Element value. | |
MROSP_Header & | checksum (u_int_16 value) |
Sets the Checksum Element value. | |
u_int_16 | pad_0 () const |
Gets the Pad_0 Element value. | |
MROSP_Header & | pad_0 (u_int_16 value) |
Sets the Pad_0 Element value. | |
u_int_32 | pad_1 () const |
Gets the Pad_1 Element value. | |
MROSP_Header & | pad_1 (u_int_32 value) |
Sets the Pad_1 Element value. | |
std::ostream & | print (std::ostream &stream=std::cout, bool verbose=false) const |
Prints the component structure and contents. | |
idaeim::PVL::Aggregate * | PVL () const |
Produces a PVL rendition of the component. | |
bool | is_valid () const |
Tests if the component data is valid. | |
Static Public Attributes | |
static const char *const | ID = "UA::HiRISE::MROSP_Header (1.32 2020/02/14 01:17:18)" |
Class identification name with source code version and date. | |
static const char *const | NAME = "MROSP Header" |
The component name. | |
static const char * | NAMES [] |
The name of each Element. | |
static const Index | COMPONENT_BYTES = MROSP_HEADER_BYTES |
Total number of bytes in the Data_Block. | |
static const Index | OFFSETS [] |
Data_Block data storage address offset for each Element. | |
static const u_int_8 | PROTOCOL_ID = 0xFF |
The expected Protocol_ID Element value. | |
static const u_int_8 | TRANSACTION_TYPE_BIT_MASK = 0x1F |
Transaction Element: transaction type bit fields. | |
static const char * | Transaction_Type_Names [] |
Names of the known transaction type values of the Transaction Element. | |
static const unsigned int | Transaction_Types = (sizeof (Transaction_Type_Names) / sizeof (char*)) |
Total number of known transaction type values of the Transaction Element. | |
static const u_int_8 | TRANSACTION_SEGMENTATION_BIT_MASK = 0x60 |
Transaction Element: segmentation bit fields. | |
static const char * | Transaction_Segmentation_Names [] |
Names of the known segmentation values of the Transaction Element. | |
static const unsigned int | Transaction_Segmentations = (sizeof (Transaction_Segmentation_Names) / sizeof (char*)) |
Total number of known segmentation values of the Transaction Element. | |
static const u_int_8 | TRANSACTION_COMPRESSED_BIT_MASK = 0x80 |
Transaction Element: Compressed data flag bit. | |
static const u_int_32 | SYNC = 0xFED4AFEE |
Expected Sync Element value. |
An MROSP_Header contains information used by the HiRISE instrument to identify a stored data block to the MRO spacecraft for downlink to Earth.
This Data_Component is the zero-th data block in the observation data stream. It is stripped from the observation data stream by ground processing before delivery to the HiROC facility. It is likely to be present in sample images from the instrument manufacturer, but will not be present in any production images.
Header data block layout:
Offset Size Description ------ ---- ----------- 0 1 Protocol ID (0xFF) 1 1 Transaction - Bits Description ----- ----------- 0 - 4 Transaction type 1 - Science data 2 - Engineering data 5 - 6 Segmentation 0 - None 1 - Start 2 - Middle 3 - End 7 Compressed data flag
2 2 Transaction ID from EXPOSE_TIME command 4 4 Observation length including all headers and data (bytes) 8 4 Sync pattern (0xFED4AFEE) 12 2 (padding) 14 2 Checksum 16 4 (padding)
N.B.: Data_Block values are MSB ordered.
enum Elements |
An Element refers to a data containing constituent of a component.
Each named Element is an Index into various data sets that define the attributes of a component; including their NAMES, data storage address OFFSETS, and number of array element values. It is the key Index argument of the data access methods.
enum Transaction_Type |
MROSP_Header | ( | ) |
Constructs an empty MROSP_Header.
The base Data_Component is initialized with the NAMES, COMPONENT_BYTES and OFFSETS that define an MROSP_Header component structure.
MROSP_Header | ( | std::istream & | stream ) | [explicit] |
Constructs an MROSP_Header loaded from a data stream.
The base Data_Component is initialized with the NAMES, COMPONENT_BYTES and OFFSETS that define an MROSP_Header component structure. The stream is then read for COMPONENT_BYTES to fill the data block. Therefore, the stream must be positioned at the beginning of the MROSP_Header data.
stream | The istream from which to read the component data. |
MROSP_Header | ( | const MROSP_Header & | component, |
bool | data_duplicate = true |
||
) |
Copy constructor.
component | The MROSP_Header to be copied. |
data_duplicate | true if the data content of the copied component is to be duplicated in the copy; false if the data content is to be shared. |
MROSP_Header & operator= | ( | const MROSP_Header & | component ) |
Assigns another MROSP_Header to this one.
component | The MROSP_Header to be assigned. |
References Data_Component::operator=().
string id | ( | ) | const [virtual] |
Provides the class ID on a line followed by the base Data_Component::id.
Reimplemented from Data_Component.
References MROSP_Header::ID.
const char * name | ( | ) | const [virtual] |
Gets the NAME of this class.
Implements Data_Component.
References MROSP_Header::NAME.
u_int_8 protocol_ID | ( | ) | const |
Gets the Protocol_ID Element value.
References Data_Component::get(), MROSP_Header::ID, and MROSP_Header::Protocol_ID.
Referenced by MROSP_Header::PVL().
MROSP_Header & protocol_ID | ( | u_int_8 | ID ) |
u_int_8 transaction | ( | ) | const |
Gets the Transaction Element value.
References Data_Component::get(), and MROSP_Header::Transaction.
Referenced by MROSP_Header::PVL(), MROSP_Header::transaction_compressed(), MROSP_Header::transaction_segmentation(), and MROSP_Header::transaction_type().
MROSP_Header & transaction | ( | u_int_8 | value ) |
int transaction_type | ( | ) | const |
Gets the transaction type value from the Transaction Element.
The value is least significant bit aligned: the lsb of the bit field is the lsb of the returned value.
References MROSP_Header::transaction(), and MROSP_Header::TRANSACTION_TYPE_BIT_MASK.
Referenced by MROSP_Header::PVL().
MROSP_Header & transaction_type | ( | Transaction_Type | type ) |
Sets the transaction type value in the Transaction Element.
The value is least significant bit aligned: the lsb of the bit field is the lsb of the returned value.
type | The Transaction_Type value to put in the bit field. |
int transaction_segmentation | ( | ) | const |
Gets the segmentation value from the Transaction Element.
The value is least significant bit aligned: the lsb of the bit field is the lsb of the returned value.
References MROSP_Header::transaction(), and MROSP_Header::TRANSACTION_SEGMENTATION_BIT_MASK.
Referenced by MROSP_Header::PVL().
MROSP_Header & transaction_segmentation | ( | Transaction_Segmentation | segmentation ) |
Sets the segmentation value in the Transaction Element.
The value is least significant bit aligned: the lsb of the bit field is the lsb of the returned value.
segmentation | The Transaction_Segmentation value to put in the bit field. |
bool transaction_compressed | ( | ) | const |
Tests if the compression flag is set in the Transaction Element.
References MROSP_Header::transaction(), and MROSP_Header::TRANSACTION_COMPRESSED_BIT_MASK.
Referenced by MROSP_Header::PVL().
MROSP_Header & transaction_compressed | ( | bool | compressed ) |
Sets or resets the compression flag in the Transaction Element.
compressed | true if the bit flag is to be set; false otherwise. |
u_int_16 transaction_ID | ( | ) | const |
Gets the Transaction_ID Element value.
References Data_Component::get(), MROSP_Header::ID, and MROSP_Header::Transaction_ID.
Referenced by MROSP_Header::PVL().
MROSP_Header & transaction_ID | ( | u_int_16 | ID ) |
u_int_32 data_amount | ( | ) | const |
Gets the Data_Amount Element value.
References MROSP_Header::Data_Amount, and Data_Component::get().
Referenced by MROSP_Header::PVL().
MROSP_Header & data_amount | ( | u_int_32 | amount ) |
u_int_32 sync | ( | ) | const |
Gets the Sync Element value.
References Data_Component::get(), and MROSP_Header::Sync.
Referenced by MROSP_Header::PVL().
MROSP_Header & sync | ( | u_int_32 | sync_pattern ) |
u_int_16 checksum | ( | ) | const |
Gets the Checksum Element value.
References MROSP_Header::Checksum, and Data_Component::get().
Referenced by MROSP_Header::print(), and MROSP_Header::PVL().
MROSP_Header & checksum | ( | u_int_16 | value ) |
u_int_16 pad_0 | ( | ) | const |
Gets the Pad_0 Element value.
References Data_Component::get(), and MROSP_Header::Pad_0.
MROSP_Header & pad_0 | ( | u_int_16 | value ) |
u_int_32 pad_1 | ( | ) | const |
Gets the Pad_1 Element value.
References Data_Component::get(), and MROSP_Header::Pad_1.
MROSP_Header & pad_1 | ( | u_int_32 | value ) |
ostream & print | ( | std::ostream & | stream = std::cout , |
bool | verbose = false |
||
) | const [virtual] |
Prints the component structure and contents.
Verbose printing includes the class ID and the Pad Elements.
stream | The ostream where the listing will be written. |
verbose | true if the listing is to be verbose, otherwise some structural details will be omitted for easier human consumption. |
Implements Data_Component.
References MROSP_Header::checksum(), and Data_Component::internet_checksum().
Referenced by Observation::components(), list_data(), and list_selections().
Aggregate * PVL | ( | ) | const [virtual] |
Produces a PVL rendition of the component.
The bit fields of the Transaction Element are contained in their own group. The Pad Elements are not included.
Implements Data_Component.
References Aggregate::add(), MROSP_Header::checksum(), MROSP_Header::Checksum, MROSP_Header::data_amount(), MROSP_Header::Data_Amount, MROSP_Header::NAME, MROSP_Header::NAMES, MROSP_Header::protocol_ID(), MROSP_Header::Protocol_ID, MROSP_Header::sync(), MROSP_Header::Sync, MROSP_Header::transaction(), MROSP_Header::Transaction, MROSP_Header::transaction_compressed(), MROSP_Header::transaction_ID(), MROSP_Header::Transaction_ID, MROSP_Header::transaction_segmentation(), MROSP_Header::Transaction_Segmentation_Names, MROSP_Header::Transaction_Segmentations, MROSP_Header::transaction_type(), MROSP_Header::Transaction_Type_Names, MROSP_Header::Transaction_Types, and Data_Block::value_size_of().
Referenced by list_selections().
bool is_valid | ( | ) | const [virtual] |
Tests if the component data is valid.
The Protocol_ID and Sync Element values must equal the expected PROTOCOL_ID and SYNC constants, and the internet_checksum should produce a zero value.
The checksum should also be tested:
! internet_checksum ();
Implements Data_Component.
References MROSP_Header::PROTOCOL_ID, MROSP_Header::Protocol_ID, MROSP_Header::SYNC, and MROSP_Header::Sync.
Referenced by Observation::components(), list_data(), and list_selections().
const char *const ID = "UA::HiRISE::MROSP_Header (1.32 2020/02/14 01:17:18)" [static] |
Class identification name with source code version and date.
Reimplemented from Data_Component.
Referenced by MROSP_Header::id(), main(), MROSP_Header::protocol_ID(), and MROSP_Header::transaction_ID().
const char *const NAME = "MROSP Header" [static] |
The component name.
Referenced by MROSP_Header::name(), and MROSP_Header::PVL().
const char * NAMES [static] |
{ "Protocol_ID", "Transaction", "Transaction_ID", "Data_Amount", "Sync", "Pad_0", "Checksum", "Pad_1", NULL }
The name of each Element.
Referenced by MROSP_Header::PVL().
const Index COMPONENT_BYTES = MROSP_HEADER_BYTES [static] |
Total number of bytes in the Data_Block.
Referenced by Observation::components().
{ 0, 1, 2, 4, 8, 12, 14, 16, COMPONENT_BYTES, 0 }
Data_Block data storage address offset for each Element.
const u_int_8 PROTOCOL_ID = 0xFF [static] |
The expected Protocol_ID Element value.
Referenced by MROSP_Header::is_valid().
const u_int_8 TRANSACTION_TYPE_BIT_MASK = 0x1F [static] |
Transaction Element: transaction type bit fields.
Referenced by MROSP_Header::transaction_type().
const char * Transaction_Type_Names [static] |
{ "Science", "Engineering" }
Names of the known transaction type values of the Transaction Element.
Referenced by MROSP_Header::PVL().
const unsigned int Transaction_Types = (sizeof (Transaction_Type_Names) / sizeof (char*)) [static] |
Total number of known transaction type values of the Transaction Element.
Referenced by MROSP_Header::PVL().
const u_int_8 TRANSACTION_SEGMENTATION_BIT_MASK = 0x60 [static] |
Transaction Element: segmentation bit fields.
Referenced by MROSP_Header::transaction_segmentation().
const char * Transaction_Segmentation_Names [static] |
{ "None", "Start", "Middle", "End" }
Names of the known segmentation values of the Transaction Element.
Referenced by MROSP_Header::PVL().
const unsigned int Transaction_Segmentations = (sizeof (Transaction_Segmentation_Names) / sizeof (char*)) [static] |
Total number of known segmentation values of the Transaction Element.
Referenced by MROSP_Header::PVL().
const u_int_8 TRANSACTION_COMPRESSED_BIT_MASK = 0x80 [static] |
Transaction Element: Compressed data flag bit.
Referenced by MROSP_Header::transaction_compressed().
Expected Sync Element value.
Referenced by MROSP_Header::is_valid().