31 #include <AttrTable.h>
34 #include <dods-datatypes.h>
35 #include <Marshaller.h>
36 #include <UnMarshaller.h>
43 using std::ostringstream;
49 RenamedArrayWrapper::RenamedArrayWrapper()
59 , _orgName(proto._orgName)
61 copyLocalRepFrom(proto);
66 , _pArray(toBeWrapped)
69 NCML_ASSERT_MSG(_pArray,
"RenamedArrayWrapper(): expected non-null Array to wrap!!");
70 _orgName = toBeWrapped->name();
93 copyLocalRepFrom(rhs);
105 Array::add_constraint(i, start, stride, stop);
114 Array::reset_constraint();
116 _pArray->reset_constraint();
122 Array::clear_constraint();
124 _pArray->clear_constraint();
137 oss <<
"RenamedArrayWrapper(" <<
this <<
"): " << endl;
138 oss <<
"\t_pArray=" << ((_pArray)?(_pArray->toString()):(
"NULL")) << endl;
151 return _pArray->is_simple_type();
157 return _pArray->is_vector_type();
163 return _pArray->is_constructor_type();
169 return _pArray->synthesized_p();
176 BaseType::set_synthesized_p(state);
177 _pArray->set_synthesized_p(state);
183 return _pArray->element_count(leaves);
189 return _pArray->read_p();
195 BaseType::set_read_p(state);
196 _pArray->set_read_p(state);
202 return _pArray->send_p();
208 BaseType::set_send_p(state);
209 _pArray->set_send_p(state);
216 return _pArray->get_attr_table();
222 _pArray->set_attr_table(at);
228 return _pArray->is_in_selection();
234 BaseType::set_in_selection(state);
235 _pArray->set_in_selection(state);
242 BaseType::set_parent(parent);
243 _pArray->set_parent(parent);
249 return _pArray->get_parent();
257 return _pArray->var(name, exact_match, s);
263 return _pArray->var(name, s);
269 _pArray->add_var(bt, part);
275 return _pArray->check_semantics(msg, all);
281 return _pArray->ops(b, op);
284 #if FILE_METHODS // from libdap/BaseType.h, whether to include FILE* methods
289 bool constraint_info ,
294 _pArray->print_decl(out, space, print_semi, constraint_info, constrained);
305 _pArray->print_xml(out, space, constrained);
320 #endif // FILE_METHODS
326 bool constraint_info ,
331 _pArray->print_decl(out, space, print_semi, constraint_info, constrained);
342 _pArray->print_xml(out, space, constrained);
350 return _pArray->width(constrained);
357 return _pArray->buf2val(val);
364 return _pArray->val2buf(val, reuse);
382 return _pArray->set_value(val, sz);
389 return _pArray->set_value(val, sz);
396 return _pArray->set_value(val, sz);
403 return _pArray->set_value(val, sz);
410 return _pArray->set_value(val, sz);
417 return _pArray->set_value(val, sz);
424 return _pArray->set_value(val, sz);
431 return _pArray->set_value(val, sz);
438 return _pArray->set_value(val, sz);
445 return _pArray->set_value(val, sz);
452 return _pArray->set_value(val, sz);
459 return _pArray->set_value(val, sz);
466 return _pArray->set_value(val, sz);
473 return _pArray->set_value(val, sz);
480 return _pArray->set_value(val, sz);
487 return _pArray->set_value(val, sz);
550 return _pArray->value();
559 bool ret = _pArray->read();
572 if (!_pArray->read_p())
581 _pArray->intern_data(eval, dds);
586 Marshaller &m,
bool ce_eval )
588 BESDEBUG(
"ncml",
"RenamedArrayWrapper::serialize(): Doing the magic for renamed read()!!" << endl);
593 if (!_pArray->read_p())
604 return _pArray->serialize(eval, dds, m, ce_eval);
612 return _pArray->deserialize(um, dds, reuse);
629 _pArray =
dynamic_cast<libdap::Array*
>(proto._pArray->ptr_duplicate());
631 _orgName = proto._orgName;
635 RenamedArrayWrapper::destroy()
642 RenamedArrayWrapper::withNewName()
648 RenamedArrayWrapper::withOrgName()
654 RenamedArrayWrapper::syncConstraints()
658 if (_pArray->dimensions() != dimensions())
660 THROW_NCML_INTERNAL_ERROR(
"RenamedArrayWrapper::syncConstraints(): dimensions() of this and wrapped array do not match!");
664 Array::Dim_iter thisEndIt = dim_end();
665 Array::Dim_iter thisIt, wrapIt;
666 for (thisIt = dim_begin(), wrapIt = _pArray->dim_begin(); thisIt != thisEndIt; ++thisIt, ++wrapIt)
668 Array::dimension& thisDim = *thisIt;
669 Array::dimension& wrapDim = *wrapIt;
674 update_length(this->length());
675 _pArray->set_length(this->length());
676 NCML_ASSERT_MSG(this->length() == _pArray->length(),
"RenamedArrayWrapper::syncConstraints(): length() of this and wrapped do not match!!");
virtual unsigned int width(bool constrained=false)
virtual BaseType * get_parent() const
virtual int element_count(bool leaves=false)
virtual unsigned int buf2val(void **val)
virtual bool ops(BaseType *b, int op)
virtual void set_read_p(bool state)
virtual bool synthesized_p()
An abstract superclass for NCMLArray that handles the non-parameterized functionality and allows u...
virtual void print_val(ostream &out, string space="", bool print_decl_p=true)
virtual void dump(ostream &strm) const
virtual void set_synthesized_p(bool state)
#define NCML_ASSERT_MSG(cond, msg)
virtual ~RenamedArrayWrapper()
virtual void set_in_selection(bool state)
static class NCMLUtil overview
virtual string toString()
RenamedArrayWrapper & operator=(const RenamedArrayWrapper &rhs)
virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse=false)
virtual void add_var(BaseType *bt, Part part=nil)
virtual void set_send_p(bool state)
virtual bool is_in_selection()
virtual void print_decl(ostream &out, string space=" ", bool print_semi=true, bool constraint_info=false, bool constrained=false)
virtual bool is_simple_type() const
virtual void intern_data(ConstraintEvaluator &eval, DDS &dds)
static void setVariableNameProperly(libdap::BaseType *pVar, const std::string &name)
Currently BaseType::set_name only sets in BaseType.
virtual bool check_semantics(string &msg, bool all=false)
virtual libdap::AttrTable & get_attr_table()
We don't keep our own...
virtual bool set_value(dods_byte *val, int sz)
#define THROW_NCML_INTERNAL_ERROR(msg)
virtual bool serialize(ConstraintEvaluator &eval, DDS &dds, Marshaller &m, bool ce_eval=true)
virtual void set_parent(BaseType *parent)
Keep these in sync so it doesn't matter where we get the parent from...
virtual BaseType * var(const string &name="", bool exact_match=true, btp_stack *s=0)
virtual RenamedArrayWrapper * ptr_duplicate()
virtual void reset_constraint()
virtual void clear_constraint()
virtual void set_attr_table(const libdap::AttrTable &at)
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
virtual unsigned int val2buf(void *val, bool reuse=false)
virtual bool is_constructor_type() const
A Decorator Pattern for wrapping a libdap::Array in order to change its name efficiently in the face ...
virtual void print_xml(ostream &out, string space=" ", bool constrained=false)
virtual bool is_vector_type() const
virtual void add_constraint(Dim_iter i, int start, int stride, int stop)
Wrappers.