PDS_JP2
|
PDS_Data contains PDS label PVL parameters. More...
#include <PDS_Data.hh>
Public Types | |
enum | Parameter_Class_Selection { AGGREGATE_PARAMETER = -1, ANY_PARAMETER = 0, ASSIGNMENT_PARAMETER = 1 } |
Selects the class of parameter to find. More... | |
typedef std::vector < PDS_Data_Block * > | PDS_Data_Block_List |
A vector of PDS_Data_Block object pointers. | |
Public Member Functions | |
PDS_Data () | |
Construct PDS_Data with no parameters. | |
PDS_Data (const idaeim::PVL::Aggregate ¶meters) | |
Construct PDS_Data from a PVL Parameter Aggregate. | |
PDS_Data (const idaeim::PVL::Aggregate ¶meters, const std::string &detached) | |
Construct PDS_Data from a PVL Parameter Aggregate. | |
PDS_Data (const std::string &pathname) | |
Construct PDS_Data from a named file. | |
PDS_Data_Block_List * | data_blocks (const char **excluded=NULL, const char **image_block_names=NULL) |
Get a list of all binary data blocks in the PDS data. | |
idaeim::PVL::Parameter * | find_parameter (const std::string &pathname, bool case_sensitive=false, int skip=0, Parameter_Class_Selection parameter_class=ANY_PARAMETER) const |
Find a named Parameter. | |
virtual PDS_Data & | parameters (const std::string &pathname) |
Set the parameters from a source file. | |
virtual PDS_Data & | parameters (const idaeim::PVL::Aggregate ¶meters) |
Set the parameters from a Parameter Aggregate. | |
idaeim::PVL::Parameter * | remove_parameter (const std::string &pathname, bool case_sensitive=false, int skip=0, Parameter_Class_Selection parameter_class=ANY_PARAMETER) |
Removes a named Parameter. | |
template<typename T > | |
bool | parameter_value (const std::string &pathname, T &value, bool case_sensitive=false, int skip=0) |
Set the value of a named parameter. | |
double | numeric_value (const std::string &pathname, bool case_sensitive=false, int skip=0) const |
Get the numeric value of a named parameter. | |
std::string | string_value (const std::string &pathname, bool case_sensitive=false, int skip=0) const |
Get the string value of a named parameter. | |
Static Public Member Functions | |
static Image_Data_Block * | image_data (PDS_Data_Block_List *data_block_list) |
Get the Image_Data_Block from a PDS_Data::PDS_Data_Block_List. | |
Static Public Attributes | |
static const char *const | ID = "UA::HiRISE::PDS_Data (1.27 2013/03/14 21:00:43)" |
Class identification name with source code version and date. | |
static const char * | PDS_ID_PARAMETER_NAME = "PDS_VERSION_ID" |
Name of the parameter providing the PDS ID. | |
static const char * | RECORD_TYPE_PARAMETER_NAME = "RECORD_TYPE" |
Name of the parameter specifying the type of label records. | |
static const char * | BYTE_RECORD_TYPE = "UNDEFINED" |
The record type used to define byte count based records. | |
static const char * | FIXED_LENGTH_RECORD_TYPE = "FIXED_LENGTH" |
The record type used to define fixed length records. | |
static const char * | LABEL_RECORDS_PARAMETER_NAME = "LABEL_RECORDS" |
Name of the parameter specifying the number of records in the label. | |
static const char * | RECORD_BYTES_PARAMETER_NAME = "RECORD_BYTES" |
Name of the parameter specifying the number of bytes per record. | |
static const char * | FILE_RECORDS_PARAMETER_NAME = "FILE_RECORDS" |
Name of the parameter specifying the number of records in the file. | |
static const char * | INTERCHANGE_FORMAT_PARAMETER_NAME = "INTERCHANGE_FORMAT" |
Name of the parameter indicating the data format. | |
static const char * | IMAGE_DATA_BLOCK_NAME = "IMAGE" |
Name of the Image_Data_Block parameter group. | |
static const char * | BYTES_UNITS = "BYTES" |
Units name for storage measured in bytes. | |
static const char | RECORD_POINTER_PARAMETER_MARKER = '^' |
Record pointer parameter prefix. |
PDS_Data contains PDS label PVL parameters.
Common PDS label description constants and methods to locate and modify the label parameters to assist in label conversion operations are provided.
typedef std::vector<PDS_Data_Block*> PDS_Data_Block_List |
A vector of PDS_Data_Block object pointers.
PDS_Data | ( | const idaeim::PVL::Aggregate & | parameters ) |
Construct PDS_Data from a PVL Parameter Aggregate.
parameters | A Parameter Aggregate that provides the PDS data parameters. |
References Parameter::name().
PDS_Data | ( | const idaeim::PVL::Aggregate & | parameters, |
const std::string & | detached | ||
) |
Construct PDS_Data from a PVL Parameter Aggregate.
parameters | A Parameter Aggregate that provides the PDS data parameters. |
References Parameter::name().
PDS_Data | ( | const std::string & | pathname ) | [explicit] |
Construct PDS_Data from a named file.
pathname | The pathname to the source file that will be parsed for PVL parameters. |
PDS_Data::PDS_Data_Block_List * data_blocks | ( | const char ** | excluded = NULL , |
const char ** | image_block_names = NULL |
||
) |
Get a list of all binary data blocks in the PDS data.
A binary data block is located by a data block record pointer parameter. A record pointer parameter has a name that begins with the RECORD_POINTER_PARAMETER_MARKER character. If a parameter Aggregate with the same name, but without the record pointer marker, is found it is used to construct a new PDS_Data_Block object that is added to the list of data blocks. N.B.: Each PDS_Data_Block contains a copy of the data block description parameters.
The value of a record pointer parameter is the location of the data block in the file in terms of records. The size of a record is assumed to be one byte unless a parameter with the RECORD_BYTES_PARAMETER_NAME is found in which case its value is the size of a record. The location of the data block in the file as a byte offset, which is used when constructing the PDS_Data_Block to add to the PDS_Data_Block_List, is the record pointer value times the record size.
N.B.: Only top level parameters are searched.
excluded | A NULL terminated array of data block names (character strings) that are to be excluded from the list of data blocks that are assembled. N.B.: The data block names do not include the RECORD_POINTER_PARAMETER_MARKER. |
image_block_names | A NULL terminated array of data block names (character strings) that, if found, are to be treated as Image_Data_Block parameter groups. The IMAGE_DATA_BLOCK_NAME parameter group is always treated as an Image_Data_Block. |
References UA::HiRISE::find_parameter(), Parameter::is_Aggregate(), Value::type_name(), Aggregate::value(), and Parameter::value().
Referenced by PDS_Converter::image_data(), and PDS_Converter::PDS_Converter().
Parameter * find_parameter | ( | const std::string & | pathname, |
bool | case_sensitive = false , |
||
int | skip = 0 , |
||
Parameter_Class_Selection | parameter_class = ANY_PARAMETER |
||
) | const |
Find a named Parameter.
The Parameter to be found may be specified by a simple name, a relative pathname or an absolute pathname. A simple name is the name of a Parameter itself. A relative pathname is a simple name preceeded by the pathname of an Aggregate Parameter that must contain the Parameter with the simple name. An absolute pathname is a pathname that begins with a pathname delimiter ('/'); i.e. it is a fully qualified pathname beginning at the root of the Aggregate hierarchy, compared to a relative pathname that may begin at any Aggregate in the hierarchy.
Since it is not necessary that the pathname to each Parameter be unique, the number of matching pathnames to skip before selecting a Parameter may need to be specified to get the desired Parameter. Also, a specific type of Parameter - an Aggregate of Parameters or an Assignment of Values - may be specified. When skipping parameters, only the specified type, if any, are counted.
pathname | The pathname of the parameter to find. |
case_sensitive | If true, the name search is case sensitive; case insensitive otherwise. |
skip | The number of parameters that match the name to skip before selecting a matching parameter. |
parameter_class | A Parameter_Class_Selection: If AGGREGATE_PARAMETER, only Aggregate parameters will be selected; if ASSIGNMENT_PARAMETER, only Assignment parameters will be selected; otherwise any type of parameter (ANY_PARAMETER) is acceptable. |
References UA::HiRISE::find_parameter().
Referenced by PDS_Data_Block::data_block_size(), Image_Data_Block::data_block_size(), PDS_Converter::image_data(), PDS_Projection_Data::initialize_geo_transform(), PDS_Projection_Data::initialize_spatial_reference(), HiRISE_PDS_Converter::label_recognized(), HiPrecision_PDS_Converter::label_recognized(), PDS_Data::parameter_value(), HiRISE_PDS_Converter::product_names(), and HiPrecision_PDS_Converter::product_names().
PDS_Data & parameters | ( | const std::string & | pathname ) | [virtual] |
Set the parameters from a source file.
The current parameters are cleared before the new parameters are moved in, but not before the new parameters have been successfully obtained from the source file.
N.B.: The name of the parameters group is set to the source file pathname.
pathname | The pathname to the source file that will be parsed for PVL parameters. |
std::ios::failure | If the source file can not be accessed or read. |
idaeim::PVL::Invalid_Syntax | If the source file contains contains invalid PVL syntax. |
Reimplemented in PDS_Projection_Data.
References ID.
Referenced by PDS_Projection_Data::parameters().
PDS_Data & parameters | ( | const idaeim::PVL::Aggregate & | parameters ) | [virtual] |
Set the parameters from a Parameter Aggregate.
The current parameters are cleared before the new parameters are moved in.
N.B.: The name of the parameters group is set to the name of the Parameter Aggregate.
parameters | A Parameter Aggregate that is the source of new parameters. |
Reimplemented in PDS_Projection_Data.
References Parameter::name().
Parameter * remove_parameter | ( | const std::string & | pathname, |
bool | case_sensitive = false , |
||
int | skip = 0 , |
||
Parameter_Class_Selection | parameter_class = ANY_PARAMETER |
||
) |
Removes a named Parameter.
pathname | The name of the parameter to find. |
case_sensitive | If true, the name search is case sensitive; case insensitive otherwise. |
skip | The number of parameters that match the name to skip before selecting a matching parameter. |
parameter_class | A Parameter_Class_Selection: If AGGREGATE_PARAMETER, only Aggregate parameters will be selected; if ASSIGNMENT_PARAMETER, only Assignment parameters will be selected; otherwise any type of parameter (ANY_PARAMETER) is acceptable. |
References UA::HiRISE::remove_parameter().
Referenced by Generic_PDS_Converter::write_PDS_JP2_label(), and Generic_PDS_Converter::write_PDS_label().
bool parameter_value | ( | const std::string & | pathname, |
T & | value, | ||
bool | case_sensitive = false , |
||
int | skip = 0 |
||
) | [inline] |
Set the value of a named parameter.
Only Assignment Parameters with a Value that is not an Array will be modified. However, the search for a matching name does not make this distinction.
pathname | The name of the parameter to find. |
value | The value to assign to the parameter. |
case_sensitive | If true, the name search is case sensitive; case insensitive otherwise. |
skip | The number of parameters that match the pathname to skip before selecting the parameter to modify. |
References PDS_Data::ASSIGNMENT_PARAMETER, Parameter::case_sensitive(), PDS_Data::find_parameter(), Aggregate::value(), and Parameter::value().
Referenced by main().
double numeric_value | ( | const std::string & | pathname, |
bool | case_sensitive = false , |
||
int | skip = 0 |
||
) | const |
Get the numeric value of a named parameter.
pathname | The name of the parameter to find. |
case_sensitive | If true, the name search is case sensitive; case insensitive otherwise. |
skip | The number of parameters that match the pathname to skip before selecting the parameter to modify. |
idaeim::Invalid_Argument | If an assignment parameter can not be found at the pathname. |
idaeim::PVL_Invalid_Value | If the Value is not Numeric. |
References UA::HiRISE::find_parameter(), ID, and UA::HiRISE::numeric_value().
Referenced by PDS_Projection_Data::initialize_geo_transform(), and PDS_Projection_Data::initialize_spatial_reference().
std::string string_value | ( | const std::string & | pathname, |
bool | case_sensitive = false , |
||
int | skip = 0 |
||
) | const |
Get the string value of a named parameter.
pathname | The name of the parameter to find. |
case_sensitive | If true, the name search is case sensitive; case insensitive otherwise. |
skip | The number of parameters that match the pathname to skip before selecting the parameter to modify. |
idaeim::Invalid_Argument | If an assignment parameter can not be found at the pathname. |
idaeim::PVL_Invalid_Value | If the Value is not a String. |
References UA::HiRISE::find_parameter(), ID, and UA::HiRISE::string_value().
Referenced by PDS_Projection_Data::initialize_spatial_reference().
Image_Data_Block * image_data | ( | PDS_Data_Block_List * | data_block_list ) | [static] |
Get the Image_Data_Block from a PDS_Data::PDS_Data_Block_List.
The data block list, if non-NULL, is searched for the first entry having the IMAGE_DATA_BLOCK_NAME that is an Image_Data_Block.
data_block_list | A pointer to a PDS_Data_Block_List to be searched. May be NULL. |
logic_error | If an entry with the IMAGE_DATA_BLOCK_NAME is found but it is not an Image_Data_Block. |
References ID.
Referenced by PDS_Converter::operator=().
const char *const ID = "UA::HiRISE::PDS_Data (1.27 2013/03/14 21:00:43)" [static] |
Class identification name with source code version and date.
Reimplemented from Parameter.
Reimplemented in Generic_PDS_Converter, HiPrecision_PDS_Converter, HiRISE_PDS_Converter, Image_Data_Block, PDS_Converter, PDS_Data_Block, and PDS_Projection_Data.
Referenced by UA::HiRISE::numeric_value(), and UA::HiRISE::string_value().
const char * PDS_ID_PARAMETER_NAME = "PDS_VERSION_ID" [static] |
Name of the parameter providing the PDS ID.
const char * RECORD_TYPE_PARAMETER_NAME = "RECORD_TYPE" [static] |
Name of the parameter specifying the type of label records.
const char * BYTE_RECORD_TYPE = "UNDEFINED" [static] |
The record type used to define byte count based records.
const char * FIXED_LENGTH_RECORD_TYPE = "FIXED_LENGTH" [static] |
The record type used to define fixed length records.
const char * LABEL_RECORDS_PARAMETER_NAME = "LABEL_RECORDS" [static] |
Name of the parameter specifying the number of records in the label.
const char * RECORD_BYTES_PARAMETER_NAME = "RECORD_BYTES" [static] |
Name of the parameter specifying the number of bytes per record.
const char * FILE_RECORDS_PARAMETER_NAME = "FILE_RECORDS" [static] |
Name of the parameter specifying the number of records in the file.
const char * INTERCHANGE_FORMAT_PARAMETER_NAME = "INTERCHANGE_FORMAT" [static] |
Name of the parameter indicating the data format.
const char * IMAGE_DATA_BLOCK_NAME = "IMAGE" [static] |
Name of the Image_Data_Block parameter group.
Referenced by PDS_Converter::image_data(), and main().
const char * BYTES_UNITS = "BYTES" [static] |
Units name for storage measured in bytes.
const char RECORD_POINTER_PARAMETER_MARKER = '^' [static] |
Record pointer parameter prefix.
When this character is the first character of a parameter name it is marked as a record pointer parameter for a data block. An associated group of parameters having the same name, but without the initial marker character, is expected to be present that describes the content of the data block.