libdap++  Updated for version 3.8.2
DAS.h
Go to the documentation of this file.
1 
2 // -*- mode: c++; c-basic-offset:4 -*-
3 
4 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
5 // Access Protocol.
6 
7 // Copyright (c) 2002,2003 OPeNDAP, Inc.
8 // Author: James Gallagher <jgallagher@opendap.org>
9 //
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 //
24 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25 
26 // (c) COPYRIGHT URI/MIT 1994-1999
27 // Please read the full copyright statement in the file COPYRIGHT_URI.
28 //
29 // Authors:
30 // jhrg,jimg James Gallagher <jgallagher@gso.uri.edu>
31 
32 // Using the DASVHMap class, build a parser for the DAS and add functions
33 // that provide access to the variables, their attributes and values.
34 //
35 // jhrg 7/25/94
36 
37 #ifndef _das_h
38 #define _das_h 1
39 
40 
41 #include <cstdio>
42 #include <string>
43 #include <iostream>
44 
45 //#include "Pix.h"
46 
47 #ifndef _attrtable_h
48 #include "AttrTable.h"
49 #endif
50 
51 using std::cout;
52 
53 namespace libdap
54 {
55 
123 class DAS : public DapObj
124 {
125 private:
126  AttrTable *d_container ;
127  string _container_name ;
128  AttrTable d_attrs ;
129 
130 protected:
131  //AttrTable *das_find(string name);
132 
133 public:
134  DAS();
135  //DAS(AttrTable *attr_table, string name);
136 
137  virtual ~DAS();
138 
139  virtual string container_name() ;
140  virtual void container_name( const string &cn ) ;
141  virtual AttrTable *container() ;
142 
150  {
151  if( d_container ) return d_container ;
152  return &d_attrs ;
153  }
154 
155  virtual void erase() ;
156 
157  virtual unsigned int get_size() const ;
158 
161 
162  string get_name(AttrTable::Attr_iter &i);
164 
165  virtual AttrTable *get_table(const string &name);
166 
167  virtual AttrTable *add_table(const string &name, AttrTable *at);
168 
170  virtual void parse(string fname);
171  virtual void parse(int fd);
172  virtual void parse(FILE *in = stdin);
173 
175  virtual void print(FILE *out, bool dereference = false);
176  virtual void print(ostream &out, bool dereference = false);
177 
178  virtual void dump(ostream &strm) const ;
179 };
180 
181 } // namespace libdap
182 
183 #endif // _das_h
std::vector< entry * >::iterator Attr_iter
Definition: AttrTable.h:233
virtual AttrTable * container()
Returns the current attribute container when multiple files used to build this DAS.
Definition: DAS.cc:139
AttrTable * get_table(AttrTable::Attr_iter &i)
Returns the referenced variable attribute table.
Definition: DAS.cc:215
Contains the attributes for a dataset.
Definition: AttrTable.h:146
AttrTable::Attr_iter var_begin()
Returns a reference to the attribute table for the first variable.
Definition: DAS.cc:178
virtual AttrTable * add_table(const string &name, AttrTable *at)
Adds a variable attribute table to the DAS or the current dataset container attribute table...
Definition: DAS.cc:247
virtual void print(FILE *out, bool dereference=false)
Definition: DAS.cc:365
DAS()
Definition: DAS.cc:80
string get_name(AttrTable::Attr_iter &i)
Returns the name of the referenced variable attribute table.
Definition: DAS.cc:203
virtual AttrTable * get_top_level_attributes()
Returns the top most set of attributes.
Definition: DAS.h:149
virtual void erase()
erase all attributes in this DAS
Definition: DAS.cc:163
AttrTable::Attr_iter var_end()
Definition: DAS.cc:191
virtual void dump(ostream &strm) const
dumps information about this object
Definition: DAS.cc:404
virtual void parse(string fname)
Reads a DAS from the named file.
Definition: DAS.cc:271
libdap base object for common functionality of libdap objects
Definition: DapObj.h:55
virtual ~DAS()
This deletes the pointers to AttrTables allocated during the parse (and at other times). jhrg 7/29/94.
Definition: DAS.cc:95
Hold attribute data for a DAP2 dataset.
Definition: DAS.h:123
virtual unsigned int get_size() const
Returns the number of attributes in the current attribute table.
Definition: DAS.cc:151
virtual string container_name()
Returns the name of the current attribute container when multiple files used to build this DAS...
Definition: DAS.cc:102