PDS_JP2
|
00001 /* PDS_Data 00002 00003 HiROC CVS ID: PDS_Data.hh,v 1.26 2013/03/14 21:00:43 guym 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 00137 PDS_Data (const idaeim::PVL::Aggregate& parameters, const std::string& detached); 00138 00145 explicit PDS_Data (const std::string& pathname); 00146 00147 00148 /*============================================================================== 00149 Accessors: 00150 */ 00183 PDS_Data_Block_List* data_blocks 00184 (const char** excluded = NULL, const char** image_block_names = NULL); 00185 00188 enum Parameter_Class_Selection 00189 { 00190 AGGREGATE_PARAMETER = -1, 00191 ANY_PARAMETER = 0, 00192 ASSIGNMENT_PARAMETER = 1 00193 }; 00194 00229 idaeim::PVL::Parameter* 00230 find_parameter 00231 ( 00232 const std::string& pathname, 00233 bool case_sensitive = false, 00234 int skip = 0, 00235 Parameter_Class_Selection parameter_class = ANY_PARAMETER 00236 ) 00237 const; 00238 00239 /*============================================================================== 00240 Manipulators: 00241 */ 00260 virtual PDS_Data& parameters (const std::string& pathname); 00261 00274 virtual PDS_Data& parameters (const idaeim::PVL::Aggregate& parameters); 00275 00293 idaeim::PVL::Parameter* 00294 remove_parameter 00295 ( 00296 const std::string& pathname, 00297 bool case_sensitive = false, 00298 int skip = 0, 00299 Parameter_Class_Selection parameter_class = ANY_PARAMETER 00300 ); 00301 00318 template <typename T> 00319 bool 00320 parameter_value 00321 ( 00322 const std::string& pathname, 00323 T& value, 00324 bool case_sensitive = false, 00325 int skip = 0 00326 ) 00327 { 00328 idaeim::PVL::Parameter 00329 *parameter = 00330 find_parameter (pathname, case_sensitive, skip, ASSIGNMENT_PARAMETER); 00331 if (! parameter || 00332 parameter->value ().is_Array ()) 00333 return false; 00334 parameter->value () = value; 00335 return true; 00336 } 00337 00352 double 00353 numeric_value 00354 ( 00355 const std::string& pathname, 00356 bool case_sensitive = false, 00357 int skip = 0 00358 ) 00359 const; 00360 00375 std::string 00376 string_value 00377 ( 00378 const std::string& pathname, 00379 bool case_sensitive = false, 00380 int skip = 0 00381 ) 00382 const; 00383 00384 /*============================================================================== 00385 Helpers 00386 */ 00399 static Image_Data_Block* image_data (PDS_Data_Block_List* data_block_list); 00400 00401 }; // class PDS_Data 00402 00403 00438 idaeim::PVL::Parameter* 00439 find_parameter 00440 ( 00441 const idaeim::PVL::Aggregate& parameters, 00442 const std::string& pathname, 00443 bool case_sensitive = false, 00444 int skip = 0, 00445 PDS_Data::Parameter_Class_Selection parameter_class 00446 = PDS_Data::ANY_PARAMETER 00447 ); 00448 00465 idaeim::PVL::Parameter* 00466 remove_parameter 00467 ( 00468 idaeim::PVL::Aggregate& parameters, 00469 const std::string& pathname, 00470 bool case_sensitive = false, 00471 int skip = 0, 00472 PDS_Data::Parameter_Class_Selection parameter_class 00473 = PDS_Data::ANY_PARAMETER 00474 ); 00475 00482 double numeric_value (const idaeim::PVL::Parameter& parameter); 00483 00490 std::string string_value (const idaeim::PVL::Parameter& parameter); 00491 00501 std::string absolute_pathname (const std::string& pathname); 00502 00509 std::string to_uppercase (const std::string& a_string); 00510 00523 std::string indent (std::string lines, int amount); 00524 00536 idaeim::PVL::Lister* label_lister (); 00537 00538 00539 } // namespace HiRISE 00540 } // namespace UA 00541 #endif 00542