HiRISE
 Observation

Label_Patcher.hh
Go to the documentation of this file.
1 /* Label_Patcher
2 
3 PIRL CVS ID: Label_Patcher.hh,v 1.5 2020/02/14 01:17:17 schaller Exp
4 
5 Copyright (C) 2009-2020 Arizona Board of Regents on behalf of the Lunar and
6 Planetary Laboratory at the University of Arizona.
7 
8 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
9 this file except in compliance with the License. You may obtain a copy of the
10 License at
11 
12  http://www.apache.org/licenses/LICENSE-2.0
13 
14 Unless required by applicable law or agreed to in writing, software distributed
15 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
16 CONDITIONS OF ANY KIND, either express or implied. See the License for the
17 specific language governing permissions and limitations under the License.
18 */
19 #ifndef _LABEL_PATCHER_
20 #define _LABEL_PATCHER_
21 
22 #include "PVL.hh"
23 
24 #include <iosfwd>
25 #include <string>
26 
27 #ifndef MODULE_VERSION
28 #define _VERSION_ " "
29 #else
30 #define _VERSION_ " v" MODULE_VERSION " "
31 #endif
32 
34 void usage (const char* const program);
35 
36 
37 namespace UA
38 {
39 namespace HiRISE
40 {
42 {
43 public:
44 /*==============================================================================
45  Constants:
46 */
48 static const char* const
49  ID;
50 
52 static const char
55 
57 static const char
60 
62 static const char
64 
66 static const char
67  * const DATABASE_TYPE,
68  * const TYPE_PARAMETER,
70  * const HOST_PARAMETER,
71  * const USER_PARAMETER,
74  * const TABLE_PARAMETER;
75 
76 #ifndef DEFAULT_CONFIGURATION_FILENAME
77 #define DEFAULT_CONFIGURATION_FILENAME "Database.conf"
78 #endif
79 
80 #ifndef DEFAULT_DATABASE_HOST
81 #define DEFAULT_DATABASE_HOST ""
82 #endif
83 
84 #ifndef DEFAULT_DATABASE_CATALOG
85 #define DEFAULT_DATABASE_CATALOG "HiRISE"
86 #endif
87 
88 #ifndef DEFAULT_DATABASE_TABLE
89 #define DEFAULT_DATABASE_TABLE "EDR_Products"
90 #endif
91 
93 static const char
95 
97 #ifndef BACKUP_FILENAME_SUFFIX
98 #define BACKUP_FILENAME_SUFFIX "-backup"
99 #endif
100 
102 static const int
104 
105  // Command line syntax.
107 
108  // Configuration.
110 
111  // Database.
113 
114  // Software / data problem.
120 
121  // IO.
126 
127  // PVL.
129 
130  // Unknown?
132 
133 /*==============================================================================
134  Data members:
135 */
136 bool
140 
141 std::string
143 std::ifstream
145 
153 
155 std::string
157 
159  {
160  std::string
168  }
170 
171 /*==============================================================================
172  Constructor
173 */
175  (
176  int count,
177  char** arguments
178  );
179 
180 private:
181 Label_Patcher () {}
182 
183 public:
184 /*==============================================================================
185  Manipulators
186 */
188 label_parameter (const std::string& pathname);
189 
190 void
192 
193 void
195 
196 std::string
197 database_field_value (const std::string& field, const std::string& key,
198  const std::string& table = "");
199 
200 std::string
202 
203 std::string
205 
206 void
208 
209 int
210 apply_patch ();
211 
212 }; // Class Label_Patcher
213 
214 
215 } // namespace HiRISE
216 } // namespace UA
217 #endif
void usage(const char *const program)
Must be defined by the application.
Definition: patch_DATA_SET_NAME.cc:40
Definition: Label_Patcher.hh:42
static const char *const *const *const SERVER_PARAMETER
Definition: Label_Patcher.hh:69
bool Backup
Definition: Label_Patcher.hh:137
static const int IO_FAILURE
Definition: Label_Patcher.hh:125
std::string Observation_ID
The Observation ID value used to select a database record.
Definition: Label_Patcher.hh:156
std::string database_configuration_report()
Definition: Label_Patcher.cc:1128
static const char *const *const *const *const *const *const *const CATALOG_PARAMETER
Definition: Label_Patcher.hh:73
static const char *const *const *const *const *const *const PASSWORD_PARAMETER
Definition: Label_Patcher.hh:72
std::string database_field_value(const std::string &field, const std::string &key, const std::string &table="")
Definition: Label_Patcher.cc:1033
static const int LOGIC_ERROR
Definition: Label_Patcher.hh:119
static const int OUT_OF_RANGE
Definition: Label_Patcher.hh:118
std::ifstream * Input_File
Definition: Label_Patcher.hh:144
static const int INVALID_ARGUMENT
Definition: Label_Patcher.hh:115
static const char *const *const *const *const HOST_PARAMETER
Definition: Label_Patcher.hh:70
bool Verbose
Definition: Label_Patcher.hh:139
static const char *const *const *const *const *const USER_PARAMETER
Definition: Label_Patcher.hh:71
static const int UNKNOWN_ERROR
Definition: Label_Patcher.hh:131
static const int NO_INPUT_FILE
Definition: Label_Patcher.hh:122
static const char *const *const TYPE_PARAMETER
Definition: Label_Patcher.hh:68
bool Force
Definition: Label_Patcher.hh:138
struct UA::HiRISE::Label_Patcher::Database_Configuration Database_Configuration_Values
static const int CONFIGURATION_FAILURE
Definition: Label_Patcher.hh:109
static const int NO_OUTPUT_FILE
Definition: Label_Patcher.hh:123
static const char *const PDS_VERSION_ID_PARAMETER
Names of parameters to be accessed.
Definition: Label_Patcher.hh:53
idaeim::PVL::Parameter * label_parameter(const std::string &pathname)
Definition: Label_Patcher.cc:462
idaeim::PVL::Lister PDS_Label_Lister
PDS formatting of PVL.
Definition: Label_Patcher.hh:150
void disconnect_from_database()
Definition: Label_Patcher.cc:1148
static const char *const OBSERVATION_ID_FIELD
Database field names.
Definition: Label_Patcher.hh:94
static const char *const DATABASE_TYPE
Database access configuration parameters.
Definition: Label_Patcher.hh:67
idaeim::PVL::Aggregate * PDS_Label
Definition: Label_Patcher.hh:147
static const int NO_PVL_FILE
Definition: Label_Patcher.hh:124
static const int PVL_ERROR
Definition: Label_Patcher.hh:128
std::string Input_Pathname
Definition: Label_Patcher.hh:142
static const int SUCCESS
Exit status values.
Definition: Label_Patcher.hh:103
static const char *const DATA_LOCATION_PREFIX
Definition: Label_Patcher.hh:59
static const char *const LOOKUP_CONVERSION_TABLE
Names of parameters requiring ad hoc formatting adjustment.
Definition: Label_Patcher.hh:63
void connect_to_database()
Definition: Label_Patcher.cc:997
std::string database_connection_report()
Definition: Label_Patcher.cc:1138
static const char *const *const OBSERVATION_ID_PARAMETER
Definition: Label_Patcher.hh:54
void configure_database()
Definition: Label_Patcher.cc:797
static const int DATABASE_ERROR
Definition: Label_Patcher.hh:112
idaeim::PVL::Parameter * Label_Size_Parameter
Definition: Label_Patcher.hh:152
static const int UNDERFLOW_ERROR
Definition: Label_Patcher.hh:117
static const char *const *const *const *const *const *const *const *const TABLE_PARAMETER
Definition: Label_Patcher.hh:74
static const int LENGTH_ERROR
Definition: Label_Patcher.hh:116
int apply_patch()
Definition: Label_Patcher.cc:484
static const char *const LABEL_RECORDS_PARAMETER
Names of parameters that will have values changed if label size changes.
Definition: Label_Patcher.hh:58
static const char *const ID
Class identification name with source code version and date.
Definition: Label_Patcher.hh:49
static const int BAD_SYNTAX
Definition: Label_Patcher.hh:106
string pathname(const std::string &filename)
Gets a fully qualified pathname for a filename.
Definition: Data_Component.cc:1132
University of Arizona.
std::string Configuration_Pathname
Definition: Label_Patcher.hh:161
std::string Server
Definition: Label_Patcher.hh:162
std::string Catalog
Definition: Label_Patcher.hh:166
std::string Table
Definition: Label_Patcher.hh:167
std::string User
Definition: Label_Patcher.hh:164
std::string Host
Definition: Label_Patcher.hh:163
std::string Password
Definition: Label_Patcher.hh:165