HiRISE
 PDS_JP2

PDS_Data.hh
Go to the documentation of this file.
1 /* PDS_Data
2 
3 HiROC CVS ID: PDS_Data.hh,v 1.26 2013/03/14 21:00:43 guym Exp
4 
5 Copyright (C) 2006-2007 Arizona Board of Regents on behalf of the
6 Planetary Image Research Laboratory, Lunar and Planetary Laboratory at
7 the University of Arizona.
8 
9 This library is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License, version 2.1,
11 as published by the Free Software Foundation.
12 
13 This library is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public License
19 along with this library; if not, write to the Free Software Foundation,
20 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 */
22 
23 #ifndef _PDS_Data_
24 #define _PDS_Data_
25 
26 #include "PVL.hh"
27 
28 #include <vector>
29 
30 
31 namespace UA
32 {
33 namespace HiRISE
34 {
35 // Forward references.
36 class PDS_Data_Block;
37 class Image_Data_Block;
38 
39 
50 class PDS_Data
52 {
53 public:
54 /*==============================================================================
55  Types
56 */
58 typedef std::vector<PDS_Data_Block*> PDS_Data_Block_List;
59 
60 /*==============================================================================
61  Constants:
62 */
64 static const char* const
65  ID;
66 
68 static const char*
70 
72 static const char
74 
76 static const char
78 
80 static const char
82 
84 static const char
86 
88 static const char
90 
92 static const char
94 
96 static const char
98 
100 static const char*
102 
104 static const char*
106 
115 static const char
117 
118 /*==============================================================================
119  Constructors:
120 */
123 PDS_Data ();
124 
131 
137 PDS_Data (const idaeim::PVL::Aggregate& parameters, const std::string& detached);
138 
145 explicit PDS_Data (const std::string& pathname);
146 
147 
148 /*==============================================================================
149  Accessors:
150 */
184  (const char** excluded = NULL, const char** image_block_names = NULL);
185 
189  {
193  };
194 
231  (
232  const std::string& pathname,
233  bool case_sensitive = false,
234  int skip = 0,
235  Parameter_Class_Selection parameter_class = ANY_PARAMETER
236  )
237  const;
238 
239 /*==============================================================================
240  Manipulators:
241 */
260 virtual PDS_Data& parameters (const std::string& pathname);
261 
275 
295  (
296  const std::string& pathname,
297  bool case_sensitive = false,
298  int skip = 0,
299  Parameter_Class_Selection parameter_class = ANY_PARAMETER
300  );
301 
318 template <typename T>
319 bool
321  (
322  const std::string& pathname,
323  T& value,
324  bool case_sensitive = false,
325  int skip = 0
326  )
327 {
329  *parameter =
331 if (! parameter ||
332  parameter->value ().is_Array ())
333  return false;
334 parameter->value () = value;
335 return true;
336 }
337 
352 double
354  (
355  const std::string& pathname,
356  bool case_sensitive = false,
357  int skip = 0
358  )
359  const;
360 
375 std::string
377  (
378  const std::string& pathname,
379  bool case_sensitive = false,
380  int skip = 0
381  )
382  const;
383 
384 /*==============================================================================
385  Helpers
386 */
399 static Image_Data_Block* image_data (PDS_Data_Block_List* data_block_list);
400 
401 }; // class PDS_Data
402 
403 
440  (
441  const idaeim::PVL::Aggregate& parameters,
442  const std::string& pathname,
443  bool case_sensitive = false,
444  int skip = 0,
447  );
448 
467  (
468  idaeim::PVL::Aggregate& parameters,
469  const std::string& pathname,
470  bool case_sensitive = false,
471  int skip = 0,
474  );
475 
482 double numeric_value (const idaeim::PVL::Parameter& parameter);
483 
490 std::string string_value (const idaeim::PVL::Parameter& parameter);
491 
501 std::string absolute_pathname (const std::string& pathname);
502 
509 std::string to_uppercase (const std::string& a_string);
510 
523 std::string indent (std::string lines, int amount);
524 
537 
538 
539 } // namespace HiRISE
540 } // namespace UA
541 #endif
542 
An Image_Data_Block describes PDS image data.
Definition: Image_Data_Block.hh:45
PDS_Data contains PDS label PVL parameters.
Definition: PDS_Data.hh:52
std::string string_value(const std::string &pathname, bool case_sensitive=false, int skip=0) const
Get the string value of a named parameter.
Definition: PDS_Data.cc:590
static const char * FILE_RECORDS_PARAMETER_NAME
Name of the parameter specifying the number of records in the file.
Definition: PDS_Data.hh:93
Parameter_Class_Selection
Selects the class of parameter to find.
Definition: PDS_Data.hh:189
@ ASSIGNMENT_PARAMETER
Definition: PDS_Data.hh:192
@ AGGREGATE_PARAMETER
Definition: PDS_Data.hh:190
@ ANY_PARAMETER
Definition: PDS_Data.hh:191
static const char * FIXED_LENGTH_RECORD_TYPE
The record type used to define fixed length records.
Definition: PDS_Data.hh:81
static const char RECORD_POINTER_PARAMETER_MARKER
Record pointer parameter prefix.
Definition: PDS_Data.hh:116
virtual PDS_Data & parameters(const std::string &pathname)
Set the parameters from a source file.
Definition: PDS_Data.cc:305
static const char * BYTES_UNITS
Units name for storage measured in bytes.
Definition: PDS_Data.hh:105
bool parameter_value(const std::string &pathname, T &value, bool case_sensitive=false, int skip=0)
Set the value of a named parameter.
Definition: PDS_Data.hh:321
static const char * RECORD_TYPE_PARAMETER_NAME
Name of the parameter specifying the type of label records.
Definition: PDS_Data.hh:73
static const char * BYTE_RECORD_TYPE
The record type used to define byte count based records.
Definition: PDS_Data.hh:77
std::vector< PDS_Data_Block * > PDS_Data_Block_List
A vector of PDS_Data_Block object pointers.
Definition: PDS_Data.hh:58
static const char * LABEL_RECORDS_PARAMETER_NAME
Name of the parameter specifying the number of records in the label.
Definition: PDS_Data.hh:85
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.
Definition: PDS_Data.cc:517
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.
Definition: PDS_Data.cc:145
static const char * INTERCHANGE_FORMAT_PARAMETER_NAME
Name of the parameter indicating the data format.
Definition: PDS_Data.hh:97
static const char * IMAGE_DATA_BLOCK_NAME
Name of the Image_Data_Block parameter group.
Definition: PDS_Data.hh:101
PDS_Data()
Construct PDS_Data with no parameters.
Definition: PDS_Data.cc:98
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.
Definition: PDS_Data.cc:477
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.
Definition: PDS_Data.cc:371
static const char * RECORD_BYTES_PARAMETER_NAME
Name of the parameter specifying the number of bytes per record.
Definition: PDS_Data.hh:89
static const char * PDS_ID_PARAMETER_NAME
Name of the parameter providing the PDS ID.
Definition: PDS_Data.hh:69
double numeric_value(const std::string &pathname, bool case_sensitive=false, int skip=0) const
Get the numeric value of a named parameter.
Definition: PDS_Data.cc:548
static const char *const ID
Class identification name with source code version and date.
Definition: PDS_Data.hh:65
Value & value() const
static bool case_sensitive()
std::string pathname(const Parameter *root=NULL) const
virtual Value & value() const=0
virtual bool is_Array() const
double numeric_value(const idaeim::PVL::Parameter &parameter)
Get the numeric value of a parameter.
Definition: PDS_Data.cc:529
std::string string_value(const idaeim::PVL::Parameter &parameter)
Get the string value of a parameter.
Definition: PDS_Data.cc:571
string indent(std::string lines, int amount)
Indent lines of text by the specified number of spaces.
Definition: PDS_Data.cc:647
idaeim::PVL::Lister * label_lister()
Get a PVL Lister appropriately configured for PDS label generation.
Definition: PDS_Data.cc:675
std::string absolute_pathname(const std::string &pathname)
Ensure an absolute pathname.
Definition: PDS_Data.cc:613
string to_uppercase(const string &a_string)
Definition: PDS_Data.cc:630
Parameter * remove_parameter(idaeim::PVL::Aggregate &parameters, const std::string &pathname, bool case_sensitive, int skip, PDS_Data::Parameter_Class_Selection parameter_class)
Removes a named Parameter within a Parameter Aggregate.
Definition: PDS_Data.cc:490
Parameter * find_parameter(const idaeim::PVL::Aggregate &parameters, const std::string &pathname, bool case_sensitive, int skip, PDS_Data::Parameter_Class_Selection parameter_class)
Find a named Parameter within a Parameter Aggregate.
Definition: PDS_Data.cc:425
Definition: Dimensions.cc:30