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 #ifndef _dds_h
00038 #define _dds_h 1
00039
00040 #include <stdio.h>
00041
00042 #include <iostream>
00043 #include <string>
00044 #include <vector>
00045
00046
00047
00048 #ifndef _basetype_h
00049 #include "BaseType.h"
00050 #endif
00051
00052 #ifndef _constructor_h
00053 #include "Constructor.h"
00054 #endif
00055
00056 #ifndef base_type_factory_h
00057 #include "BaseTypeFactory.h"
00058 #endif
00059
00060 #ifndef _das_h
00061 #include "DAS.h"
00062 #endif
00063
00064 #ifndef A_DapObj_h
00065 #include "DapObj.h"
00066 #endif
00067
00068 using std::cout;
00069
00172 class DDS : public DapObj
00173 {
00174 private:
00175 BaseTypeFactory *d_factory;
00176
00177 string name;
00178
00179 string _filename;
00180
00181 int d_protocol_major;
00182 int d_protocol_minor;
00183
00184 AttrTable d_attr;
00185
00186 vector<BaseType *> vars;
00187 #if 0
00188 bool is_global_attr(string name);
00189 void add_global_attribute(AttrTable::entry *entry);
00190 #endif
00191 BaseType *find_hdf4_dimension_attribute_home(AttrTable::entry *source);
00192
00193 int d_timeout;
00194
00195
00196 friend class DDSTest;
00197
00198 protected:
00199 void duplicate(const DDS &dds);
00200 BaseType *leaf_match(const string &name, btp_stack *s = 0);
00201 BaseType *exact_match(const string &name, btp_stack *s = 0);
00202 #if 0
00203 void transfer_attr(DAS *das, const AttrTable::entry *ep, BaseType *btp,
00204 const string &suffix = "");
00205 void transfer_attr_table(DAS *das, AttrTable *at, BaseType *btp,
00206 const string &suffix = "");
00207 void transfer_attr_table(DAS *das, AttrTable *at, Constructor *c,
00208 const string &suffix = "");
00209 #endif
00210 virtual AttrTable *find_matching_container(AttrTable::entry *source,
00211 BaseType **dest_variable);
00212
00213 public:
00214 typedef std::vector<BaseType *>::const_iterator Vars_citer ;
00215 typedef std::vector<BaseType *>::iterator Vars_iter ;
00216 typedef std::vector<BaseType *>::reverse_iterator Vars_riter ;
00217
00218 DDS(BaseTypeFactory *factory, const string &n = "");
00219 DDS(const DDS &dds);
00220
00221 virtual ~DDS();
00222
00223 DDS & operator=(const DDS &rhs);
00224
00225 virtual void transfer_attributes(DAS *das);
00226
00227 string get_dataset_name() const;
00228 void set_dataset_name(const string &n);
00229
00234 BaseTypeFactory *get_factory() const
00235 {
00236 return d_factory;
00237 }
00238
00244 BaseTypeFactory *set_factory(BaseTypeFactory *factory)
00245 {
00246 BaseTypeFactory *t = d_factory;
00247 d_factory = factory;
00248 return t;
00249 }
00250
00251 virtual AttrTable &get_attr_table();
00252
00253 string filename();
00254 void filename(const string &fn);
00255
00256 void add_var(BaseType *bt);
00257
00259 void del_var(const string &n);
00260
00261 BaseType *var(const string &n, btp_stack &s);
00262 BaseType *var(const string &n, btp_stack *s = 0);
00263 int num_var();
00264
00266 Vars_iter var_begin();
00268 Vars_riter var_rbegin();
00270 Vars_iter var_end();
00272 Vars_riter var_rend();
00274 Vars_iter get_vars_iter(int i);
00276 BaseType *get_var_index(int i);
00278 void del_var(Vars_iter i);
00280 void del_var(Vars_iter i1, Vars_iter i2);
00281
00282 void timeout_on();
00283 void timeout_off();
00284 void set_timeout(int t);
00285 int get_timeout();
00286
00287 void parse(string fname);
00288 void parse(int fd);
00289 void parse(FILE *in = stdin);
00290
00291 void print(FILE *out);
00292 void print_constrained(FILE *out);
00293
00294 void print_xml(FILE *out, bool constrained, const string &blob);
00295
00296 void mark_all(bool state);
00297 bool mark(const string &name, bool state);
00298 bool check_semantics(bool all = false);
00299
00300 void tag_nested_sequences();
00301
00302 virtual void dump(ostream &strm) const ;
00303 };
00304
00305 #endif // _dds_h