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
00118 class Grid: public Constructor
00119 {
00120 private:
00121 BaseType *_array_var;
00122 std::vector<BaseType *> _map_vars;
00123
00124 void _duplicate(const Grid &s);
00125
00126 public:
00127
00128 Grid(const string &n = "");
00129 Grid(const Grid &rhs);
00130 virtual ~Grid();
00131
00132 typedef std::vector<BaseType *>::const_iterator Map_citer ;
00133 typedef std::vector<BaseType *>::iterator Map_iter ;
00134 typedef std::vector<BaseType *>::reverse_iterator Map_riter ;
00135
00136
00137 Grid &operator=(const Grid &rhs);
00138 virtual BaseType *ptr_duplicate();
00139
00140 virtual int element_count(bool leaves = false);
00141
00142 virtual void set_send_p(bool state);
00143 virtual void set_read_p(bool state);
00144 virtual void set_in_selection(bool state);
00145
00146 virtual BaseType *var(const string &n, bool exact = true,
00147 btp_stack *s = 0);
00148
00149 virtual BaseType *var(const string &n, btp_stack &s);
00150
00151 virtual void add_var(BaseType *bt, Part part);
00152
00153 BaseType *array_var();
00154 Array *get_array();
00155
00156 virtual unsigned int width();
00157
00158 virtual int components(bool constrained = false);
00159
00160 virtual bool projection_yields_grid();
00161
00162 virtual void clear_constraint();
00163
00164 virtual bool serialize(const string &dataset, ConstraintEvaluator &eval,
00165 DDS &dds, XDR *sink, bool ce_eval = true);
00166 virtual bool deserialize(XDR *source, DDS *dds, bool reuse = false);
00167
00168 virtual unsigned int val2buf(void *buf, bool reuse = false);
00169
00170 virtual unsigned int buf2val(void **val);
00171
00172 virtual void print_decl(FILE *out, string space = " ",
00173 bool print_semi = true,
00174 bool constraint_info = false,
00175 bool constrained = false);
00176
00177 virtual void print_xml(FILE *out, string space = " ",
00178 bool constrained = false);
00179
00180 virtual void print_val(FILE *out, string space = "",
00181 bool print_decl_p = true);
00182
00183 virtual bool check_semantics(string &msg, bool all = false);
00184
00185 Map_iter map_begin() ;
00186 Map_iter map_end() ;
00187 Map_riter map_rbegin() ;
00188 Map_riter map_rend() ;
00189 Map_iter get_map_iter(int i);
00190
00191 virtual void dump(ostream &strm) const ;
00192 };
00193
00194 #endif // _grid_h
00195