HiRISE
 libHiRISE

Public Member Functions | Static Public Attributes

Channel_ID Class Reference

Channel_ID encapsulates the HiRISE channel identification code. More...

#include <Channel_ID.hh>

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

List of all members.

Public Member Functions

 Channel_ID (const u_int_32 observation_id_value=DEFAULT_OBSERVATION_ID, const unsigned int cpmm_value=DEFAULT_CPMM_NUMBER, const unsigned int channel_value=DEFAULT_CHANNEL_NUMBER)
 Creates a Channel_ID from a numeric representation of its Observation_ID, its CPMM number, and its channel number.
 Channel_ID (const Mission_Phase mission_phase_value, const int time_value=-1, const unsigned int cpmm_value=DEFAULT_CPMM_NUMBER, const unsigned int channel_value=DEFAULT_CHANNEL_NUMBER)
 Creates a pre-orbit Channel_ID from a pre-orbit mission phase, an integer value for the pre-orbit time component, a CPMM number, and a channel number.
 Channel_ID (const Mission_Phase mission_phase_value, const unsigned int orbit_number_value, const unsigned int target_value, const unsigned int cpmm_value=DEFAULT_CPMM_NUMBER, const unsigned int channel_value=DEFAULT_CHANNEL_NUMBER)
 Creates an in-orbit Channel_ID from an in-orbit mission phase, an orbit number value, a targe component value, a CPMM number, and a channel number.
 Channel_ID (const std::string &id_text)
 Creates a Channel_ID from a string.
unsigned int channel_number () const
 Returns the channel number for this Channel_ID number.
Channel_IDchannel_number (const unsigned int channel_value) throw (Out_of_Range)
 Sets the channel number for this Channel_ID object.
Channel_IDchannel_number (const std::string &channel_text) throw (Invalid_Argument, Out_of_Range)
 Sets the channel number for this Channel_ID object based on a text string.
std::string channel_name () const
 Returns the text version of the channel number of this Channel_ID object.
Channel_IDchannel_name (const std::string &channel_text) throw (Invalid_Argument, Out_of_Range)
 Sets the channel number for this Channel_ID object based on a text string.
std::string text () const
 Returns the text representation of this Channel_ID.
Channel_IDtext (const std::string &id_text) throw (Invalid_Argument, Out_of_Range)
 Sets the object value from a text representation.
std::string parse (const std::string &id_text)
 Parses a string to obtain a value for the channel number.
std::ostream & print (std::ostream &stream=std::cout) const
 Prints the Channel_ID's text representation to an output stream.

Static Public Attributes

static const char * ID = "UA::HiRISE::Channel_ID (2.4 2010/11/25 00:01:59)"
 Class identification name with source code version and date.
static const unsigned int DEFAULT_CHANNEL_NUMBER = 0
 Default channel number.

Detailed Description

Channel_ID encapsulates the HiRISE channel identification code.

Each HiRISE CCD has two data channels. During image readout from the CCD into solid-state storage, each channel is read out separately.

Formally, a channel ID consists of a CCD ID followed by an underscore mark ("_") and a single digit, 0 or 1, identifying the particular channel of the CCD identified by the CCD ID.

Author:
Christian Schaller, UA/PIRL
Version:
2.2
See also:
Observation_ID
CCD_ID
Instrument

Constructor & Destructor Documentation

Channel_ID ( const u_int_32  observation_id_value = DEFAULT_OBSERVATION_ID,
const unsigned int  cpmm_value = DEFAULT_CPMM_NUMBER,
const unsigned int  channel_value = DEFAULT_CHANNEL_NUMBER 
)

Creates a Channel_ID from a numeric representation of its Observation_ID, its CPMM number, and its channel number.

This constructor is guaranteed not to throw an exception. If cpmm_value is not less than Instrument::CCDS, or if it is not equal to Instrument::CCD_UNKNOWN, then CCD_ID::DEFAULT_CPMM_NUMBER will be used instead.

Likewise, if channel_value is not less than Instrument::CCD_CHANNELS, or if it is not equal to Instrument::CCD_CHANNEL_UNKNOWN, then Channel_ID::DEFAULT_CHANNEL_NUMBER will be used.

Parameters:
observation_id_valueThe initial numeric value of the Observation_ID. Default: Observation_ID::DEFAULT_OBSERVATION_ID.
cpmm_valueThe initial value for the CPMM number. Default: CCD_ID::DEFAULT_CPMM_NUMBER.
channel_valueThe initial value for the channel number. Default: Channel_ID::DEFAULT_CHANNEL_NUMBER.
Channel_ID ( const Mission_Phase  mission_phase_value,
const int  time_value = -1,
const unsigned int  cpmm_value = DEFAULT_CPMM_NUMBER,
const unsigned int  channel_value = DEFAULT_CHANNEL_NUMBER 
)

Creates a pre-orbit Channel_ID from a pre-orbit mission phase, an integer value for the pre-orbit time component, a CPMM number, and a channel number.

This constructor is guaranteed not to throw an exception. If mission_phase_value is not a pre-orbit mission phase, then Observation_ID::DEFAULT_PREORBIT_PHASE will be used. If time_value is greater than Observation_ID::TIME_MAX, Observation_ID::DEFAULT_TIME will be used. If time_value is negative, however, then the current system clock time will be used to set the pre-orbit time component. If cpmm_value is not less than Instrument::CCDS, or if it is not equal to Instrument::CCD_UNKNOWN, then CCD_ID::DEFAULT_CPMM_NUMBER will be used instead.

Finally, if channel_value is not less than Instrument::CCD_CHANNELS, or if it is not equal to Instrument::CCD_CHANNEL_UNKNOWN, then Channel_ID::DEFAULT_CHANNEL_NUMBER will be used.

Parameters:
mission_phase_valueThe pre-orbit mission phase.
time_valueThe value for the pre-orbit time component. If it is negative, the current system clock time will be used instead. Default: -1.
cpmm_valueThe initial value for the CPMM number. Default: CCD_ID::DEFAULT_CPMM_NUMBER.
channel_valueThe initial value for the channel number. Default: Channel_ID::DEFAULT_CHANNEL_NUMBER.
Channel_ID ( const Mission_Phase  mission_phase_value,
const unsigned int  orbit_number_value,
const unsigned int  target_value,
const unsigned int  cpmm_value = DEFAULT_CPMM_NUMBER,
const unsigned int  channel_value = DEFAULT_CHANNEL_NUMBER 
)

Creates an in-orbit Channel_ID from an in-orbit mission phase, an orbit number value, a targe component value, a CPMM number, and a channel number.

This constructor is guaranteed not to throw an exception. If mission_phase_value is not an in-orbit mission phase, then Observation_ID::DEFAULT_INORBIT_PHASE will be used. If orbit_number_value is greater than Observation_ID::ORBIT_NUMBER_MAX, then Observation_ID::DEFAULT_ORBIT_NUMBER will be used. If target_value is greater than Observation_ID::TARGET_MAX, then Observation_ID::DEFAULT_TARGET will be used. If cpmm_value is not less than Instrument::CCDS, or if it is not equal to Instrument::CCD_UNKNOWN, then CCD_ID::DEFAULT_CPMM_NUMBER will be used instead.

Finally, if channel_value is not less than Instrument::CCD_CHANNELS, or if it is not equal to Instrument::CCD_CHANNEL_UNKNOWN, then Channel_ID::DEFAULT_CHANNEL_NUMBER will be used.

Parameters:
mission_phase_valueThe in-orbit mission phase.
orbit_number_valueThe value for the orbit number component.
target_valueThe value for the target component.
cpmm_valueThe initial value for the CPMM number. Default: CCD_ID::DEFAULT_CPMM_NUMBER.
channel_valueThe initial value for the channel number. Default: Channel_ID::DEFAULT_CHANNEL_NUMBER.
Channel_ID ( const std::string &  id_text ) [explicit]

Creates a Channel_ID from a string.

If a valid CPMM number cannot be parsed from the string, then Instrument::CCD_UNKNOWN will be used. If a valid channel number cannot be parsed from the string, then Instrument::CCD_CHANNEL_UNKNOWN will be used. If a valid observation ID component cannot be parsed from the string, Observation_ID::INVALID_OBSERVATION_ID will be used.

Parameters:
id_textA string that contains a text representation of the Channel_ID.
See also:
text(const std::string)

References Instrument::CCD_CHANNEL_UNKNOWN, and Instrument::CCD_UNKNOWN.


Member Function Documentation

unsigned int channel_number (  ) const [inline]

Returns the channel number for this Channel_ID number.

A value of Instrument::CCD_CHANNEL_UNKNOWN indiciates the channel number is not know for this Channel_ID.

Returns:
The channel number for this Channel_ID.
Channel_ID & channel_number ( const unsigned int  channel_value ) throw (Out_of_Range)

Sets the channel number for this Channel_ID object.

If channel_value is greater than or equal to Instrument::CCD_CHANNELS, the channel number will be set to Channel_ID::DEFAULT_CHANNEL_NUMBER and an Out_of_Range exception will be thrown, unless it is set to Instrument::CCD_CHANNEL_UNKNOWN, which indicates that channel number is not known.

Parameters:
channel_valueThe value for the channel number for this Channel_ID object.
Returns:
A reference back to this Channel_ID.
Exceptions:
Out_of_RangeIf channel_value is greater than or equal to Instrument::CCD_CHANNELS. The channel number will be set to Channel_ID::DEFAULT_CHANNEL_NUMBER in this case.

References Instrument::CCD_CHANNEL_UNKNOWN, Instrument::CCD_CHANNELS, and ID.

Channel_ID & channel_number ( const std::string &  channel_text ) throw (Invalid_Argument, Out_of_Range)

Sets the channel number for this Channel_ID object based on a text string.

If a channel number cannot be derived from the string, the channel number will be set to Instrument::CCD_CHANNEL_UNKNOWN and an Invalid_Argument exception will be thrown. If a value greater than or equal to Instrument::CCD_CHANNELS is derived, the channel number will be set to Channel_ID::DEFAULT_CHANNEL_NUMBER and an Out_of_Range exception will be thrown.

Parameters:
channel_textThe text representation of the channel number.
Returns:
A reference back to this Channel_ID.
Exceptions:
Invalid_ArgumentIf channel_text cannot be parsed for a valid channel number. The channel number will be set to Instrument::CCD_CHANNEL_UNKNOWN in this case.
Out_of_RangeIf channel_text indicates a value greater than or equal to Instrument::CCD_CHANNELS. The channel number will be set to Channel_ID::DEFAULT_CHANNEL_NUMBER in this case.

References Instrument::CCD_CHANNEL_UNKNOWN, Instrument::CCD_CHANNELS, and ID.

std::string channel_name (  ) const

Returns the text version of the channel number of this Channel_ID object.

If the channel number is unknown, (Instrument::CCD_CHANNEL_UNKNOWN), then Instrument::CCD_CHANNEL_UNKNOWN is returned instead, as a string.

Returns:
The channel text for this Channel_ID or Channel_ID::UNKNOWN_CHANNEL_TEXT.

References Instrument::CCD_CHANNEL_UNKNOWN.

Referenced by Channel_ID::text().

Channel_ID & channel_name ( const std::string &  channel_text ) throw (Invalid_Argument, Out_of_Range)

Sets the channel number for this Channel_ID object based on a text string.

This method simply calls channel_number(const std::string&).

Parameters:
channel_textThe text representation of the channel number.
Returns:
A reference back to this Channel_ID.
Exceptions:
Invalid_ArgumentIf channel_text cannot be parsed for a valid channel number. The channel number will be set to Instrument::CCD_CHANNEL_UNKNOWN in this case.
Out_of_RangeIf channel_text indicates a value greater than or equal to Instrument::CCD_CHANNELS. The channel number will be set to Channel_ID::DEFAULT_CHANNEL_NUMBER in this case.
See also:
channel_number(const std::string&)
std::string text (  ) const

Returns the text representation of this Channel_ID.

The text representation consists of the text representation of its CCD_ID followed by the channel text that corresponds to its channel number. If the channel number is unknown (Instrument::CCD_CHANNEL_UNKNOWN), then Instrument::CCD_CHANNEL_UNKNOWN replaces the channel text in the text representation. Regardless, the name and the CCD_ID are separated by an underscore ("_") delimiter.

Returns:
The text representation of this Channel_ID.

Reimplemented from CCD_ID.

References Channel_ID::channel_name(), and Observation_ID::TEXT_DELIMITER.

Channel_ID & text ( const std::string &  id_text ) throw (Invalid_Argument, Out_of_Range)

Sets the object value from a text representation.

Parameters:
id_textThe text to be parsed to obtain the value.
Returns:
This object.
See also:
parse(const std::string&)

Reimplemented from CCD_ID.

std::string parse ( const std::string &  id_text )

Parses a string to obtain a value for the channel number.

Parameters:
id_textThe text to be parsed.
Returns:
This text used to set the value. This will be empty if no valid text was found.
See also:
channel_number() const

Reimplemented from CCD_ID.

References Instrument::CCD_CHANNEL_UNKNOWN, and CCD_ID::parse().

std::ostream & print ( std::ostream &  stream = std::cout ) const

Prints the Channel_ID's text representation to an output stream.

Parameters:
streamThe output stream. Default: std::cout.
Returns:
A reference back to the output stream.

Reimplemented from CCD_ID.


Member Data Documentation

const char * ID = "UA::HiRISE::Channel_ID (2.4 2010/11/25 00:01:59)" [static]

Class identification name with source code version and date.

Reimplemented from CCD_ID.

const unsigned int DEFAULT_CHANNEL_NUMBER = 0 [static]

Default channel number.


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