HiRISE
 Observation

Public Types | Public Member Functions | Static Public Attributes

MROSP_Header Class Reference

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>

Inheritance diagram for MROSP_Header:
Inheritance graph
[legend]
Collaboration diagram for MROSP_Header:
Collaboration graph
[legend]

List of all members.

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_Headeroperator= (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_Headerprotocol_ID (u_int_8 ID)
 Sets the Protocol_ID Element value.
u_int_8 transaction () const
 Gets the Transaction Element value.
MROSP_Headertransaction (u_int_8 value)
 Sets the Transaction Element value.
int transaction_type () const
 Gets the transaction type value from the Transaction Element.
MROSP_Headertransaction_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_Headertransaction_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_Headertransaction_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_Headertransaction_ID (u_int_16 ID)
 Sets the Transaction_ID Element value.
u_int_32 data_amount () const
 Gets the Data_Amount Element value.
MROSP_Headerdata_amount (u_int_32 amount)
 Sets the Data_Amount Element value.
u_int_32 sync () const
 Gets the Sync Element value.
MROSP_Headersync (u_int_32 sync_pattern)
 Sets the Sync Element value.
u_int_16 checksum () const
 Gets the Checksum Element value.
MROSP_Headerchecksum (u_int_16 value)
 Sets the Checksum Element value.
u_int_16 pad_0 () const
 Gets the Pad_0 Element value.
MROSP_Headerpad_0 (u_int_16 value)
 Sets the Pad_0 Element value.
u_int_32 pad_1 () const
 Gets the Pad_1 Element value.
MROSP_Headerpad_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::AggregatePVL () 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.31 2010/11/25 02:51:13)"
 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.

Detailed Description

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.

Author:
Bradford Castalia, UA/PIRL, 12/03 1.23

Member Enumeration Documentation

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.

See also:
Data_Block
Enumerator:
Protocol_ID 
Transaction 
Transaction_ID 
Data_Amount 
Sync 
Pad_0 
Checksum 
Pad_1 
Total_Elements 

Known transaction type values for the Transaction Element.

Enumerator:
SCIENCE 
ENGINEERING 

Known segmentation values for the Transaction Element.

Enumerator:
NONE 
START 
MIDDLE 
END 

Constructor & Destructor Documentation

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.

Parameters:
streamThe istream from which to read the component data.
MROSP_Header ( const MROSP_Header component,
bool  data_duplicate = true 
)

Copy constructor.

Parameters:
componentThe MROSP_Header to be copied.
data_duplicatetrue if the data content of the copied component is to be duplicated in the copy; false if the data content is to be shared.
See also:
Data_Component(const Data_Component&, bool)

Member Function Documentation

MROSP_Header & operator= ( const MROSP_Header component )

Assigns another MROSP_Header to this one.

Parameters:
componentThe MROSP_Header to be assigned.
See also:
Data_Component::operator=(const Data_Component&)

References Data_Component::operator=().

string id (  ) const [virtual]

Provides the class ID on a line followed by the base Data_Component::id.

Returns:
The multi-line identification string.
See also:
Data_Component::id()

Reimplemented from Data_Component.

References MROSP_Header::ID.

const char * name (  ) const [virtual]

Gets the NAME of this class.

Returns:
A pointer to the constant class name C-string.
See also:
Data_Component::name()

Implements Data_Component.

References MROSP_Header::NAME.

u_int_8 protocol_ID (  ) const

Gets the Protocol_ID Element value.

Returns:
The 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 )

Sets the Protocol_ID Element value.

Parameters:
IDThe Element value.
Returns:
This MROSP_Header.
u_int_8 transaction (  ) const
MROSP_Header & transaction ( u_int_8  value )

Sets the Transaction Element value.

Parameters:
valueThe Element value.
Returns:
This MROSP_Header.
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.

Returns:
The value from the bit field.

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.

Parameters:
typeThe Transaction_Type value to put in the bit field.
Returns:
This MROSP_Header.
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.

Returns:
The value from the bit field.

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.

Parameters:
segmentationThe Transaction_Segmentation value to put in the bit field.
Returns:
This MROSP_Header.
bool transaction_compressed (  ) const

Tests if the compression flag is set in the Transaction Element.

Returns:
true if the bit flag is set; false otherwise.

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.

Parameters:
compressedtrue if the bit flag is to be set; false otherwise.
Returns:
This MROSP_Header.
u_int_16 transaction_ID (  ) const

Gets the Transaction_ID Element value.

Returns:
The 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 )

Sets the Transaction_ID Element value.

Parameters:
IDThe Element value.
Returns:
This MROSP_Header.
u_int_32 data_amount (  ) const

Gets the Data_Amount Element value.

Returns:
The Element value.

References MROSP_Header::Data_Amount, and Data_Component::get().

Referenced by MROSP_Header::PVL().

MROSP_Header & data_amount ( u_int_32  amount )

Sets the Data_Amount Element value.

Parameters:
amountThe Element value.
Returns:
This MROSP_Header.
u_int_32 sync (  ) const

Gets the Sync Element value.

Returns:
The Element value.

References Data_Component::get(), and MROSP_Header::Sync.

Referenced by MROSP_Header::PVL().

MROSP_Header & sync ( u_int_32  sync_pattern )

Sets the Sync Element value.

Parameters:
sync_patternThe Element value.
Returns:
This MROSP_Header.
u_int_16 checksum (  ) const

Gets the Checksum Element value.

Returns:
The 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 )

Sets the Checksum Element value.

Parameters:
valueThe Element value.
Returns:
This MROSP_Header.
u_int_16 pad_0 (  ) const

Gets the Pad_0 Element value.

Returns:
The Element value.

References Data_Component::get(), and MROSP_Header::Pad_0.

MROSP_Header & pad_0 ( u_int_16  value )

Sets the Pad_0 Element value.

Parameters:
valueThe Element value.
Returns:
This MROSP_Header.
u_int_32 pad_1 (  ) const

Gets the Pad_1 Element value.

Returns:
The Element value.

References Data_Component::get(), and MROSP_Header::Pad_1.

MROSP_Header & pad_1 ( u_int_32  value )

Sets the Pad_1 Element value.

Parameters:
valueThe Element value.
Returns:
This MROSP_Header.
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.

Parameters:
streamThe ostream where the listing will be written.
verbosetrue if the listing is to be verbose, otherwise some structural details will be omitted for easier human consumption.
Returns:
The stream that was written.
See also:
Data_Component::print(std::ostream&, bool) const

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]
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.

Returns:
true if the component has valid data; false otherwise.
See also:
Data_Component::internet_checksum() const

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().


Member Data Documentation

const char *const ID = "UA::HiRISE::MROSP_Header (1.31 2010/11/25 02:51:13)" [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]
Initial value:
        {
        "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().

const Index OFFSETS [static]
Initial value:
        {
         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]
Initial value:
        {
        "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]
Initial value:
        {
        "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().

const u_int_32 SYNC = 0xFED4AFEE [static]

Expected Sync Element value.

Referenced by MROSP_Header::is_valid().


The documentation for this class was generated from the following files: