41 using std::ostringstream;
45 #include <D4Attributes.h>
69 Sequence(n, d), d_input_format_file(iff)
78 static long Records(
const string &filename)
85 static char Msgt[255];
94 SetUps->
input_file =
const_cast<char*
>(filename.c_str());
134 DBG(cerr <<
"Entering FFSequence::read..." << endl);
148 o_fmt <<
"binary_output_data \"DODS binary output data\"" << endl;
149 for (Vars_iter p = var_begin(); p != var_end(); ++p) {
150 if ((*p)->synthesized_p())
152 if ((*p)->type() == dods_str_c)
153 endbyte += static_cast<FFStr&>(**p).length();
155 endbyte += (*p)->width();
157 o_fmt << (*p)->name() <<
" " << stbyte <<
" " << endbyte <<
" " <<
ff_types((*p)->type()) <<
" "
158 <<
ff_prec((*p)->type()) << endl;
159 stbyte = endbyte + 1;
162 DBG(cerr << o_fmt.str());
165 long num_rec =
Records(dataset());
170 BufSiz = num_rec * (stbyte - 1);
173 long bytes =
read_ff(dataset().c_str(), d_input_format_file.c_str(), o_fmt.str().c_str(),
BufVal,
BufSiz);
176 throw Error(
"Could not read requested data from the dataset.");
179 for (Vars_iter p = var_begin(); p != var_end(); ++p) {
189 Vars_iter var = var_begin();
190 while (var != var_end()) {
191 (*var)->transfer_attributes(at);
206 Constructor::transform_to_dap4(root, dest);
208 dest->set_length(-1);
209 dest->set_parent(container);
214 for (Constructor::Vars_citer i = var_begin(), e = var_end(); i != e; ++i) {
215 BaseType *new_var = (*i)->transform_to_dap4(root, dest);
217 new_var->set_parent(dest);
218 dest->add_var_nocopy(new_var);
221 throw InternalErr(__FILE__, __LINE__,
"transform_to_dap4() returned null, but no Grid could be here.");
226 dest->attributes()->transform_to_dap4(get_attr_table());
228 dest->set_is_dap4(
true);
229 dest->set_parent(container);
231 dest->set_length(-1);
virtual BaseType * transform_to_dap4(D4Group *root, Constructor *container)
long Records(const string &filename)
Figure out how many records there are in the dataset.
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
FFSequence(const string &n, const string &d, const string &iff)
virtual void transfer_attributes(AttrTable *at)
unsigned int is_stdin_redirected
const string ff_types(Type dods_type)
virtual BaseType * ptr_duplicate()
int ff_prec(Type dods_type)
virtual bool read()
Read a row from the Sequence.
long read_ff(const char *dataset, const char *if_file, const char *o_format, char *o_buffer, unsigned long bsize)
Read from a file/database using the FreeForm API.