00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef _grid_h
00041 #define _grid_h 1
00042
00043 #include <vector>
00044
00045
00046
00047 #ifndef _basetype_h
00048 #include "BaseType.h"
00049 #endif
00050
00051 #ifndef _array_h
00052 #include "Array.h"
00053 #endif
00054
00055 #ifndef _constructor_h
00056 #include "Constructor.h"
00057 #endif
00058
00059 #ifndef constraint_evaluator_h
00060 #include "ConstraintEvaluator.h"
00061 #endif
00062
00063 namespace libdap
00064 {
00065
00121 class Grid: public Constructor
00122 {
00123 private:
00124 BaseType *_array_var;
00125 std::vector<BaseType *> _map_vars;
00126
00127 void _duplicate(const Grid &s);
00128
00129 public:
00130
00131 Grid(const string &n);
00132 Grid(const string &n, const string &d);
00133 Grid(const Grid &rhs);
00134 virtual ~Grid();
00135
00136 typedef std::vector<BaseType *>::const_iterator Map_citer ;
00137 typedef std::vector<BaseType *>::iterator Map_iter ;
00138 typedef std::vector<BaseType *>::reverse_iterator Map_riter ;
00139
00140
00141 Grid &operator=(const Grid &rhs);
00142 virtual BaseType *ptr_duplicate();
00143
00144 virtual int element_count(bool leaves = false);
00145
00146 virtual void set_send_p(bool state);
00147 virtual void set_read_p(bool state);
00148 virtual void set_in_selection(bool state);
00149
00150 virtual BaseType *var(const string &n, bool exact = true,
00151 btp_stack *s = 0);
00152
00153 virtual BaseType *var(const string &n, btp_stack &s);
00154
00155 virtual void add_var(BaseType *bt, Part part);
00156
00157 BaseType *array_var();
00158 Array *get_array();
00159
00160 virtual unsigned int width();
00161
00162 virtual int components(bool constrained = false);
00163
00164 virtual bool projection_yields_grid();
00165
00166 virtual void clear_constraint();
00167
00168 virtual void intern_data(ConstraintEvaluator &eval, DDS &dds);
00169 virtual bool serialize(ConstraintEvaluator &eval, DDS &dds,
00170 Marshaller &m, bool ce_eval = true);
00171 virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse = false);
00172
00173 virtual unsigned int val2buf(void *buf, bool reuse = false);
00174
00175 virtual unsigned int buf2val(void **val);
00176
00177 virtual void print_decl(ostream &out, string space = " ",
00178 bool print_semi = true,
00179 bool constraint_info = false,
00180 bool constrained = false);
00181
00182 virtual void print_xml(ostream &out, string space = " ",
00183 bool constrained = false);
00184
00185 virtual void print_val(ostream &out, string space = "",
00186 bool print_decl_p = true);
00187
00188
00189 virtual void print_decl(FILE *out, string space = " ",
00190 bool print_semi = true,
00191 bool constraint_info = false,
00192 bool constrained = false);
00193 virtual void print_xml(FILE *out, string space = " ",
00194 bool constrained = false);
00195 virtual void print_val(FILE *out, string space = "",
00196 bool print_decl_p = true);
00197
00198
00199 virtual bool check_semantics(string &msg, bool all = false);
00200
00201 Map_iter map_begin() ;
00202 Map_iter map_end() ;
00203 Map_riter map_rbegin() ;
00204 Map_riter map_rend() ;
00205 Map_iter get_map_iter(int i);
00206
00207 virtual void dump(ostream &strm) const ;
00208 };
00209
00210 }
00211
00212 #endif // _grid_h
00213