HiRISE
 Observation

Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
Gap_Map Class Reference

A Gap_Map contains a map of data gap ranges for the file with which it is associated. More...

#include <Gap_Map.hh>

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

Public Types

enum  End_Point {
  RANGE_START ,
  RANGE_END
}
 Gap range end-point value symbols. More...
 
enum  {
  INSIDE = -1 ,
  OUTSIDE = 0 ,
  OVERLAP = 1
}
 Return values for in_gap(Location, Location) method. More...
 
typedef u_int_32 Location
 A gap range end-point offset location value. More...
 
typedef std::pair< Location, LocationRange
 A gap range end-point pair of offset location values. More...
 
typedef std::vector< RangeList
 A list of gap range pairs. More...
 
- 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)
 

Public Member Functions

 Gap_Map ()
 Constructs an empty Gap_Map. More...
 
 Gap_Map (std::istream &stream, unsigned int count)
 Constructs a Gap_Map loaded from a data stream. More...
 
 Gap_Map (const Gap_Map &map, bool data_duplicate=true)
 Copy constructor. More...
 
Gap_Mapoperator= (const Gap_Map &map)
 Assigns another Gap_Map to this one. More...
 
virtual std::string id () const
 Provides the class ID on a line followed by the base Data_Component::id. More...
 
virtual const char * name () const
 Gets the NAME of this class. More...
 
virtual Location get (Index range, End_Point end_point) const
 Gets a gap range end-point value. More...
 
Gap_Map::Range gap (Index range) const
 Gets a gap Range. More...
 
Gap_Map::List gaps () const
 Gets a List of Range pairs from the map. More...
 
unsigned int total_gaps () const
 Gets the total number of gap segments in the map. More...
 
bool in_gap (const Location location) const
 Tests if a location falls in a gap range. More...
 
int in_gap (const Location start, const Location end) const
 Tests if a [start, end) range overlaps a gap range in the map. More...
 
int in_gap (const Gap_Map::Range &range) const
 Tests if a Range overlaps a gap range in the map. More...
 
Gap_Mapset (const Location start, const Location end)
 Sets a gap range. More...
 
Gap_Mapset (const Gap_Map::Range &range)
 Sets a gap Range. More...
 
Gap_Mapset (const Gap_Map::List list)
 Sets a list of gap ranges. More...
 
Gap_Mapclear (const Location start, const Location end)
 Clears a gap range. More...
 
Gap_Mapclear ()
 Clears the entire map. More...
 
Gap_Mapclear (const Gap_Map::Range &range)
 Clears a gap range. More...
 
Gap_Mapclear (const Gap_Map::List list)
 Clears a list of gap ranges. More...
 
Gap_Mapshift (int_32 amount)
 Shifts all range locations some amount. More...
 
virtual std::ostream & print (std::ostream &stream=std::cout, bool verbose=false) const
 Prints the component structure and contents. More...
 
virtual idaeim::PVL::AggregatePVL () const
 Produces a PVL rendition of the component. More...
 
idaeim::PVL::AggregatePVL_description () const
 Produces a PVL description of a Gap_Map for a PDS label. More...
 
virtual bool is_valid () const
 Tests if the component data is valid. More...
 
- Public Member Functions inherited from Data_Component
 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...
 
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...
 
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...
 
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 Member Functions

static Gap_Map::List gaps_in (void *start, void *end, unsigned int threshold=0)
 Gets a list of gap ranges in a data block. More...
 
static unsigned int sequence_threshold (unsigned int threshold=0)
 Gets the sequence threshold for determining a gap segment range, optionally setting a new threshold. More...
 
static Gap_Map::Rangeshift (Gap_Map::Range &range, int_32 amount)
 Shifts the end points of a Range some amount. More...
 
static Gap_Map::Listshift (Gap_Map::List &list, int_32 amount)
 Shifts a List of Ranges some amount. More...
 
- 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)
 

Static Public Attributes

static const char *const ID
 Class identification name with source code version and date. More...
 
static const char *const NAME = "Gap Map"
 The component name. More...
 
static const char *const END_POINT_NAMES []
 Gap range end-point value names. More...
 
static const unsigned int DEFAULT_SEQUENCE_THRESHOLD = GAP_MAP_DEFAULT_SEQUENCE_THRESHOLD
 The default sequence of gap byte values required for a gap segment. More...
 
static const u_int_8 GAP_BYTE_VALUE = 0xFF
 The value of a "gap filled" data byte. More...
 
- Static Public Attributes inherited from Data_Component
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
 

Protected Member Functions

virtual Data_Componentput (const Location location, Index range, End_Point end_point)
 Puts a the value of an end-point into a gap range. More...
 
Gap_Mapinsert_range (Index range, Location start, Location end)
 Inserts a new range into the map. More...
 
Gap_Mapremove_range (Index first, Index last=(Index) -1)
 Removes ranges from the map. More...
 
- Protected Member Functions inherited from Data_Block
void limits_checker (const Index element, const Index index, bool getter, bool array) const
 

Additional Inherited Members

- Public Attributes inherited from Data_Block
 MSB
 
 LSB
 
 ELEMENT_INDEX
 
 INDEX_COUNT
 
 ELEMENT_OFFSET
 
 OFFSET_COUNT
 
Copier Get
 
Copier Put
 
- 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 Gap_Map contains a map of data gap ranges for the file with which it is associated.

The map is composed of [start, end) Range value pairs where each pair defines the location of a gap segment in the associated file. The ranges are non-overlapping and ordered by increasing location values.

A data gap segment is defined as a contiguous sequence of {gap byte values}. The sequence threshold defines the minimum number of gap byte values that must be identified for a segment to be recognized. N.B.: The Gap_Map is implemented as a Data_Block containing a single array element of end-point values; two per range segment. Note: There is no Gap_Map component in an observation data file; one is generated for EDR product files. The Data_Component interface is provided for consistency with all other observation and EDR file components. Bradford Castalia, UA/PIRL 1.10 Data_Component

Member Typedef Documentation

◆ Location

typedef u_int_32 Location

A gap range end-point offset location value.

◆ Range

typedef std::pair<Location, Location> Range

A gap range end-point pair of offset location values.

◆ List

typedef std::vector<Range> List

A list of gap range pairs.

Member Enumeration Documentation

◆ End_Point

enum End_Point

Gap range end-point value symbols.

Enumerator
RANGE_START 
RANGE_END 

◆ anonymous enum

anonymous enum

Return values for in_gap(Location, Location) method.

Enumerator
INSIDE 
OUTSIDE 
OVERLAP 

Constructor & Destructor Documentation

◆ Gap_Map() [1/3]

Gap_Map ( )

Constructs an empty Gap_Map.

◆ Gap_Map() [2/3]

Gap_Map ( std::istream &  stream,
unsigned int  count 
)

Constructs a Gap_Map loaded from a data stream.

If the specified count of gap ranges can not be read from the stream the count will be adjusted to the nearest number of complete ranges actually read. Any extra bytes read are ignored. No more data is read than required for the range count specified.

Parameters
streamThe istream from which to read the component data.
countThe number of ranges in the map.

References Data_Block::count_of(), Data_Block::input(), Data_Block::size(), and Data_Block::size_of().

◆ Gap_Map() [3/3]

Gap_Map ( const Gap_Map map,
bool  data_duplicate = true 
)

Copy constructor.

Parameters
mapThe Gap_Map 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.

Member Function Documentation

◆ operator=()

Gap_Map & operator= ( const Gap_Map map)

Assigns another Gap_Map to this one.

Parameters
mapThe Gap_Map to be assigned.

References Data_Component::operator=().

◆ id()

std::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 Data_Component::id(), and Gap_Map::ID.

◆ name()

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 Gap_Map::NAME.

Referenced by Observation::gap_map_shift().

◆ get()

Gap_Map::Location get ( Index  range,
End_Point  end_point 
) const
virtual

Gets a gap range end-point value.

Parameters
rangeThe gap range to get.
end_pointEither RANGE_START or RANGE_END.
Returns
The value of the range end-point.
Exceptions
std::out_of_rangeif the range is not in the map.
std::invalid_argumentif an invalid end-point is specified.

References Gap_Map::END_POINT_NAMES, Data_Component::get(), Gap_Map::ID, and Gap_Map::total_gaps().

Referenced by Gap_Map::clear(), Gap_Map::gap(), Gap_Map::in_gap(), Gap_Map::insert_range(), Gap_Map::print(), Gap_Map::PVL(), Gap_Map::set(), and Gap_Map::shift().

◆ gap()

Gap_Map::Range gap ( Index  range) const

Gets a gap Range.

A gap Range has start (inclusive) and end (exclusive) end-point location values as its first and second values, respectively.

Parameters
rangeThe gap range to get.
Returns
A Range pair.
Exceptions
std::out_of_rangeif the range is not in the map.

References Gap_Map::get(), Gap_Map::ID, Gap_Map::RANGE_END, Gap_Map::RANGE_START, and Gap_Map::total_gaps().

Referenced by Gap_Map::gaps().

◆ gaps()

Gap_Map::List gaps ( ) const

Gets a List of Range pairs from the map.

Returns
A Gap_Map::List containing zero or more Range entries. Each entry is a pair of start (inclusive) and end (exclusive) values.

References Gap_Map::gap(), and Gap_Map::total_gaps().

◆ total_gaps()

unsigned int total_gaps ( ) const
inline

◆ in_gap() [1/3]

bool in_gap ( const Location  location) const

Tests if a location falls in a gap range.

Parameters
locationThe location to be tested.
Returns
true if the location falls in a gap range; false otherwise.

References Gap_Map::get(), Gap_Map::RANGE_END, Gap_Map::RANGE_START, and Gap_Map::total_gaps().

Referenced by Observation::components(), and Gap_Map::in_gap().

◆ in_gap() [2/3]

int in_gap ( const Location  start,
const Location  end 
) const

Tests if a [start, end) range overlaps a gap range in the map.

Reverse range locations - in which start > end - may be specified (see the Note for the set method).

Parameters
startThe starting (inclusive) location byte (0-based) of the range.
endThe ending (exclusive) location byte of the range.
Returns
0 (OUTSIDE) if the range does not overlap a range in the map; -1 (INSIDE) if the range is completely within a map range; 1 (OVERLAP) if the range is only partially within a map range. Note that the return value is non-zero (true) if any portion of the range overlaps a map range.

References Gap_Map::get(), Gap_Map::INSIDE, Gap_Map::OUTSIDE, Gap_Map::OVERLAP, Gap_Map::RANGE_END, Gap_Map::RANGE_START, and Gap_Map::total_gaps().

◆ in_gap() [3/3]

int in_gap ( const Gap_Map::Range range) const
inline

Tests if a Range overlaps a gap range in the map.

Parameters
rangeThe Range to be tested.
Returns
0 (OUTSIDE) if the Range does not overlap a range in the map; -1 (INSIDE) if the Range is completely within a map range; 1 (OVERLAP) if the Range is only partially within a map range. Note that the return value is non-zero (true) if any portion of the Range overlaps a map range.
See also
in_gap(const Location, const Location) const

References Gap_Map::in_gap().

◆ set() [1/3]

Gap_Map & set ( const Location  start,
const Location  end 
)

Sets a gap range.

The range may overlap existing ranges in the map. A range that falls totally within an existing map range results in no change to the map. A range that extends beyond existing map ranges results in coalescing overlapped ranges: all overlapped or abutted ranges will become one range - additional ranges are removed - with its start location at the lesser of the map range and specified range start locations and its end location at the greater of the map range and specified range end locations. If the range does not overlap any existing map ranges a new range will be inserted at the appropriate place in the map.

Note: The start and end locations may be specified in descending order - with start > end. The start location will still be inclusive and the end location exclusive. Thus the reverse range [n, m), where n > m, becomes [m+1, n+1). N.B.: Reverse ranges can never include 0 because, since Location values are unsigned, an end location of -1 is interpreted as the largest possible positive value.

Parameters
startThe starting (inclusive) location byte (0-based) of the range.
endThe ending (exclusive) location byte of the range.
Returns
This Gap_Map.

References Gap_Map::get(), Gap_Map::insert_range(), Gap_Map::put(), Gap_Map::RANGE_END, Gap_Map::RANGE_START, Gap_Map::remove_range(), and Gap_Map::total_gaps().

Referenced by Observation::components(), Observation::line(), and Gap_Map::set().

◆ set() [2/3]

Gap_Map& set ( const Gap_Map::Range range)
inline

Sets a gap Range.

Parameters
rangeThe Range to be set.
Returns
This Gap_Map.
See also
set(const Location, const Location)

References Gap_Map::set().

◆ set() [3/3]

Gap_Map & set ( const Gap_Map::List  list)

Sets a list of gap ranges.

Parameters
listThe list of gap ranges to be set.
Returns
This Gap_Map.
See also
set(const Location, const Location)

References Gap_Map::set().

◆ clear() [1/4]

Gap_Map & clear ( const Location  start,
const Location  end 
)

Clears a gap range.

Reverse range locations - in which start > end - may be specified (see the Note for the set method).

The range may overlap existing map ranges. Completely overlapped ranges are removed. Ranges partially overlapped at the start or end have their start or end moved to the end or start of the specified range. A range that falls totally within an existing map range results in the range end being set to the specified range start and a new range inserted in the map with its start at the specified range end and its end at the map range end. A range that does not overlap any existing map ranges results in no change to the map.

Parameters
startThe starting (inclusive) location byte (0-based) of the range.
endThe ending (exclusive) location byte of the range.
Returns
This Gap_Map.

References Gap_Map::get(), Gap_Map::insert_range(), Gap_Map::put(), Gap_Map::RANGE_END, Gap_Map::RANGE_START, Gap_Map::remove_range(), and Gap_Map::total_gaps().

Referenced by Observation::components().

◆ clear() [2/4]

Gap_Map& clear ( )
inline

Clears the entire map.

Returns
This Gap_Map.

Referenced by Gap_Map::clear().

◆ clear() [3/4]

Gap_Map& clear ( const Gap_Map::Range range)
inline

Clears a gap range.

Parameters
rangeThe Range to be cleared.
Returns
This Gap_Map.
See also
clear(const Location, const Location)

References Gap_Map::clear().

◆ clear() [4/4]

Gap_Map & clear ( const Gap_Map::List  list)

Clears a list of gap ranges.

Parameters
listThe list of gap ranges to be cleared.
Returns
This Gap_Map.
See also
clear(const Location, const Location)

References Gap_Map::clear().

◆ shift() [1/3]

Gap_Map & shift ( int_32  amount)

Shifts all range locations some amount.

A negative shift that would move a range start location below 0 results in the range start being clipped to 0. If the shift would move a range end location at or below 0 the range is removed from the map.

Parameters
amountThe amount of the shift (positive or negative).
Returns
This Gap_Map.

References Gap_Map::get(), Gap_Map::put(), Gap_Map::RANGE_END, Gap_Map::RANGE_START, Gap_Map::remove_range(), and Gap_Map::total_gaps().

Referenced by Observation::components(), Observation::line(), and Gap_Map::shift().

◆ put()

Data_Component & put ( const Location  location,
Index  range,
End_Point  end_point 
)
protectedvirtual

Puts a the value of an end-point into a gap range.

The gap range is reset to the new range.

Parameters
locationThe end-point location.
rangeThe gap range to modify.
end_pointEither RANGE_START or RANGE_END.
Returns
This Data_Component.
Exceptions
std::out_of_rangeif the range is not in the map.
std::invalid_argumentif an invalid end-point is specified.

References Gap_Map::END_POINT_NAMES, Gap_Map::ID, and Gap_Map::total_gaps().

Referenced by Gap_Map::clear(), Gap_Map::insert_range(), Gap_Map::set(), and Gap_Map::shift().

◆ insert_range()

Gap_Map & insert_range ( Index  range,
Location  start,
Location  end 
)
protected

Inserts a new range into the map.

The range may not overlap any existing map ranges. The new range will be inserted before the specified range.

Parameters
rangeThe Index where the new range is to be inserted in the gap map.
startThe starting (inclusive) location byte (0-based) of the range.
endThe ending (exclusive) location byte of the range.
Returns
This Gap_Map.
Exceptions
range_errorIf the range number is greater than the current number of map ranges, the start of the range is greater than or equal to the end of the preceeding map range (if there is one), or the end of the range is greater than or equal to the start of the following map range.

References Data_Component::attach(), Data_Block::count_of(), Data_Component::data(), Gap_Map::get(), Gap_Map::ID, Gap_Map::put(), Gap_Map::RANGE_END, Gap_Map::RANGE_START, Data_Block::size(), Data_Block::size_of(), and Gap_Map::total_gaps().

Referenced by Gap_Map::clear(), and Gap_Map::set().

◆ remove_range()

Gap_Map & remove_range ( Index  first,
Index  last = (Index)-1 
)
protected

Removes ranges from the map.

All ranges from first to last (inclusive) are removed from the map. If only one range is specified it will be the only one removed. Ranges not in the map are silently ignored.

Parameters
firstThe number (0-based) of the first range to be removed.
lastThe number of the last range to be removed. This argument is optional.
Returns
This Gap_Map.

References Data_Block::count_of(), Data_Component::data(), Data_Block::size_of(), and Gap_Map::total_gaps().

Referenced by Gap_Map::clear(), Gap_Map::set(), and Gap_Map::shift().

◆ print()

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

Prints the component structure and contents.

Each range of the map is printed on a separate line. Each range description line has the format:

Element@Offset:Count*Size : Start End

where:

Element
The range element number in the map (width 3).
Offset
The byte offset from the begining of the map, at byte 0, where the Element data is located (width 3).
Count
The number of values composing the Element; this should always be 2 (width 3).
Size
The size, in bytes, of each location value; this should always be 4 (width 1). Note: there is a space, a colon, and another space following this field.
Start
The starting location of the range (width 10). Note: there is a single space following this field.
End
The ending location of the range (width 10).
All parts of the listing are right justified in their space padded
fields. Values that are longer than the available field width will
result in a larger field to accommodate the entire value.

@param  stream  The ostream where the listing will be written.
@param  verbose true if the class name and ID are to be included
    in the listing.
@return The stream that was written.

Implements Data_Component.

References Gap_Map::get(), Gap_Map::ID, Gap_Map::NAME, Data_Block::offset_of(), Gap_Map::RANGE_END, Gap_Map::RANGE_START, Gap_Map::total_gaps(), and Data_Block::value_size_of().

Referenced by list_selections(), and main().

◆ PVL()

Aggregate * PVL ( ) const
virtual

Produces a PVL rendition of the component.

The map is described as an Array of (start, end) Integer pairs.

Returns
A pointer to a PVL::Aggregate. This Aggregate contains a single Array Assignment Parameter having the Gap_Map NAME .

Implements Data_Component.

References Aggregate::add(), Array::add(), Vectal< T >::clear(), Gap_Map::get(), Gap_Map::NAME, Gap_Map::RANGE_END, Gap_Map::RANGE_START, and Gap_Map::total_gaps().

Referenced by list_selections(), and main().

◆ PVL_description()

Aggregate * PVL_description ( ) const

Produces a PVL description of a Gap_Map for a PDS label.

The description is an OBJECT that contains the PDS parameters required to describe a data product binary data object.

Returns
A pointer to a PVL::Aggregate. The object pointed to is a copy of an internal static object.

References Parser::get_parameters(), Gap_Map::ID, UA::HiRISE::PVL_value(), and Gap_Map::total_gaps().

Referenced by Observation::PVL_PDS().

◆ is_valid()

bool is_valid ( ) const
virtual

Tests if the component data is valid.

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

Implements Data_Component.

◆ gaps_in()

Gap_Map::List gaps_in ( void *  start,
void *  end,
unsigned int  threshold = 0 
)
static

Gets a list of gap ranges in a data block.

The data block is scanned for data bytes with a value of GAP_BYTE_VALUE. The number of such contigous bytes must reach a threshold for a gap segment to be identified.

Parameters
startThe address where the data block starts (inclusive).
endThe address where the data block ends (exclusive).
thresholdThe gap sequence threshold to use. If not specified (or zero) the sequence threshold is used.
Returns
A Gap_Map::List containing the gap ranges found. This list may be empty.

References Gap_Map::GAP_BYTE_VALUE.

Referenced by Observation::components(), and Observation::line().

◆ sequence_threshold()

unsigned int sequence_threshold ( unsigned int  threshold = 0)
static

Gets the sequence threshold for determining a gap segment range, optionally setting a new threshold.

The sequence threshold is the minimum number of contiguous data bytes with a value of GAP_BYTE_VALUE that are required to identify a gap segment. The value is intialized to the DEFAULT_SEQUENCE_THRESHOLD value.

Parameters
thresholdThe new sequence threshold amount. If not provided (or zero) a new value will not be set.
Returns
The sequence threshold value before any new value is set.
See also
gaps_in(void*, void*, unsigned int)

Referenced by Observation::components().

◆ shift() [2/3]

Gap_Map::Range & shift ( Gap_Map::Range range,
int_32  amount 
)
static

Shifts the end points of a Range some amount.

If the shift would move the range end location at or below 0 the range becomes empty in the sense that both its lower and upper bounds are zero.

Parameters
rangeThe Range to have its end points shifted.
amountThe amount of the shift (positive or negative).
Returns
The range.
See also
shift(int_32)

◆ shift() [3/3]

Gap_Map::List & shift ( Gap_Map::List list,
int_32  amount 
)
static

Shifts a List of Ranges some amount.

Parameters
listThe List containing the ranges to be shifted.
amountThe amount of the shift (positive or negative).
Returns
The list.
See also
shift(Gap_Map::Range&, int_32)

References Gap_Map::shift().

Member Data Documentation

◆ ID

const char *const ID
static
Initial value:
=
"UA::HiRISE::Gap_Map (1.14 2020/02/14 01:17:18)"

Class identification name with source code version and date.

Referenced by Gap_Map::gap(), Gap_Map::get(), Gap_Map::id(), Gap_Map::insert_range(), Gap_Map::print(), Gap_Map::put(), and Gap_Map::PVL_description().

◆ NAME

const char *const NAME = "Gap Map"
static

The component name.

Referenced by Gap_Map::name(), Gap_Map::print(), and Gap_Map::PVL().

◆ END_POINT_NAMES

const char *const END_POINT_NAMES
static
Initial value:
=
{
"start",
"end"
}

Gap range end-point value names.

Referenced by Gap_Map::get(), and Gap_Map::put().

◆ DEFAULT_SEQUENCE_THRESHOLD

const unsigned int DEFAULT_SEQUENCE_THRESHOLD = GAP_MAP_DEFAULT_SEQUENCE_THRESHOLD
static

The default sequence of gap byte values required for a gap segment.

See also
sequence_threshold(unsigned int)

◆ GAP_BYTE_VALUE

const u_int_8 GAP_BYTE_VALUE = 0xFF
static

The value of a "gap filled" data byte.

Referenced by Observation::components(), and Gap_Map::gaps_in().


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