46 #include <ConstraintEvaluator.h> 47 #include <Marshaller.h> 51 #include "CachedSequence.h" 58 void CachedSequence::load_prototypes_with_values(BaseTypeRow &btr,
bool safe)
64 Vars_iter i = d_vars.begin(), e = d_vars.end();
65 for (BaseTypeRow::iterator vi = btr.begin(), ve = btr.end(); vi != ve; ++vi) {
67 if (safe && (i == e || ((*i)->type() != (*vi)->type())))
68 throw InternalErr(__FILE__, __LINE__,
"Expected number and types to match when loading values.");
71 switch ((*i)->type()) {
73 static_cast<Byte*
>(*i++)->set_value(static_cast<Byte*>(*vi)->value());
76 static_cast<Int16*
>(*i++)->set_value(static_cast<Int16*>((*vi))->value());
79 static_cast<Int32*
>(*i++)->set_value(static_cast<Int32*>((*vi))->value());
82 static_cast<UInt16*
>(*i++)->set_value(static_cast<UInt16*>((*vi))->value());
85 static_cast<UInt32*
>(*i++)->set_value(static_cast<UInt32*>((*vi))->value());
88 static_cast<Float32*
>(*i++)->set_value(static_cast<Float32*>((*vi))->value());
91 static_cast<Float64*
>(*i++)->set_value(static_cast<Float64*>((*vi))->value());
94 static_cast<Str*
>(*i++)->set_value(static_cast<Str*>((*vi))->value());
97 static_cast<Url*
>(*i++)->set_value(static_cast<Url*>((*vi))->value());
100 case dods_sequence_c:
102 throw InternalErr(__FILE__, __LINE__,
"Expected nested sequence to be the last variable.");
106 throw InternalErr(__FILE__, __LINE__,
"Expected a scalar (or nested sequence) when loading values.");
143 DBGN(cerr << __PRETTY_FUNCTION__ <<
" name: " << name() <<
", row number " << row <<
", current row " << get_row_number() << endl);
152 assert(row > get_row_number());
154 while (row > get_row_number()) {
159 BaseTypeRow *btr_ptr = row_value(d_value_index++);
165 if (!btr_ptr)
return false;
169 load_prototypes_with_values(*btr_ptr,
false);
171 load_prototypes_with_values(*btr_ptr,
true);
174 increment_row_number(1);
177 else if (ce_eval && eval.eval_selection(dds, dataset())) {
178 increment_row_number(1);
203 return Sequence::serialize(eval, dds, m, ce_eval);
219 Sequence::intern_data(eval, dds);
233 strm << DapIndent::LMarg <<
"CachedSequence::dump - (" << (
void *)
this <<
")" << endl ;
234 DapIndent::Indent() ;
235 Sequence::dump(strm) ;
236 DapIndent::UnIndent() ;
virtual bool read_row(int row, libdap::DDS &dds, libdap::ConstraintEvaluator &eval, bool ce_eval)
Read row number row of the Sequence.
virtual void intern_data(libdap::ConstraintEvaluator &eval, libdap::DDS &dds)
Specialization that resets CachedSequence's 'value index' state variable.
virtual void dump(ostream &strm) const
dumps information about this object
virtual bool serialize(libdap::ConstraintEvaluator &eval, libdap::DDS &dds, libdap::Marshaller &m, bool ce_eval=true)
Specialization that resets CachedSequence's 'value index' state variable.