48 #include <InternalErr.h>
49 #include <mime_util.h>
74 throw Error((
string)
"Could not open file " + path_to_filename(filename) +
string(
"."));
77 dds_table.set_dataset_name(name_path(filename));
82 throw Error(
"Insufficient memory");
87 SetUps->
input_file =
const_cast<char*
>(filename.c_str());
106 int error =
SetDodsDB(SetUps, &dbin, Msgt);
111 string msg = (string) Msgt +
" FreeForm error code: ";
112 append_long_to_string((
long) error, 10, msg);
121 char **var_names_vector =
NULL;
122 char **dim_names_vector =
NULL;
124 Sequence *seq =
NULL;
131 string msg =
"Could not get variable list from the input file. FreeForm error code: ";
132 append_long_to_string((
long) error, 10, msg);
138 string msg =
"Could not get process info for the input file. FreeForm error code: ";
139 append_long_to_string((
long) error, 10, msg);
144 bool is_array =
true;
145 for (
int i = 0; i < num_names; i++) {
146 int num_dim_names = 0;
152 string msg =
"Could not get array dimension names for variable: ";
153 msg += (string) var_names_vector[i] +
", FreeForm error code: ";
154 append_long_to_string((
long) error, 10, msg);
158 if (num_dim_names == 0)
159 cp = var_names_vector[i];
161 cp = strstr(var_names_vector[i],
"::");
175 memFree(dim_names_vector,
"**dim_names_vector");
176 dim_names_vector =
NULL;
181 pinfo_list = (pinfo_list)->next;
185 string msg =
"Variable " + (string)cp +
" was not found in the format file.";
198 bt =
new FFStr(cp, filename);
203 bt =
new FFByte(cp, filename);
207 bt =
new FFByte(cp, filename);
211 bt =
new FFInt16(cp, filename);
219 bt =
new FFInt32(cp, filename);
227 bt =
new FFInt32(cp, filename);
247 throw InternalErr(__FILE__, __LINE__,
"Unknown FreeForm type!");
250 if (num_dim_names == 0) {
251 if (!seq || newseq) {
256 seq->add_var_nocopy(bt);
260 ar =
new FFArray(cp, filename, bt, input_format_file);
267 for (
int j = 0; j < num_dim_names; j++) {
273 string msg = string(
"Could not get array dimension info for variable ")
274 + string(var_names_vector[i]) + string(
", FreeForm error code: ");
275 append_long_to_string((
long) error, 10, msg);
281 ar->append_dim(DimSiz, (
string) dim_names_vector[j]);
284 array_dim_info =
NULL;
288 memFree(dim_names_vector,
"**dim_names_vector");
289 dim_names_vector =
NULL;
292 dds_table.add_var_nocopy(ar);
294 dds_table.add_var_nocopy(seq);
298 dds_table.add_var_nocopy(seq);
308 if (var_names_vector)
309 memFree(var_names_vector,
"**var_names_vector");
312 if (dim_names_vector)
313 memFree(dim_names_vector,
"**dim_names_vector");
320 if (var_names_vector)
321 memFree(var_names_vector,
"**var_names_vector");
324 if (dim_names_vector)
325 memFree(dim_names_vector,
"**dim_names_vector");
const string find_ancillary_rss_formats(const string &dataset, const string &, const string &)
Find the RSS (Remote Sensing Systems) format file using their naming convention.
bool file_exist(const char *filename)
int SetDodsDB(FF_STD_ARGS_PTR std_args, DATA_BIN_HANDLE dbin_h, char *Msgt)
Given a set of standard arguments (input filenames), allocate a DATA-BIN_HANDLE and return an error c...
struct struct_ff_std_args::struct_std_args_user user
virtual void set_length(int len)
unsigned int is_stdin_redirected
void ff_read_descriptors(DDS &dds_table, const string &filename)
static bool get_RSS_format_support()