|
|
PDS_JP2
|
00001 /* PDS_Data 00002 00003 HiROC CVS ID: PDS_Data.hh,v 1.25 2008/05/21 21:53:12 castalia Exp 00004 00005 Copyright (C) 2006-2007 Arizona Board of Regents on behalf of the 00006 Planetary Image Research Laboratory, Lunar and Planetary Laboratory at 00007 the University of Arizona. 00008 00009 This library is free software; you can redistribute it and/or modify it 00010 under the terms of the GNU Lesser General Public License, version 2.1, 00011 as published by the Free Software Foundation. 00012 00013 This library is distributed in the hope that it will be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public License 00019 along with this library; if not, write to the Free Software Foundation, 00020 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00021 */ 00022 00023 #ifndef _PDS_Data_ 00024 #define _PDS_Data_ 00025 00026 #include "PVL.hh" 00027 00028 #include <vector> 00029 00030 00031 namespace UA 00032 { 00033 namespace HiRISE 00034 { 00035 // Forward references. 00036 class PDS_Data_Block; 00037 class Image_Data_Block; 00038 00039 00050 class PDS_Data 00051 : public idaeim::PVL::Aggregate 00052 { 00053 public: 00054 /*============================================================================== 00055 Types 00056 */ 00058 typedef std::vector<PDS_Data_Block*> PDS_Data_Block_List; 00059 00060 /*============================================================================== 00061 Constants: 00062 */ 00064 static const char* const 00065 ID; 00066 00068 static const char* 00069 PDS_ID_PARAMETER_NAME; 00070 00072 static const char 00073 *RECORD_TYPE_PARAMETER_NAME; 00074 00076 static const char 00077 *BYTE_RECORD_TYPE; 00078 00080 static const char 00081 *FIXED_LENGTH_RECORD_TYPE; 00082 00084 static const char 00085 *LABEL_RECORDS_PARAMETER_NAME; 00086 00088 static const char 00089 *RECORD_BYTES_PARAMETER_NAME; 00090 00092 static const char 00093 *FILE_RECORDS_PARAMETER_NAME; 00094 00096 static const char 00097 *INTERCHANGE_FORMAT_PARAMETER_NAME; 00098 00100 static const char* 00101 IMAGE_DATA_BLOCK_NAME; 00102 00104 static const char* 00105 BYTES_UNITS; 00106 00115 static const char 00116 RECORD_POINTER_PARAMETER_MARKER; 00117 00118 /*============================================================================== 00119 Constructors: 00120 */ 00123 PDS_Data (); 00124 00130 PDS_Data (const idaeim::PVL::Aggregate& parameters); 00131 00138 explicit PDS_Data (const std::string& pathname); 00139 00140 /*============================================================================== 00141 Accessors: 00142 */ 00175 PDS_Data_Block_List* data_blocks 00176 (const char** excluded = NULL, const char** image_block_names = NULL); 00177 00180 enum Parameter_Class_Selection 00181 { 00182 AGGREGATE_PARAMETER = -1, 00183 ANY_PARAMETER = 0, 00184 ASSIGNMENT_PARAMETER = 1 00185 }; 00186 00221 idaeim::PVL::Parameter* 00222 find_parameter 00223 ( 00224 const std::string& pathname, 00225 bool case_sensitive = false, 00226 int skip = 0, 00227 Parameter_Class_Selection parameter_class = ANY_PARAMETER 00228 ) 00229 const; 00230 00231 /*============================================================================== 00232 Manipulators: 00233 */ 00252 virtual PDS_Data& parameters (const std::string& pathname); 00253 00266 virtual PDS_Data& parameters (const idaeim::PVL::Aggregate& parameters); 00267 00285 idaeim::PVL::Parameter* 00286 remove_parameter 00287 ( 00288 const std::string& pathname, 00289 bool case_sensitive = false, 00290 int skip = 0, 00291 Parameter_Class_Selection parameter_class = ANY_PARAMETER 00292 ); 00293 00310 template <typename T> 00311 bool 00312 parameter_value 00313 ( 00314 const std::string& pathname, 00315 T& value, 00316 bool case_sensitive = false, 00317 int skip = 0 00318 ) 00319 { 00320 idaeim::PVL::Parameter 00321 *parameter = 00322 find_parameter (pathname, case_sensitive, skip, ASSIGNMENT_PARAMETER); 00323 if (! parameter || 00324 parameter->value ().is_Array ()) 00325 return false; 00326 parameter->value () = value; 00327 return true; 00328 } 00329 00344 double 00345 numeric_value 00346 ( 00347 const std::string& pathname, 00348 bool case_sensitive = false, 00349 int skip = 0 00350 ) 00351 const; 00352 00367 std::string 00368 string_value 00369 ( 00370 const std::string& pathname, 00371 bool case_sensitive = false, 00372 int skip = 0 00373 ) 00374 const; 00375 00376 /*============================================================================== 00377 Helpers 00378 */ 00391 static Image_Data_Block* image_data (PDS_Data_Block_List* data_block_list); 00392 00393 }; // class PDS_Data 00394 00395 00430 idaeim::PVL::Parameter* 00431 find_parameter 00432 ( 00433 const idaeim::PVL::Aggregate& parameters, 00434 const std::string& pathname, 00435 bool case_sensitive = false, 00436 int skip = 0, 00437 PDS_Data::Parameter_Class_Selection parameter_class 00438 = PDS_Data::ANY_PARAMETER 00439 ); 00440 00457 idaeim::PVL::Parameter* 00458 remove_parameter 00459 ( 00460 idaeim::PVL::Aggregate& parameters, 00461 const std::string& pathname, 00462 bool case_sensitive = false, 00463 int skip = 0, 00464 PDS_Data::Parameter_Class_Selection parameter_class 00465 = PDS_Data::ANY_PARAMETER 00466 ); 00467 00474 double numeric_value (const idaeim::PVL::Parameter& parameter); 00475 00482 std::string string_value (const idaeim::PVL::Parameter& parameter); 00483 00493 std::string absolute_pathname (const std::string& pathname); 00494 00501 std::string to_uppercase (const std::string& a_string); 00502 00515 std::string indent (std::string lines, int amount); 00516 00528 idaeim::PVL::Lister* label_lister (); 00529 00530 00531 } // namespace HiRISE 00532 } // namespace UA 00533 #endif 00534
1.5.3