HiRISE
 Observation

Public Member Functions | Static Public Attributes | List of all members
Data_Component Class Referenceabstract

A Data_Component provides a common, virtual interface for all HiRISE Observation data blocks. More...

#include <Data_Component.hh>

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

Public Member Functions

 Data_Component (const char **names=NULL, unsigned int size=0, const Index *offsets=NULL, const Index indexed_arrays[][2]=NULL, Data_Order order=Data_Block::MSB)
 Constructs a Data_Component using component specifications. More...
 
 Data_Component (const Data_Component &component, bool data_duplicate=true)
 Copy constructor. More...
 
Data_Componentoperator= (const Data_Component &component)
 Assignment operator. More...
 
virtual ~Data_Component ()
 Destructor. More...
 
virtual std::string id () const
 Gets the identification of this component. More...
 
virtual const char * name () const =0
 Gets the name of the component. More...
 
const char * name (Index element) const
 Gets the name of a component Element. More...
 
virtual u_int_32 get (Index element, Index index=0) const
 Gets a value from a data Element or array entry of the component. More...
 
virtual Data_Componentput (const u_int_32 value, Index element, Index index=0)
 Puts a value into a data Element or array entry of the component. More...
 
virtual idaeim::PVL::AggregatePVL () const =0
 Produces an exhausitive PVL (Parameter Value Language) rendition of the component contents. More...
 
virtual std::ostream & print (std::ostream &stream=std::cout, bool verbose=false) const =0
 Prints a detailed description of the component structure and contents. More...
 
std::ostream & print_element (const Index element, int format=DECIMAL, std::ostream &stream=std::cout, int width=0) const
 Prints an Element description. More...
 
std::ostream & print_element (const Index element, std::ostream &stream) const
 Prints an Element description. More...
 
std::ostream & print_element_location (const Index element, std::ostream &stream=std::cout) const
 Prints the location of an Element in the component. More...
 
unsigned int element_location_print_width (Index element) const
 Gets the width of the Element location printing fields. More...
 
unsigned int name_field_width () const
 Gets the width of the Element name printing field. More...
 
Data_Componentname_field_width (unsigned int width)
 Sets the width of the Element name field for printing. More...
 
virtual bool is_valid () const =0
 Tests if the component data is valid. More...
 
Data_Blockdata (void *const block)
 Overrides the base Data_Block::data to reset Local_Data. More...
 
Data_Blockattach (void *const block, unsigned int size)
 Attaches a new block of data to the component. More...
 
Data_Componentresize (unsigned int size)
 Resizes the block of local data storage. More...
 
unsigned char * data () const
 Gets a pointer to the current component storage. More...
 
unsigned int local_data ()
 Gets the size of the local data storage area. More...
 
u_int_16 internet_checksum () const
 Calculates the Internet Checksum as per RFC 1071. More...
 
- Public Member Functions inherited from Data_Block
 Data_Block ()
 
 Data_Block (void *const data, const Index *offsets, Index total_elements=0, const Index *array_counts=NULL, bool native_order=true)
 
 Data_Block (void *const data, const Value_List &offsets, const Value_List &array_counts, bool native_order=true)
 
 Data_Block (void *const data, const Value_List &offsets, bool native_order=true)
 
 Data_Block (void *const data, const Index *offsets, Index total_elements, const Index *array_counts, Data_Order data_order)
 
 Data_Block (void *const data, const Value_List &offsets, const Value_List &array_counts, Data_Order data_order)
 
 Data_Block (void *const data, const Index *offsets, Index total_elements, Data_Order data_order)
 
 Data_Block (void *const data, const Index *offsets, Data_Order data_order)
 
 Data_Block (void *const data, const Value_List &offsets, Data_Order data_order)
 
 Data_Block (void *const data, const Index *offsets, const Index indexed_counts[][2], Data_Order data_order)
 
 Data_Block (const Data_Block &data_block)
 
Data_Blockoperator= (const Data_Block &data_block)
 
virtual ~Data_Block ()
 
bool native () const
 
Data_Blocknative (bool native_order)
 
Data_Order data_order () const
 
Data_Blockdata_order (Data_Order order)
 
unsigned char * data () const
 
Index size () const
 
Value_List element_offsets_list () const
 
Indexelement_offsets ()
 
bool element_offsets (const Value_List &offsets)
 
bool element_offsets (const Index *offsets, Index total_elements=NO_INDEX)
 
bool element_sizes (const Value_List &sizes)
 
bool element_sizes (const Index *sizes, Index total_elements=NO_INDEX)
 
Index offset_of (Index element) const
 
bool offset_of (Index element, Index offset)
 
bool insert_element (Index offset, Index size, Index array_count=1)
 
Data_Blockdelete_element (Index element)
 
Data_Blockshift_offsets (int amount)
 
Index elements () const
 
Index size_of (Index element) const
 
bool size_of (Index element, Index size)
 
Index value_size_of (Index element) const
 
Data_Blockvalue_size_of (Index element, Index size)
 
Index index_of (Index offset) const
 
Value_List array_counts_list () const
 
Indexarray_counts ()
 
Data_Blockarray_counts (const Value_List &counts, Index begin=0)
 
Data_Blockarray_counts (const Index *counts, Index begin=0, Index end=NO_INDEX)
 
Data_Blockarray_indexed_counts (const Index indexed_counts[][2], Index total_counts=NO_INDEX)
 
Data_Blockarray_offset_counts (const Index offset_counts[][2], Index total_counts=NO_INDEX)
 
Index count_of (Index element) const
 
Data_Blockcount_of (Index element, Index count)
 
bool reset_counts (bool unconditional=true, Index begin=0, Index end=NO_INDEX)
 
const Data_Blockget (T &value, const Index element, const Index index=0) const
 
const Data_Blockget (T &value, const Index element, const Index index=0) const
 
get (const Index element, const Index index=0) const
 
get (const Index element, const Index index=0) const
 
Data_Blockput (T &value, const Index element, const Index index=0)
 
Data_Blockput (T &value, const Index element, const Index index=0)
 
const Data_Blockget (T *array, const Index element, Index count=0) const
 
const Data_Blockget (T *array, const Index element, Index count=0) const
 
Data_Blockput (T *array, const Index element, Index count=0)
 
Data_Blockput (T *array, const Index element, Index count=0)
 
std::istream & input (std::istream &stream)
 
std::ostream & output (std::ostream &stream) const
 
std::ostream & print (std::ostream &stream=std::cout) const
 

Static Public Attributes

static const char *const ID
 Class identification name with source code version and date. More...
 
static const int DECIMAL = 0
 Format specifier. More...
 
static const int HEX = -1
 
static const int BOOLEAN = -2
 
static const char PATHNAME_DELIMITER = FILESYSTEM_PATHNAME_DELIMITER
 Host filesystem pathname delimiter. More...
 
static const int UTC_SECONDS_PRECISION = SECONDS_PRECISION
 UTC seconds precision (digits after the decimal point). More...
 
static const char SUBSECONDS_DELIMITER = ':'
 Delimits subseconds from seconds in clock count representations. More...
 
static const char *const SPICE_METAKERNEL_VARIABLE
 The name of the environment variable for the SPICE metakernel pathname. More...
 
static const char *const DEFAULT_SPICE_METAKERNEL
 The default SPICE metakernal pathname. More...
 
static const int MRO_CLOCK_ID = MRO_CLOCK_NAIF_ID
 The ID used by NAIF for specifying the MRO clock to CSPICE routines. More...
 
static const char *const INVALID_UTC_TIME = DEFAULT_INVALID_UTC_TIME
 
- Static Public Attributes inherited from Instrument
static const char *const ID
 
static const unsigned int CCDS
 
static const unsigned int CCD_UNKNOWN
 
static const char *const CCD_NAMES []
 
static const char *const CCD_FILTER_NAMES []
 
static const unsigned int CCD_BY_CPMM []
 
static const unsigned int CPMM_BY_CCD []
 
static const char *const WAVELENGTH_UNITS
 
static const unsigned int CCD_CENTER_WAVELENGTHS []
 
static const unsigned int CCD_BANDWIDTHS []
 
static const double CCD_FOCAL_PLANE_X_OFFSETS_MM []
 
static const double CCD_FOCAL_PLANE_Y_OFFSETS_MM []
 
static const double CCD_PIXEL_SIZE_MM
 
static const unsigned int CCD_CHANNELS
 
static const unsigned int CCD_CHANNEL_UNKNOWN
 
static const unsigned int CCD_IMAGE_SENSORS
 
static const unsigned int MAX_BYTES_PER_PIXEL
 
static const unsigned int MAX_PIXEL_VALUES []
 
static const unsigned int MAX_IMAGE_LINES
 
static const unsigned int TOTAL_TDI_STAGES
 
static const unsigned int TDI_STAGES []
 
static const unsigned int TOTAL_BINNING_FACTORS
 
static const unsigned int BINNING_FACTORS []
 
static const unsigned int CCD_BINNED_PIXELS []
 
static const unsigned int STORED_LUTS
 
static const unsigned int STIMULATOR_LEDS
 
static const char *const STIMULATOR_LED_NAMES []
 
static const double EXPOSURE_SETUP_MICROS
 
static const unsigned int DELTA_LINE_TIME_MAX
 
static const double DELTA_LINE_TIME_TICK_NANOS
 
static const double LINE_TIME_PRE_OFFSET
 
static const unsigned int TRIM_ADDITION_LINES
 
static const unsigned int REVERSE_READOUT_LINES
 
static const unsigned int MASKED_LINES
 
static const unsigned int DLL_LOCKED
 
static const unsigned int DLL_NOT_LOCKED
 
static const unsigned int SPACECRAFT_EPOCH
 
static const double MRO_CLOCK_SUBTICK_MICROS
 
static const double HIRISE_CLOCK_SUBTICK_MICROS
 
static const int SPACECRAFT_NAIF_ID
 
static const unsigned int SSR_BYTE_BOUNDARY
 
static const int UNKNOWN_NUMBER
 
static const int NOT_APPLICABLE_NUMBER
 
static const char *const UNKNOWN_STRING
 
static const char *const NOT_APPLICABLE_STRING
 
- Static Public Attributes inherited from Data_Block
static const char *const ID
 
static const Index NO_INDEX
 

Additional Inherited Members

- Public Types inherited from Data_Block
enum  Data_Order
 
enum  Array_Index_Counts
 
enum  Array_Offset_Counts
 
typedef unsigned int Index
 
typedef std::vector< IndexValue_List
 
typedef void(* Copier) (unsigned char *destination, int destination_amount, const unsigned char *source, int source_amount)
 
- Static Public Member Functions inherited from Instrument
static unsigned int calibration_lines_minimum (unsigned int TDI, unsigned int binning)
 
static int focal_plane_x_offset (unsigned int CPMM, unsigned int binning=1)
 
- Static Public Member Functions inherited from Data_Block
static Data_Order native_order ()
 
static Value_Listsizes_to_offsets (Value_List &sizes)
 
static Indexsizes_to_offsets (Index *sizes, Index total_elements=NO_INDEX)
 
static Value_Listoffsets_to_sizes (Value_List &offsets)
 
static Indexoffsets_to_sizes (Index *offsets, Index total_elements=NO_INDEX)
 
- Public Attributes inherited from Data_Block
 MSB
 
 LSB
 
 ELEMENT_INDEX
 
 INDEX_COUNT
 
 ELEMENT_OFFSET
 
 OFFSET_COUNT
 
Copier Get
 
Copier Put
 
- Protected Member Functions inherited from Data_Block
void limits_checker (const Index element, const Index index, bool getter, bool array) const
 
- Static Protected Member Functions inherited from Data_Block
static void get_forwards (unsigned char *host, int host_amount, const unsigned char *data, int data_amount)
 
static void get_backwards (unsigned char *host, int host_amount, const unsigned char *data, int data_amount)
 
static void put_forwards (unsigned char *data, int data_amount, const unsigned char *host, int host_amount)
 
static void put_backwards (unsigned char *data, int data_amount, const unsigned char *host, int host_amount)
 

Detailed Description

A Data_Component provides a common, virtual interface for all HiRISE Observation data blocks.

It also subclasses the Instrument class which contains the HiRISE instrument constants, and the PIRL::Data_Block for host data order independence of the component's data store.

There will be an implmentation of this interface for each specific type of Data_Component that occurs in an Observation or data product.

Author
Bradford Castalia, UA/PIRL

1.38

See also
UA::HiRISE::Instrument
PIRL::Data_Block
Observation

Constructor & Destructor Documentation

◆ Data_Component() [1/2]

Data_Component ( const char **  names = NULL,
unsigned int  size = 0,
const Index offsets = NULL,
const Index  indexed_arrays[][2] = NULL,
Data_Order  order = Data_Block::MSB 
)

Constructs a Data_Component using component specifications.

Memory is allocated (size bytes) for the component's Data_Block, and initialized to 0. However, if size is 0 no memory is allocated; the Data_Block has NULL data. The memory is deleted when the component is destroyed or the data block is substituted by an external data block.

Parameters
namesThe list of Element names in Element order. The names are expected to remain constant, so they are not copied. This list MUST be NULL terminated.
sizeThe size (bytes) of the component's data block.
offsetsThe list of Element offsets in the data block in Element order.
indexed_arraysThe list of array Element entry counts using Element index references. Components with no array Elements will not provide this.
orderThe order of data in data block. All HiRISE components are expected to be MSB ordered.
See also
Data_Block

References Data_Component::data(), and Data_Block::size().

◆ Data_Component() [2/2]

Data_Component ( const Data_Component component,
bool  data_duplicate = true 
)

Copy constructor.

This component is a Data_Block copy which results in taking on all of the structural characteristics of the copied component.

The data content is copied only if data_duplicate is true. If data_duplicate is true, then memory for a copy of the source component data block is allocated, and the contents of the source data block is copied into this new data block. If data_duplicate is false, then the new data block will share the data storage memory of the source data block; the source data block retains ownership of the data storage.

Parameters
componentThe component to be copied.
data_duplicatetrue if the data content of the component is to be duplicated in the copy; false if the source component data is to be shared by this component.

References Data_Component::attach(), Data_Component::data(), and Data_Block::size().

◆ ~Data_Component()

~Data_Component ( )
virtual

Destructor.

If the data block memory for the component has not been substituted by an external data block, it is deleted.

See also
data(void* const)

Member Function Documentation

◆ operator=()

Data_Component & operator= ( const Data_Component component)

Assignment operator.

Memory is allocated for a duplicate of the assigned data block storage. However, if the current data block is being locally managed (it has its own data storage) and at least as large as the assigned data block the current block is simply reused rather than replaced.

Also, a Data_Block assignment of the assigned compoent is applied to this component so it takes on all of the structural characteristics of assigned component.

Parameters
componentThe component being assigned.

References Data_Component::data(), and Data_Block::size().

Referenced by Engineering_Header::operator=(), Gap_Map::operator=(), Image_Line::operator=(), LUT::operator=(), MROSP_Header::operator=(), and Science_Channel_Header::operator=().

◆ id()

string id ( ) const
virtual

Gets the identification of this component.

The identification is the Data_Component class ID, the Instrument class ID and the Data_Block class ID each separated by a new-line. Each subclass of Data_Component is excpected to provided their own id method which provides their own class ID line preceeding this identification.

Returns
An identification string for the component.

Reimplemented in Science_Channel_Header, MROSP_Header, LUT, Image_Line, Gap_Map, and Engineering_Header.

References Instrument::ID, Data_Component::ID, and ID.

Referenced by Engineering_Header::id(), Gap_Map::id(), Image_Line::id(), LUT::id(), MROSP_Header::id(), and Science_Channel_Header::id().

◆ name() [1/2]

virtual const char* name ( ) const
pure virtual

Gets the name of the component.

Each subclass must provide their name method.

Returns
A constant C-string (char*) that is the name of the implementing class.

Implemented in Science_Channel_Header, MROSP_Header, LUT, Image_Line, Gap_Map, and Engineering_Header.

Referenced by Data_Component::print_element_location().

◆ name() [2/2]

const char * name ( Index  element) const

Gets the name of a component Element.

Parameters
elementAn Element Index of the component.
elementThe Element Index.
Returns
A constant C-string (char*) that is the name of the Element.

◆ get()

u_int_32 get ( Index  element,
Index  index = 0 
) const
virtual

◆ put()

Data_Component & put ( const u_int_32  value,
Index  element,
Index  index = 0 
)
virtual

◆ PVL()

virtual idaeim::PVL::Aggregate* PVL ( ) const
pure virtual

Produces an exhausitive PVL (Parameter Value Language) rendition of the component contents.

Each Element has a parameter with its element name. All the paramters are contained in an Aggregate with the name of component.

Returns
A pointer to a PVL::Aggregate.

Implemented in Science_Channel_Header, MROSP_Header, LUT, Image_Line, Gap_Map, and Engineering_Header.

◆ print()

virtual std::ostream& print ( std::ostream &  stream = std::cout,
bool  verbose = false 
) const
pure virtual

Prints a detailed description of the component structure and contents.

The listing is expected to start with a line containing the component's name preceeded by a ">>> " marker. In verbose mode this should be immediately followed by a line containing the component's class ID.

After a blank line, each Element of the component should be listed in Element order. Typically the print_element method is used to provide a single line description of an Element. For complex Elements (e.g. packed bit fields) additional lines describing each part of the element should be provided.

When not in verbose mode, inconsequential component Elements - typically padding - will not be included in the Element listings.

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
print_element

Implemented in Science_Channel_Header, MROSP_Header, LUT, Image_Line, Gap_Map, and Engineering_Header.

◆ print_element() [1/2]

ostream & print_element ( const Index  element,
int  format = DECIMAL,
std::ostream &  stream = std::cout,
int  width = 0 
) const

Prints an Element description.

The description begins with its location listing. Then each Element value is listed, space separated, in the specified format (an array Element has more than one value).

Parameters
elementAn Index of an Element in the component.
formatThe selected format of the output.
streamThe ostream for output.
widthThe width of the representation, as applicable.
Returns
The stream that was written.
See also
print_element_location
print_value

References Data_Block::count_of(), Data_Component::get(), Data_Component::HEX, Data_Component::print_element_location(), UA::HiRISE::print_value(), and Data_Block::value_size_of().

Referenced by Engineering_Header::print(), MROSP_Header::print(), Science_Channel_Header::print(), and Data_Component::print_element().

◆ print_element() [2/2]

std::ostream& print_element ( const Index  element,
std::ostream &  stream 
) const
inline

Prints an Element description.

The Element is printed in DECIMAL format with 0 width.

Parameters
elementAn Index of an Element in the component.
streamThe ostream for output.
Returns
The stream that was written.
See also
print_element(const Index, int, std::ostream&, int)

References Data_Component::DECIMAL, and Data_Component::print_element().

◆ print_element_location()

ostream & print_element_location ( const Index  element,
std::ostream &  stream = std::cout 
) const

Prints the location of an Element in the component.

The format of the location listing is:

Element@Offset:Count*Size Name: 

Element
The Element Index in the component (width 3).
Offset
The byte offset from the begining of the component, at byte 0, where the Element data is located (width 3).
Count
The number of Array entries composing the Element; a non-Array Element has a Count of 1 (width 3).
Size
The size, in bytes, of each Array entry (width 1). Note: there is a single space following this field.
Name
The name of the Element (width name_field_width). Note: there is a colon and space following this field.
All parts of the location listing are right justified in their
space padded fields.

@param  element An Index of an Element in the component.
@param  stream  The ostream where the listing will be written.
@return The stream that was written.

References Data_Block::count_of(), Data_Component::name(), Data_Block::offset_of(), and Data_Block::value_size_of().

Referenced by Data_Component::element_location_print_width(), Image_Line::print(), Science_Channel_Header::print(), and Data_Component::print_element().

◆ element_location_print_width()

unsigned int element_location_print_width ( Index  element) const

Gets the width of the Element location printing fields.

The width of the Element location field should be constant as determined by its fixed format. However, unusually large location data values or a name_field_width specification less than the length of the Element name will result in an actual field width that is longer than expected. This method prints the Element location and name to a string stream to determine its actual listing length.

Parameters
elementAn Index of an Element in the component.
Returns
The width of the location and name printing fields.
See also
print_element_location

References Data_Component::print_element_location().

Referenced by MROSP_Header::print(), and Science_Channel_Header::print().

◆ name_field_width() [1/2]

unsigned int name_field_width ( ) const

Gets the width of the Element name printing field.

Returns
The character width of the Element name print field.
See also
name_field_width(unsigned int)

◆ name_field_width() [2/2]

Data_Component & name_field_width ( unsigned int  width)

Sets the width of the Element name field for printing.

To provide a nicely formatted print listing, a consistent width for the Element name field is maintained as the Name_Field_Width data member of the Data_Component. When the object is constructed the maximum length of all Elements names is determined (and saved as the Max_Name_Length data member) and the Name_Field_Width value is initialzed with the value of Max_Name_Length. When an application is printing multiple Data_Component objects it may reset the Name_Field_Width to some other value; e.g. the maximum of all name_field_width values from each Data_Component.

If the width argument is 0 then the Name_Field_Width will be reset to the Max_Name_Length value.

Parameters
widthThe character width for the Element name print field. If the value is 0 then the width will be reset to the Max_Name_Length value.
Returns
This Data_Component.
See also
print_element

◆ is_valid()

virtual bool is_valid ( ) const
pure virtual

Tests if the component data is valid.

Returns
true if the component has valid data; false otherwise.

Implemented in Science_Channel_Header, MROSP_Header, LUT, Image_Line, Gap_Map, and Engineering_Header.

◆ data() [1/2]

Data_Block & data ( void *const  block)
virtual

Overrides the base Data_Block::data to reset Local_Data.

When a Data_Component is constructed it provides its own local data storage which is managed by the Data_Component. It may be appropriate to substitute an external data storage block that is managed externally.

When a new data block replaces a local block, the local block is deleted and the data storage is marked as being externally managed. If the new data block replaces an external block, the external block is not deleted; the external storage is the responsibility of the external owner.

N.B.: The contents of the previous data block are not copied into the new block.

Warning: It the responsibility of the new data block owner to ensure that it contains sufficient storage to accommodate all Elements of the component, as determined by the Data_Block::size method.

Parameters
blockThe address of the new Data_Block storage.
Returns
The Data_Block.
See also
Data_Block::data(void* const)

Reimplemented from Data_Block.

References Data_Component::data().

Referenced by Observation::components(), Data_Component::Data_Component(), Observation::line(), Line_Cache::Line_Cache(), Line_Cache::next_line(), and Data_Component::operator=().

◆ attach()

Data_Block & attach ( void *const  block,
unsigned int  size 
)

Attaches a new block of data to the component.

The new data block is attached to this Data_Component: ownership of the new data block is passed to this Data_Component; the data block will be deleted when this Data_Component is destroyed.

Warning: The new data block must be dynamically allocated.

When a the new data block replaces a local block at a different address, the local block is deleted. N.B.: The contents of the previous data block are not copied into the new block.

Parameters
blockThe address of the new Data_Block storage.
sizeThe size, in bytes, of the new data block.
Returns
The Data_Block.
Exceptions
length_errorIf the size of the new block is insufficient to accommodate all Elements of the component, as determined by the Data_Block::size() method.
See also
Data_Block::data(void* const)

References Data_Component::data(), Data_Component::ID, and Data_Block::size().

Referenced by Data_Component::Data_Component(), Gap_Map::insert_range(), and Data_Component::resize().

◆ resize()

Data_Component & resize ( unsigned int  size)

Resizes the block of local data storage.

If the component has its own local data or has no no data block and the requested new data block size is greater than the currently allocated amount, then local data block is reallocated at the larger size and the contents of the previous data block are copied into the new data block. N.B.: The size of the local data block is never decreased (use attach instead).

Parameters
sizeThe requested size of the local data block.
Returns
This Data_Component.
See also
local_data()

References Data_Component::attach(), Data_Component::data(), Data_Component::ID, and Data_Block::size().

Referenced by Image_Line::pixel_bytes(), and Image_Line::pixel_count().

◆ data() [2/2]

unsigned char* data ( ) const
inline

◆ local_data()

unsigned int local_data ( )
inline

Gets the size of the local data storage area.

Returns
The size, in bytes, of the local storage area. If the data storage is being externally managed this will be zero.
See also
data(void* const)

◆ internet_checksum()

u_int_16 internet_checksum ( ) const

Calculates the Internet Checksum as per RFC 1071.

In outline, the Internet Checksum algorithm is very simple:

Adjacent octets to be checksummed are paired to form 16-bit integers, and the 1's complement sum of these 16-bit integers is formed.

To generate a checksum, the checksum field itself is cleared, the 16-bit 1's complement sum is computed over the octets concerned, and the 1's complement of this sum is placed in the checksum field.

To check a checksum, the 1's complement sum is computed over the same set of octets, including the checksum field. If the result is all 1 bits (-0 in 1's complement arithmetic), the check succeeds.

Suppose a checksum is to be computed over the sequence of octets A, B, C, D, ... , Y, Z. Using the notation [a,b] for the 16-bit integer a * 256 + b, where a and b are bytes, then the 16-bit 1's complement sum of these bytes is given by one of the following:

    [A,B] +' [C,D] +' ... +' [Y,Z]
    [A,B] +' [C,D] +' ... +' [Z,0]

where +' indicates 1's complement addition. These cases correspond to an even or odd count of bytes, respectively.

On a 2's complement machine, the 1's complement sum must be computed by means of an "end around carry", i.e., any overflows from the most significant bits are added into the least significant bits.

For details see: http://www.faqs.org/rfcs/rfc1071.html

Returns
The checksum of the this Data_Component. If the component contains a valid checksum Element, the result should be 0.

References Data_Block::Get, and Data_Block::size().

Referenced by Science_Channel_Header::is_valid(), main(), MROSP_Header::print(), and Science_Channel_Header::print().

Member Data Documentation

◆ ID

const char *const ID
static
Initial value:
=
"UA::HiRISE::Data_Component (1.51 2020/05/14 22:48:28)"

Class identification name with source code version and date.

Referenced by Data_Component::attach(), Data_Component::id(), main(), Data_Component::resize(), and UA::HiRISE::seconds().

◆ DECIMAL

const int DECIMAL = 0
static

Format specifier.

See also
print_value

Referenced by Data_Component::print_element(), and UA::HiRISE::print_value().

◆ HEX

const int HEX = -1
static

◆ BOOLEAN

const int BOOLEAN = -2
static

◆ PATHNAME_DELIMITER

const char PATHNAME_DELIMITER = FILESYSTEM_PATHNAME_DELIMITER
static

Host filesystem pathname delimiter.

Referenced by UA::HiRISE::filename(), main(), and UA::HiRISE::pathname().

◆ UTC_SECONDS_PRECISION

const int UTC_SECONDS_PRECISION = SECONDS_PRECISION
static

UTC seconds precision (digits after the decimal point).

Referenced by UA::HiRISE::UTC_time().

◆ SUBSECONDS_DELIMITER

const char SUBSECONDS_DELIMITER = ':'
static

Delimits subseconds from seconds in clock count representations.

Referenced by UA::HiRISE::clock_count(), Science_Channel_Header::clock_count(), and UA::HiRISE::seconds().

◆ SPICE_METAKERNEL_VARIABLE

const char *const SPICE_METAKERNEL_VARIABLE
static
Initial value:
=
#define SPICE_METAKERNEL_VARIABLE_NAME
Definition: Data_Component.cc:148

The name of the environment variable for the SPICE metakernel pathname.

A pathname ust be provided to a SPICE metakernel that lists a SCLK kernal for the MRO spacecraft and a leap seconds kernel. The environment variable is tried first before the fallback default.

Referenced by UA::HiRISE::UTC_time().

◆ DEFAULT_SPICE_METAKERNEL

const char *const DEFAULT_SPICE_METAKERNEL
static
Initial value:
=
#define DEFAULT_SPICE_METAKERNEL_PATHNAME
Definition: Data_Component.cc:155

The default SPICE metakernal pathname.

Referenced by UA::HiRISE::UTC_time().

◆ MRO_CLOCK_ID

const int MRO_CLOCK_ID = MRO_CLOCK_NAIF_ID
static

The ID used by NAIF for specifying the MRO clock to CSPICE routines.

Referenced by UA::HiRISE::UTC_time().

◆ INVALID_UTC_TIME

const char *const INVALID_UTC_TIME = DEFAULT_INVALID_UTC_TIME
static

Referenced by UA::HiRISE::UTC_time().


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